Gerard Braad

F/OSS & IT Consultant on Openness and Interoperability

You can follow more frequent updates via my Identi.ca profile (feed).

Tuesday, March 31, 2009

Using Mono 2.4 on coLinux to ease .NET development

Currently I deal a lot with .NET development in my daily work. Most of the development is done on Windows. When you need to develop cross-platform .NET you would like to use Mono. Mono is binary compatible with .NET and allows .NET applications to run on Linux distributions. If you would develop from Visual Studio you want to easily test the binary directly in a mono session on Linux!

To test software both platforms in a convenient way mostly virtualization is chosen. Of course you can use VMware or VirtualBox when you use Windows, but you can also use coLinux. coLinux is a port of the Linux kernel that allows it to run cooperatively alongside another operating system on a single machine. My choice of distribution to use on top of coLinux is the open version of SUSE, both supported by Novell.

This description does expect you to have understanding of a Linux environment and administrative rights on your Windows system.

Installation (Windows side)
First of all you would need to coLinux installer. This file is available from the coLinux website. The downloads section will point you to the latest stable, as of writing v0.7.3. On the website of Henry Nestler you can also find development and daily builds for 0.8.0. This installation is pretty straightforward, just keep the default settings. When the installer asks you 'Hardware installation' you need to press 'Continue anyways', this will allow the TAP network driver to be installed.

To use a desktop environment from coLinux you need to install a X server. The more difficult way would be to use Cygwin/X... this way you will have a complete GNU system running on top of Windows to provide a Linux-like experience. The fastest and easy way is to use a tool like Xming. The installer you need is the Xming or Xming-portablePuTTY (Mesa is not needed). Also, this installation is quite straightforward. After the installation start the X server from the start menu (Programs → Xming → Xming).

In the posting 'openSUSE 11.1 on coLinux' I described a way to make a base installation of openSUSE for use with the coLinux environment. The file 'colinux-opensuse-111.exe' (113Mb) [VIPeers] [dropbox] contains all you need to run the openSUSE environment. As you can see from the size, it contains only a base system. After you have extracted the file, you will still need to perform some additional installations to make the Mono development work.

Before you start the Mono installation inside the coLinux environment, you need to reserve a directory for your development files or some other shared directory. I choose to use 'D:\Development'. In the run.txt file in the openSUSE directory, you can add a line which says:

cofs1="D:\Development"

This will later be mounted inside the Linux environment.

Installation (Linux side)
Now you can start the environment from the 'runonce.bat'. This one time start is needed to finalize the installation (describe in the 'openSUSE on coLinux' posting as the post-install). You will see something similar to:

openSUSE 11.1 started on coLinux 0.7.3

Logon using the credentials: 'root' and the password 'password'. Immediately change the password using


passwd


Enable the network using the command:


for i in 0 1
do
cat > /etc/sysconfig/network/ifcfg-eth$i << END BOOTPROTO='dhcp' STARTMODE='auto' USERCONTROL='no' END done


Add a mount point to your shared directory


mkdir /media/Development
vi /etc/fstab


and add the following line to this file


cofs1 /media/Development cofs defaults 0 0



To enable the shared directory you need to mount it


mount /media/Development



You can now shutdown...


shutdown -hn now



... the system will halt and closes the console. From now on you are able to start the environment using the normal 'run.bat'. Do so and log on using your new password.

Your network should now use eth0 as a serial line and eth1 as a bridged network using the device called 'Local Area Connection'. If your Windows network device is called differently, please change it in the 'run.txt' file. IP addresses are assigned using DHCP. The device eth0 will probably be assigned the address 10.0.2.15/24. For device eth1 this will depend on your local network settings. I will just assume that eth1 is configured and provides the Internet connection.

To allow packages to be installed you would need to add the standard repositories to this installation.


zypper ar http://download.opensuse.org/distribution/11.1/repo/oss/ openSUSE111
zypper ar http://download.opensuse.org/distribution/11.1/repo/non-oss/ openSUSE111_NonOSS
zypper ar http://download.opensuse.org/update/11.1/ openSUSE-11.1-Updates



