coLinux
Advertisement

<msonsuz> I normally use Fedora Core with colinux. But for a change I wanted to try Mandriva. Tried to make this article beginnersfriendly as possible. This is also a placeholder to get back if I forgot how I dit it :) If you can improve please do. If you have questions ask at techdesk100 (at) hotmail (dot) com.

Extra information[]

Because I use mingw cygwin colinux qemu etc. I made a folder in my c drive called Linux and which has subfolders for each distribution.

c:\Linux 
- Colinux
- Cygwin
- Distro (the folder with image files for colinux/qemu/distribtion iso's)
- Mingw
- Qemu
...

Link[]

TOOLS

WEBSITES

Qemu to make an minimal install image[]

There is no (easy) way to install Mandriva from an DVD image to a file using colinux. So I needed an emulator which had a gui, could use easily without doing to much work and where you could convert the file into colinux image. In the article Converting Distributions there is an example how to convert a qemu image to colinux image. For this reasons I use qemu to make an installation.


PREPARATION

  • Download Mandriva 2007 mini iso image from Mandriva and put in Distro folder (C:\Linux\Distro)
  • Download Qemu from most recent windows port here is official site
  • Extract qemu zipfile from windows port to c:\Linux\Qemu
  • Go to the command prompt (Windows XP => Start / Run / CMD)
  • make a image to install Mandriva 2007 (minimal 700MB) in dos by typing (2gb would be 1024*1024*1024*2 + 63*512)
fsutil file createnew c:\Linux\Distro\qemu_mandriva2007_min_2gb 2147515904
  • make a image for a 512mb swap file in dos by typing (512mb would be 1024*1024*512 + 63*512)
fsutil file createnew c:\Linux\Distro\qemu_swap_512mb 536903168
  • Open notepad, create next batchfile, change settings like qemu_dir and name of iso file and save it (C:\Linux\Qemu\start_installation.bat)
@ECHO OFF

set qemu_dir=C:\Linux\Distro
set hd=%qemu_dir%\qemu_mandriva2007_min_2gb
set swap=%qemu_dir%\qemu_swap_512mb
set cdrom=%qemu_dir%\mandriva-free-2007-mini.iso
set mem=256

qemu -hda %hd% -hdb %swap% -cdrom %cdrom% -m %mem% -boot d -L .
pause
  • start up start_installation.bat and install Mandriva 2007 with the second drive a swap drive


INSTALLATION With ctrl+tab you can get out the window.

  • when booting choose Install
  • Screen Installation => Language
Language choice
choose America -> English (American)
press next
  • Screen Installation => License
License agreement
choose Accept
press next
  • Screen Installation => Security
Security
Set Security level
Leave Security Administrator (login or email) empty
press next
  • Screen Installation -> Partitioning
Partitioning
choose Custom disk partitioning
press next
Select hda
press Create
Create a new partition
choose the following options:
Size in MB: 	slide to max (2047)
Filesystem type: 	Journalised FS: ext3
Mount point: 	/

Select hdb
press Create
choose the following options:
Size in MB: 	slide to max (511)
Filesystem type: 	Linux swap
Mount point: 	not available

press Done
Read carefully!
Partition table of drive hda is going to be written to disk!
Press Ok

Read carefully!
Partition table of drive hdb is going to be written to disk!
Press Ok
  • Screen Installation -> Installing
choose the following options:
Installation Mini (not available)
Copy whole CDs (leave empty)
press next
Package Group Selection
leave all boxes empty
press next
Type of install
[ ] With X
[ ] With basic documentation (recommended!)
[ ] Truly minimal install (especially no urpmi)
  • Screen Configuration -> Authentication
Authentication
Set administrator (root) password
press next
  • Screen Configuration -> Users
Add user
create the users you want and press "Accept user"
when you are done press "Next"
  • Screen Configuration -> Bootloader
 skips ???
  • Screen Configuration -> Summary
Summary
press next
  • Screen Configuration -> Updates
Updates
choose No
  • Screen Configuration -> Exit
Congratulations
press Reboot
  • close Qemu


CONVERTING TO COLINUX

I found this on one of the wikipages.

  • download and install unxutils I found a link here
  • go to the command prompt (Windows XP => Start / Run / CMD)
  • go to your distro folder
cd \Linux\Distro
  • convert qemu Mandriva 2007 image to colinux image
dd if=qemu_mandriva2007_min_2gb of=mandriva2007_min_2gb.img bs=512 skip=63
  • you only need the file mandriva2007_min_2gb.img the other 2 files (qemu_swap_512mb and qemu_mandriva2007_min_2gb) can be removed (you could also save it for temp backup)

install colinux and make image bootable[]

TO KNOW

I use an extra image disk which I use between different distributions as a second disk.

With Fedora Core 5 I had a problem with udev and hotplugin which gave problems with ssh etc. I solved it with the most recent version which is version 0.8.0 with kernel 2.6.17 and has Kernel with hotplug enabled (for udev). I am still using this version so I am not sure whether there are problems with other colinux versions.

There are at least 2 types of network connections: TAP connection and a bridged connection(WinPCap). I normally use tap but now will use them both to show examples. For more information look at Network

TAP driver creates an TAPconnection with an icon in Networkconnections. When you setup you networkcard using TAP connection goes through this TAP. This means you can only reach this connection from the host PC and not from another one. If you want to connect the internet using colinux you just make a shared connection from you internet connection (wlan or lan card) to the TAPconnection.

Bridged connection is a shared connection with the network card (lan or wlan). The colinux machine is visible from outside the host PC. Colinux will also have another IP adress as the host PC. It is like two machines using the same card are connection to the internet. Both machines will ask for an IP adress and for example the router will give both a different IP. I had a problem using my WLAN card with bridged because of a disabled option in an older kernel. With LAN it did work. Did not try it with the newer kernel.


INSTALLATION AND PREPARATION

When you have downloaded the newest version of colinux start installing it. I use normally the options Native Windows Linux Console, colinux Virtual Ethernet Driver (TAP-Win32) and colinux Bridged Ethernet (WinPCap). If you want to use WinPCap please install the winPcap driver. When asked for a folder I use C:\Linux\Colinux.

  • Create an extra image 1gb file by using the following command in the dosprompt (windows XP):
fsutil file createnew c:\Linux\Distro\ext3_disk_1gb.img 1073741824 
  • Create a swap image 512 mb because I will use 256 mb memory by using the following command in the dosprompt (windows XP):
fsutil file createnew c:\Linux\Distro\swap_512mb 536870912
  • Use noexecute to set the correct options. IF NOT DONE CORRECT PC WILL HANG AND YOU HAVE TO RESTART.
  • Go to Control Panel=>Network connections
  • Rename the LAN connection to LAN and the TAP connection to TAP.
  • right click on LAN connection and press properties
  • go to tab advanced, enable Allow other users to connect through this computer's internet connection and choose if applicable TAP
  • give the TAP connection a static IP 10.0.0.10 and subnetmask 255.255.255.0
  • Create a colinux.conf file in the Distro folder for example C:\Linux\Distro\colinux_mandriva2007_minimal.conf:
############################################
# MAKE SURE THERE IS AN EXTRA LINE AT THE END
# OF THE BATCH FILE
#
# initrd should only be used at first start
# to install kernel modules for example when
# you upgrade your colinux
############################################

############################################
# DEFAULT
############################################
# set your runlevel to text-only mode or graphical mode
# root=/dev/hda1 fastboot 1 (single-user mode)
# root=/dev/hda1 fastboot 3 (text-only mode)
# root=/dev/hda1 fastboot 5 (graphic mode)
############################################

kernel=vmlinux
initrd=initrd.gz
mem=256
root=/dev/hda1 fastboot 5

############################################
# Drives
############################################
#cobd0=C:\Linux\Distro\image
#hda1=:cobd0
############################################

hda1=\DosDevices\C:\Linux\Distro\mandriva2007_min_2gb.img
hda2=\DosDevices\C:\Linux\Distro\ext3_disk_1gb.img
hdb1=\DosDevices\C:\Linux\Distro\swap_512mb

############################################
# Ethernet
############################################
#eth0=slirp,00:ff:00:00:00:00
#eth0=pcap-bridge,"LAN", 00:ff:00:00:00:00
#eth0=tuntap,TAP,00:ff:00:00:00:00
############################################

eth0=tuntap,"TAP",00:ff:00:00:00:00
eth1=pcap-bridge,"LAN",00:ff:00:00:00:01
# please leave this as last line. Otherwise last of macadress goes as input for boot
  • Create a batch file in the colinux folder for example C:\Linux\Colinux\start_mandriva2007_minimal.bat:
@echo off
colinux-daemon.exe --install-driver
colinux-daemon.exe @"c:\Linux\Distro\colinux_mandriva2007_minimal.conf" -t nt
colinux-daemon.exe --remove-driver
pause
  • start the batchfile start_mandriva2007_minimal.bat so colinux starts(If it does not start it will give an error message. Maybe you typed something wrong).
  • login with your username and pass
  • format swap
mkswap -c -v1 -L SWAP /dev/hdb1
  • format extra image to ext3
mkfs -t ext3 /dev/hda2
  • edit /etc/fstab
# this is what I changed mine fstab to
/dev/hda1	/		ext3	defaults 	1 1
/dev/hda2	/mnt		ext3	defaults	1 1
/dev/hdb1	swap		swap	defaults	0 0
none /proc proc 			defaults 	0 0

NETWORKING

works same as Fedora

setup eth0

  • edit /etc/sysconfig/network-scripts/ifcfg-eth0
# File: /etc/sysconfig/network-script/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.0.0.100
NETMASK=255.255.255.0
GATEWAY=10.0.0.10
#HWADDR=00:ff:00:00:00:00
  • Now you can from windows ssh your colinux using 10.0.0.100

setup eth1

  • edit /etc/sysconfig/network-scripts/ifcfg-eth1 if it not exists make one
# File: /etc/sysconfig/network-script/ifcfg-eth1
DEVICE=eth1
ONBOOT=no
BOOTPROTO=dhcp
#HWADDR=00:ff:00:00:00:01

When you start colinux it will start the eth1 by using command ifup eth1 and will get an IP adress from the router where the LAN adapter gets his ip-adress. It will be a different IP-adress. With ifconfig eth1 you can find out the IP adress and ssh it from another pc.

DNS

  • to use a dns server edit /etc/resolv.conf
nameserver 10.0.0.10


Update with urpmi

first you have to get download locations

  • go to here and choose the following:
Step 1
Mandriva version:  2007 and architecture :  i586 and package manager :  urpmi 
Step 2
Select with correct mirror
Source contrib 
Source contrib_updates
Source main
Source main_updates
Step 3
type in console urpmi.removemedia -a
type everything which you see in step 3 to console
urpmi.addmedia main MIRRORLOCATION with media_info/hdlist.cz
urpmi.addmedia --update main_updates MIRRORLOCATION with media_info/hdlist.cz
urpmi.addmedia contrib MIRRORLOCATION with media_info/hdlist.cz
urpmi.addmedia --update contrib_updates MIRRORLOCATION with media_info/hdlist.cz
  • update existing installation
urpmi --update --auto-select

SSH[]

To install ssh do the following steps

  • type in console
urpmi openssh-server
  • to enable remote root login edit /etc/ssh/sshd_config

before PermitRootLogin no after PermitRootLogin yes

  • restart sshd
service sshd restart


making it colinux proof[]

When booting you get some failures. (almost same as Fedora)

error: perl: warning: Setting locale failed.

  • you get this error when using urpmi

when starting up you get the error

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
  • solve both errors by using the command: (where en stands for english, change if needed)
urpmi locales-en

error: hwclock is unable to get I/O port access: the iopl(3) call failed.

  • coLinux don't allow hwclock. Edit file /etc/rc.d/rc.sysinit, locate the line with hwclock and add a condition for colinux:

before

if [ "$ARCH" = "alpha" -a -f /lib/modules/$(uname -r)/modules.dep ];then
 	[-x /sbin/hwclock ] && /sbin/hwclock $CLOCKFLAGS
elif [ "$ARCH" != "alpha"]; then
 	/sbin/hwclock $CLOCKFLAGS
fi

after

if ! uname -r | grep -q -e "-co-"
then
 	if [ "$ARCH" = "alpha" -a -f /lib/modules/$(uname -r)/modules.dep ];then
 	 	[-x /sbin/hwclock ] && /sbin/hwclock $CLOCKFLAGS
 	elif [ "$ARCH" != "alpha"]; then
 	 	/sbin/hwclock $CLOCKFLAGS
  	fi
fi
  • Edit file /etc/rc.d/init.d/halt, locate the line with hwclock and write a condition for colinux:

before

[-x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS

after

if ! uname -r | grep -q -e "-co-"
then
	[-x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
fi

error: Setting default font (lat0-16): set_kernel_font: Function not implemented

  • Rename the program /bin/unicode_start to /bin/unicode_start.old
mv /bin/unicode_start /bin/unicode_start.old
  • Create a new script file /bin/unicode_start with condition for coLinux
#!/bin/bash

if ! uname -r | grep -q -e "-co-"
then
	/bin/unicode_start.old $@
fi
  • and make it executable
chmod +x /bin/unicode_start

compress image file smallest possible[]

Ok after you've done all this you could start to make a rar file so you can if you do something wrong just unpack the rar file and you start all over. (found at the mail list). It can become big because the empty space is not really zero so your compressor makes the file big. What you do is you make a file which has null characters that is as big as the empty space and remove the file

  • start with another image file and set the image you want to compress in the xml conf file in this example hda2
  • mount the image into /mnt
mount /mnt /dev/hda2
  • remove colinux modules
rm -rf /mnt/lib/modules/*-co-*
  • remove wtmp
rm -f /mnt/var/log/wtmp
  • remove all from tmp
rm -rf /mnt/tmp/*
  • clean /mnt/root/.bash_history
  • get the number of available space in mb
chroot /mnt
df -m
 #Filesystem	1M-blocks	Used	Available	Use%	Mounted on
 #/dev/hda2	1984		750	1132M		40%	/mnt
exit
  • make a file filled with zero which is almost as big as the empty space in hda2. For count do the available size of hda2 minus 2
dd if=/dev/zero of=/mnt/foobar bs=1M count=1130
  • remove the zero file
rm /mnt/foobar
  • Unmount the image from /mnt
umount /mnt
  • change mountcount etc
tune2fs -c 0 /dev/hda2
tune2fs -T 20070101 /dev/hda2

If you compress it now, it will become much smaller.


XDMCP (external Xwindows) login[]

For the XDMCP client I use XMING and for Desktop Environment I use KDE. (but you can use your own like winx-32 x-deep32 and GNOME).

If you enable XDMCP in a normal linux environment when you start your xdm server it automatically starts the gui. But in colinux it is not possible to do this.

Another usefull link

  • startup eth1 or have eth0 in shared mode
ifup eth1
  • get xwindows
    • get minimal kde
urpmi kdebase

I choose the following options

1- aspell-en-6.0.0-2mdk.i586 : English files for aspell (to install)
1- mandriva-theme-1.1.5-1mdv2007.0.noarch : The default Mandriva Linux them for bootsplash and desktop background (to install)
5- mandriva-theme-screensaver-1.1.5-1mdv2007.0.noarch : Mandriva default screensaver (to install)
2- free-kde-config-2007-28mdv2007.0.noarch : Mandriva KDE configuration (to install)
    • install kdm
urpmi kdebase-kdm
  • while you just installed kdmrc it has errors, so we will create a new one
/usr/bin/genkdmconf
  • copy Xacces file to kdm directory
cp /etc/X11/xdm/Xaccess /usr/share/config/kdm/
  • edit in /usr/share/config/kdm/kdmrc

before

[Xdmcp]
Enable=false
#Port=177

after

[Xdmcp]
Enable=true
Port=177
  • comment out in /etc/X11/xdm/xdm-config

before

DisplayManager.requestPort: 0

after

! DisplayManager.requestPort: 0
  • edit for external login (every pc) in /usr/share/config/kdm/Xaccess

before

#*		# any host can get a login window

after

*		# any host can get a login window
  • edit for internal login (host pc) in /usr/share/config/kdm/Xaccess

before

#*		# any host can get a login window

after (to make only the host PC be able to get XDMCP connection)

10.0.0.10	# any host can get a login window

after (to make any PC able to get XDMCP connection eth1 with winPCap should be enabled)

*		# any host can get a login window
  • comment out in /etc/X11/xdm/Xservers (to make it not start xwindows for local machine)

before

:0 local /usr/bin/X -deferglyphs 16
:1 local reserve /usr/bin/X :1 vt8 -deferglyphs 16
:2 local reserve /usr/bin/X :2 vt9 -deferglyphs 16
:3 local reserve /usr/bin/X :3 vt10 -deferglyphs 16
:4 local reserve /usr/bin/X :4 vt11 -deferglyphs 16
:5 local reserve /usr/bin/X :5 vt12 -deferglyphs 16

after

#:0 local /usr/bin/X -deferglyphs 16
#:1 local reserve /usr/bin/X :1 vt8 -deferglyphs 16
#:2 local reserve /usr/bin/X :2 vt9 -deferglyphs 16
#:3 local reserve /usr/bin/X :3 vt10 -deferglyphs 16
#:4 local reserve /usr/bin/X :4 vt11 -deferglyphs 16
#:5 local reserve /usr/bin/X :5 vt12 -deferglyphs 16
  • comment out in /usr/share/config/kdm/kdmrc (to make it not start xwindows for local machine)

before

StaticServers=:0

after

#StaticServers=:0
  • restart xwindows
service dm restart
  • create an xlaunch file by
    • starting xlaunch and choosing the options below and at the last screen choose save configuration
Display Settings	One window
Display number 	0
Start Xming		Open Session via XDMCP
Connect to host	10.0.0.100 (or if you are connection from the outside the IP adress from eth1 using winPCap)
Clipboard		enabled
    • or create file xming.xlaunch on windows host
<?xml version="1.0"?>
<XLaunch 
	xmlns="http://www.straightrunning.com/XmingNotes" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
	xsi:schemaLocation="http://www.straightrunning.com/XmingNotes xlaunch.xsd" 
	WindowMode="Windowed" 
	ClientMode="XDMCP"
	XDMCPHost="10.0.0.100"
	Display="0" 
	Clipboard="true" />
  • doublepress xming.xlaunch to start xming and voila you have your xwindows
Advertisement