Enabling the User Interface
You can use a full-blown desktop environment as GNOME, but since coLinux does not provide a framebuffer device it is not advisable at the moment. We will use the Xming as the X server for our desktop. The X protocol is a client/server model for user interfaces. To keep the installation small, we use a very lightweight Desktop Environment on top of X, namely LXDE.

Install the LXDE packages using:


OCICLI http://download.opensuse.org/repositories/home:/swyear/openSUSE_11.1/LXDE-desktop.ymp


This will start the One-Click-Install. You will need to agree to some questions and lean back... this might take some time.

If this finished, you can test if the installation finished correctly. You will need to set the DISPLAY parameter to specify where the X server is running. Now let's start the appearance settings...


export DISPLAY=10.0.2.2:0.0
lxappearance


and choose a theme that suits your current Windows theme.

LX Appearance

This means your desktop environment works.

If you would receive a 'Gtk-WARNING **: cannot open display:' this means your connection might be blocked for some reason. Check your settings or disable a firewall/virus scanner.

Mono installation
Mono will provide a Linux/Unix system with support to run .NET applications. Originally this description was written to use Mono 2.2 which was provided from the openSUSE repository. To install these packages issue a simple


zypper in -t pattern devel_mono


would be sufficient to install a development environment. To start the Monodevelop you can start this using the command:


export DISPLAY=10.0.2.2:0.0
monodevelop &



Monodevelop

Since the 30th of March a newer release of Mono (v2.4) is available. To install you will need to specify the mono repository and upgrade the previous installation.


zypper addrepo http://ftp.novell.com/pub/mono/download-stable/openSUSE_11.1 mono-stable
zypper refresh --repo mono-stable
zypper dist-upgrade --repo mono-stable



You can now start Monodevelop 2.0 and use managed debugging!

That's it for now... In later posts I will automate the startup and show how to do development using this environment.
Have a lot of fun...

Notes
If you think VMware provides a better solution you can make use of the files that the Mono Project provide in their download section. Either download the generated VMware image of the LiveCD.

If you want to use GNOME as your desktop environment you are advised to remove the gnome-screensaver package and it's dependent, since it can cause issues during use. If you want to experiment with the LXDE environment, you are advised to use the lxpanel and pcmanfm. In a later post these will be explained in more detail.

Friday, March 20, 2009

openSUSE 11.1 on coLinux

To ease cross-platform .NET development, I have installed openSUSE on coLinux. This allows me to develop from Windows and also test and debug the binary on Linux. Advantages are: No need to dual boot and a much better performance than using VMware or other virtualization solution. In this article you can find the base system and I will describe how I did the base installation.

Take note, these instructions do NOT provide any details about the .NET environment. Those are published on my .NET blog.

Monodevelop

The files to install and run the environment 'colinux-opensuse-11.1.exe' can be found at [VIPeers], [dropbox] (113Mb). This file contains the base system.img, a swap image and start commands. If you don't want to install it yourself, you can at least immediately start to use openSUSE on coLinux. Take note, network has not been configured yet (see notes). The user account is 'root' with the password 'password'.

Preparation
The installation closely follows the instructions I wrote for CentOS. You will need a clean system.img which you can find in the colinux-centos52-base.rar. Copy the Debian businnesscard init ramdisk to install_initrd.gz. And of course you need to download the openSUSE 11.1 DVD from http://www.opensuse.org/. This file will be about 4.25GB in size.

You can perform a RPM installation, but since openSUSE provides an image-based installation I will use this for the base of the coLinux environment. My main purpose was to keep the installation easy to perform (and if possible small in size). Copy the files base-i386.tar.lzma, base-meta-i386.tar.lzma and common-base-i386.tar.lzma from the openSUSE 11.1 DVD. It is located in the directory images. Since the Debian initrd does not contain the lzma binary, so you will need to decompress the archives with a tool like 7-Zip. The resulting files will be standard tape-archives. Place them in a directory called 'images'. The install.bat will map it to cofs1.

Installation
If you have the install files from the opensuse-11.1.exe file, the images, debian's install_initrd.gz and the system.img from the centos52-base.rar, you are ready to go.

Start the install.bat. You will see a debian installation screen... toggle with ALT-F2 to a console and press Enter.

Please press Enter to activate this console.

Please press Enter to activate this console. BusyBox v1.10.2 (Debian 1:1.10.2-2) built-in shell (ash) Enter 'help' for a list of built-in commands.

From here you can perform the following commands. The line which says 'tar -C /mnt/linux -xf $i' will unpack the image to the system.img. Just be sure to have some coffee ready since it might take some time.


mkswap /dev/cobd7
swapon /dev/cobd7

mkdir /mnt/linux
mkdir /mnt/win
mount /dev/cobd0 /mnt/linux
mount -t cofs cofs0 /mnt/win

mkdir /mnt/images
mount -t cofs cofs1 /mnt/images
cd /mnt/images

for i in *.tar
do
tar -C /mnt/linux -xf $i
done

mkdir -p /mnt/linux/media/cdrom
mount /dev/cobd1 /mnt/linux/media/cdrom

chroot /mnt/linux
cd /media/cdrom/suse/i586

rpm -ivh openSUSE-release-[0-9]*.rpm \
openSUSE-release-dvd-[0-9]*.rpm

echo password | passwd - stdin root

cat > /etc/fstab << END
/dev/cobd0 / ext3 acl,user_xattr 1 1
/dev/cobd7 swap swap defaults 0 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
END

exit


After this you can halt the system. And start it for the first time.

Post-install
To finish the installation you need to start it with the coLinux initrd once. The script runonce.bat will take care of that... after you have run it, openSUSE will start properly. Log on and halt again. After this you can start it without a initrd being specified. The script run.bat will start the final system.

openSUSE 11.1 started on coLinux 0.7.3

It might give some startup errors... nothing serious. I didn't configure the network inside the base system. This can be done using yast or perform the following command:


for i in 0 1
do
cat > /etc/sysconfig/network/ifcfg-eth$i << END
BOOTPROTO='dhcp'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME=''
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
END
done


This enables both eth0 and eth1 to use DHCP. Kernel modules can be installed with the same RPM I have provided earlier. Just use the following commands:


zypper in http://gbraad.fedorapeople.org/files/kernel-modules-2.6-co0.7.3.i386.rpm


Alternative installation
If you want to perform a RPM-based installation you will still need to install the base-i386.tar image. I tried without, but ended up with a lot of errors during installation. The can find the installation instructions in the file instructions-rpm.txt which is included in the archive. Eventually I have not further tested this alternative installation...

Notes
I have tried to only use the files provided by openSUSE, but somehow they seem to consume too much time. The common filesystem did not provide all the tools I needed (similar to the stage2.img from redhat). If you know another way to install it, let me know. Qemu can also install it, but it consumes a lot more time in my opinion; install, dd, etc.

For the moment it is not possible to perform an image installation without the openSUSE DVD installation media. I do hope they will provide a single CD image installer or provide the images from their 11.1 download site. If it is possible, please enlighten me?!

If you want to install additional software, you will need to add the openSUSE repositories. This can easily be done using zypper.


zypper ar http://download.opensuse.org/distribution/11.1/repo/oss/ openSUSE111
zypper ar http://download.opensuse.org/distribution/11.1/repo/non-oss/ openSUSE111_NonOSS
zypper ar http://download.opensuse.org/update/11.1/ openSUSE-11.1-Updates


Now you can install Gnome by using a command like:


zypper in -t pattern gnome


More information about installing software can be found on openSUSE Tutorials.

Have a lot of fun...

Monday, March 16, 2009

Manually installing CentOS 5.2 on coLinux

In the previous post I published a minimal CentOS 5.2 environment for use with coLinux. As I described in the posting, I did a manual installation since I was unable to use Qemu to start the CentOS 5.2 installation process. Although I received a comment that someone else was able to install CentOS, I am still unable to do so... even with the latest build of Qemu (currently 0.9.1) on Windows. Instead of trying to convert a VMware image or using an update process, I wanted to only use coLinux. In this posting I will try to describe what I did.

Requirements
To ease the installation I have created a base which can assist you with installing. It contains the files you need as images (formatted as Ext3). It is available as centos52-base.rar [dropbox] (35kb).

This file contains what is needed to install the CentOS 5.2 image for
use with coLinux:

  • system.img 4Gb system image, formatted as Ext3

  • swap512m.img 512Mb swap location

  • Batch and parameters file needed to start coLinux

    install.bat, install.txt for the installation process (needed once)

    run.bat, run.txt to start the environment after install

  • instructions.txt file containing the commands to perform


Extract the base archive and place the CentOS 5.2 (i386) installation media in the same directory. Mirrors are provided on the download page of CentOS. If you do not want to download the DVD file, you can also choose to only download CD 1of6. For this you need to change the install.txt parameters file. After the initial install, you can then rely on YUM to install all additional packages.

I used a custom init ramdisk to create the images and perform the installation. Since this file is still rough, I suggest you to download this business card iso from debian. The businesscard ISO is about 35Mb.

With a tool like winrar (or mount it using a tool like Daemon Tools), you can extract the file /install.386/initrd.gz. If you prefer to only download the initrd.gz. Save this file as install_initrd.gz in the directory where you extracted this base directory. This ramdisk will be used to start a system to perform commands from which will start the RPM install.

Please choose the language used for the installation process. This language will be the default language for the final system. Choose a language: C - No localization English - English

After installing coLinux to the standard location you can run the install.bat and start the installation process. It will start the start kernel with the install_initrd.gz as ramdisk. The terminal of choice for this process was a NT terminal, since copy-n-paste was easier to perform. When the installation process interface is shown, you should toggle with ALT+F2 to a console.

Please press Enter to activate this console.

Please press Enter to activate this console. BusyBox v1.10.2 (Debian 1:1.10.2-2) built-in shell (ash) Enter 'help' for a list of built-in commands.

When you do so, you will see a BusyBox prompt where you can perform the instructions as shown in the instructions.txt.

Instructions
You will now perform the instructions needed to do the actual install. We will create a basic environment to perform an RPM installation of the base packages. After this you can use YUM to download and/or install additional packages. To create
the basic layout:

mkswap /dev/cobd7
swapon /dev/cobd7
mkdir /mnt/linux
mkdir /mnt/win
mkdir /mnt/stage2
mount /dev/cobd0 /mnt/linux
mkdir -p /mnt/linux/media/cdrom
mount -t cofs cofs0 /mnt/win
mount /dev/cobd1 /mnt/linux/media/cdrom

This will create some swapspace, a mountpoint /mnt/linux which points to the block device cobd0 (system.img), /mnt/win will be used to point to the coLinux program files folder and /mnt/stage2 will later be used to mount the CentOS stage2 image file. Block device cobd1 is used to mount the DVD image to the mountpoint /mnt/linux/media/cdrom. This will later be used to install the base packages from.

The stage2 image file uses the squashfs filesystem. CoLinux provides kernel modules to use this filesystem.

tar xzvf /mnt/win/vmlinux-modules.tar.gz lib/modules/2.6.22.18-co-0.7.3/kernel/fs/squashfs/squashfs.ko
insmod /lib/modules/2.6.22.18-co-0.7.3/kernel/fs/squashfs/squashfs.ko
mount -t squashfs -o loop /mnt/linux/media/cdrom/images/stage2.img /mnt/stage2

The contents then need to be copied to the /mnt/linux to form the basis of our installation process.

cp -a /mnt/stage2/ /mnt/linux
umount /mnt/stage2
mv /mnt/linux/stage2 /mnt/linux/base

This might take some time...

The system needs to have some directories which will form the basis. The following command will create this.

for n in bin dev proc lib usr tmp etc
do
mkdir -p /mnt/linux/$n
done
touch /mnt/linux/etc/fstab /mnt/linux/etc/mtab
mkdir -p /mnt/linux/var/lib/rpm

The location /var/lib/rpm is needed to store the RPM database files.

Pre-installation
RPM will need some libraries to run. These will be copied to the appropriate location using the following commands:

cd /mnt/linux/lib
ln -s ../base/lib/* .
rm /mnt/linux/lib/udev
rm /mnt/linux/lib/bdevid
mkdir /mnt/linux/usr/lib
cp -a /mnt/linux/base/usr/lib/librpm-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/librpmio-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/librpmdb-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libpopt.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libsqlite3.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libelf* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libbeecrypt.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libz.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libbz2.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libstdc++.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/rpm /mnt/linux/usr/lib/

All necessary libraries are now available to pivot the root to the /mnt/linux location.

chroot /mnt/linux /base/usr/bin/sh
/base/usr/bin/rpm --initdb

This will create a fresh RPM database which the installation process can use.

Installation
You are now ready to perform the installation.

cd /media/cdrom/CentOS
/base/usr/bin/rpm -ivh setup-*.rpm

The following packages need to be installed at once. These will form a base installation of CentOS.

/base/usr/bin/rpm -ivh \
audit-libs-[0-9]*.rpm \
audit-libs-python-[0-9]*.rpm \
authconfig-[0-9]*.rpm \
basesystem-[0-9]*.rpm \
bash-[0-9]*.rpm \
beecrypt-[0-9]*.rpm \
bzip2-libs-[0-9]*.rpm \
centos-release-[0-9]*.rpm \
centos-release-notes-[0-9]*.rpm \
checkpolicy-[0-9]*.rpm \
chkconfig-[0-9]*.rpm \
coreutils-[0-9]*.rpm \
cpio-[0-9]*.rpm \
cracklib-[0-9]*.rpm \
cracklib-dicts-[0-9]*.rpm \
cryptsetup-luks-[0-9]*.rpm \
cyrus-sasl-lib-[0-9]*.rpm \
db4-[0-9]*.rpm \
dbus-[0-9]*.rpm \
dbus-glib-[0-9]*.rpm \
device-mapper-[0-9]*.rpm \
device-mapper-event-[0-9]*.rpm \
device-mapper-multipath-[0-9]*.rpm \
dhclient-[0-9]*.rpm \
dhcpv6-client-[0-9]*.rpm \
diffutils-[0-9]*.rpm \
dmidecode-[0-9]*.rpm \
dmraid-[0-9]*.rpm \
e2fsprogs-[0-9]*.rpm \
e2fsprogs-libs-[0-9]*.rpm \
ecryptfs-utils-[0-9]*.rpm \
ed-[0-9]*.rpm \
elfutils-libelf-[0-9]*.rpm \
ethtool-[0-9]*.rpm \
expat-[0-9]*.rpm \
file-[0-9]*.rpm \
filesystem-[0-9]*.rpm \
findutils-[0-9]*.rpm \
gawk-[0-9]*.rpm \
gdbm-[0-9]*.rpm \
glib2-[0-9]*.rpm \
glibc-[0-9]*.i686.rpm \
glibc-common-[0-9]*.rpm \
gnu-efi-[0-9]*.rpm \
grep-[0-9]*.rpm \
grub-[0-9]*.rpm \
gzip-[0-9]*.rpm \
hal-[0-9]*.rpm \
hdparm-[0-9]*.rpm \
hwdata-[0-9]*.rpm \
info-[0-9]*.rpm \
initscripts-[0-9]*.rpm \
iproute-[0-9]*.rpm \
iptables-[0-9]*.rpm \
iptables-ipv6-[0-9]*.rpm \
iputils-[0-9]*.rpm \
kbd-[0-9]*.rpm \
kernel-[0-9]*.rpm \
keyutils-libs-[0-9]*.rpm \
kpartx-[0-9]*.rpm \
krb5-libs-[0-9]*.rpm \
kudzu-[0-9]*.rpm \
less-[0-9]*.rpm \
libacl-[0-9]*.rpm \
libattr-[0-9]*.rpm \
libcap-[0-9]*.rpm \
libgcc-[0-9]*.rpm \
libgcrypt-[0-9]*.rpm \
libgpg-error-[0-9]*.rpm \
libhugetlbfs-[0-9]*.rpm \
libselinux-[0-9]*.rpm \
libselinux-python-[0-9]*.rpm \
libsemanage-[0-9]*.rpm \
libsepol-[0-9]*.rpm \
libstdc++-[0-9]*.rpm \
libsysfs-[0-9]*.rpm \
libtermcap-[0-9]*.rpm \
libusb-[0-9]*.rpm \
libuser-[0-9]*.rpm \
libvolume_id-[0-9]*.rpm \
libxml2-[0-9]*.rpm \
libxml2-python-[0-9]*.rpm \
lvm2-[0-9]*.rpm \
m2crypto-[0-9]*.rpm \
MAKEDEV-[0-9]*.rpm \
mcstrans-[0-9]*.rpm \
mingetty-[0-9]*.rpm \
mkinitrd-[0-9]*.rpm \
mktemp-[0-9]*.rpm \
module-init-tools-[0-9]*.rpm \
nash-[0-9]*.rpm \
ncurses-[0-9]*.rpm \
net-tools-[0-9]*.rpm \
newt-[0-9]*.rpm \
nspr-[0-9]*.rpm \
nss-[0-9]*.rpm \
openldap-[0-9]*.rpm \
openssh-[0-9]*.rpm \
openssh-clients-[0-9]*.rpm \
openssh-server-[0-9]*.rpm \
openssl-[0-9]*.i686.rpm \
pam-[0-9]*.rpm \
passwd-[0-9]*.rpm \
pciutils-[0-9]*.rpm \
pcre-[0-9]*.rpm \
pm-utils-[0-9]*.rpm \
policycoreutils-[0-9]*.rpm \
popt-[0-9]*.rpm \
prelink-[0-9]*.rpm \
procps-[0-9]*.rpm \
psmisc-[0-9]*.rpm \
python-[0-9]*.rpm \
python-elementtree-[0-9]*.rpm \
python-iniparse-[0-9]*.rpm \
python-sqlite-[0-9]*.rpm \
python-urlgrabber-[0-9]*.rpm \
readline-[0-9]*.rpm \
redhat-logos-[0-9]*.rpm \
rhpl-[0-9]*.rpm \
rootfiles-[0-9]*.rpm \
rpm-[0-9]*.rpm \
rpm-libs-[0-9]*.rpm \
rpm-python-[0-9]*.rpm \
sed-[0-9]*.rpm \
selinux-policy-[0-9]*.rpm \
selinux-policy-targeted-[0-9]*.rpm \
setools-[0-9]*.rpm \
setserial-[0-9]*.rpm \
shadow-utils-[0-9]*.rpm \
slang-[0-9]*.rpm \
sqlite-[0-9]*.rpm \
sysfsutils-[0-9]*.rpm \
sysklogd-[0-9]*.rpm \
system-config-securitylevel-tui-[0-9]*.rpm \
SysVinit-[0-9]*.rpm \
tar-[0-9]*.rpm \
tcl-[0-9]*.rpm \
tcp_wrappers-[0-9]*.rpm \
termcap-[0-9]*.rpm \
tzdata-[0-9]*.rpm \
udev-[0-9]*.rpm \
udftools-[0-9]*.rpm \
usermode-[0-9]*.rpm \
util-linux-[0-9]*.rpm \
vim-minimal-[0-9]*.rpm \
wireless-tools-[0-9]*.rpm \
yum-[0-9]*.rpm \
yum-metadata-parser-[0-9]*.rpm \
zlib-[0-9]*.rpm

If you perform the command, the following will show indicating that the installation process started.
RPM installation process
This will again take some time... and will eventually result in the following.

If no error occurred you can start with the post-installation to make the system usable from coLinux.

Post-installation
We will now perform some post-installation commands to finish the installation. Create the device nodes in the device directory. These will be used by the filesystem table to mount the filesystem. Do not forget to first exit out of the chroot environment.

exit
mknod -m 666 /mnt/linux/dev/null c 1 3
for i in 0 1 2 3 4 5 6 7 8 9 10
do
mknod -m 660 /mnt/linux/dev/cobd${i} b 117 ${i}
done
chown 0:6 /mnt/linux/dev/cobd*

To have the filesystems mounted on startup you need to have the fstab file being created. Just overwrite the current file:

cat > /mnt/linux/etc/fstab << END
/dev/cobd0 / ext3 defaults 1 1
/dev/cobd7 swap swap defaults 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /sys sysfs defaults 0 0
END

Write some basic information to the hosts file.

cat > /mnt/linux/etc/hosts << END
127.0.0.1 localhost localhost.localdomain
END

The following will create the shared memory and the pseudo terminal devices, turns off the hardware daemon and allows you to give an initial password for the root user.

chroot /mnt/linux /sbin/MAKEDEV con
chroot /mnt/linux /bin/bash -c "/bin/mkdir /dev/{shm,pts}"
chroot /mnt/linux /bin/bash -c "/bin/chmod a+rwxt /dev/shm"
chroot /mnt/linux /sbin/MAKEDEV generic
chroot /mnt/linux /sbin/chkconfig haldaemon off
chroot /mnt/linux /usr/sbin/authconfig --enableshadow --update
chroot /mnt/linux /usr/bin/passwd root

To have the network start, you need to create the following files. This way your system will be configured with a basic hostname and two network devices using DHCP.

cat > /mnt/linux/etc/sysconfig/network << END
NETWORKING=yes
HOSTNAME=localhost.localdomain
END


cat > /mnt/linux/etc/sysconfig/network-scripts/ifcfg-eth0 << END
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
END


cat > /mnt/linux/etc/sysconfig/network-scripts/ifcfg-eth0 << END
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
END

Cleanup
You can now remove the base directory we had copied from the stage2 image.

rm -rf /mnt/linux/base
halt

After this you can halt the system and start the environment using the run.bat file. If everything went well your system would look like this!

During startup you will notice some minor error which are related to the kernel dependencies file being missing. To solve this, you can extract the kernel modules using the /dev/cofs0 mapping. Although I prefer to use RPMs, since they are easier to cleanup and upgrade when needed.

yum install wget
wget http://gbraad.fedorapeople.org/files/kernel-modules-2.6-co0.7.3.i386.rpm
rpm -ivh kernel-modules-2.6-co0.7.3.i386.rpm

Enjoy using it... If you have suggestions or stories about your use, leave a comment or send me an email.

Friday, March 13, 2009

CentOS 5.2 image for coLinux

Although soon we hope to have the newer 5.3 release of CentOS, I still decided to create a coLinux image of the current release. The problem with this release is that the kernel has issues when run on Qemu as can be seen in this bug report. This issues is known upstream and is solvable by installing 5.1 and then update it beyond the problematic kernel... or you could just wait until CentOS 5.3 is released.

To make CentOS 5.2 usable in coLinux you could install 5.1 in this way using Qemu and update it. I just took a different approach: use RPM. I used a modified initrd image and installed a basic RPM installation (kinda similar to the FC3-CentOS frankenupgrade). More details about how the installation was performed will follow.



For now you can find the files here:
colinux-centos52.exe [VIPeers] [dropbox] (82mb)

The files contain an image with a minimal installation which you can use on coLinux 0.7.3. The startup is not error-free... but you can ignore the failures for now, since I will update the images to reflect the Fedora images. Your suggestions are of course welcome.

It is configured to use DHCP on the network connections eth0 and eth1. The user account is 'root' without a password.

Edit: repacked the archive to be self-extracting and kernel modules (co0.7.3) have been installed by RPM.

Followers