Recently I switched all my machines from running gentoo to archlinux. Last gentoo-based machine for some time has been my http://www.xencon.net hosted vserver which runs this website and my mailserver. Unfortunalety xencon doesn't provide preconfigured archlinux images like they do for gentoo, ubuntu, debian and others. But since they have an excellent service and therefore I wanted to stay with them as my hosting provider, I decided to take the hard route and install archlinux via the provided rescue system. In the following article I will outline how I did this.
Step zero: Warning and prerequisites
WARNING: THIS MEHTOD WILL DELETE ALL DATA AND THE SYSTEM CURRENTLY ON YOUR VSERVER! MAKE SURE YOU HAVE BACKUPS OF ANYTHING IMPORTANT. ALSO CONSIDER THAT THIS METHOD MAY RESULT IN A LONGER DOWNTIME AS YOU WILL HAVE TO RESTORE THE SYSTEM FROM SCRATCH IF SOMETHING FAILS! ANYTHING I DESCRIBE HERE WORKED FOR ME. I WON'T TAKE ANY RESPONSIBILITY IF IT WON'T WORK FOR YOU OR RESULT IN DATA LOSS OR OTHER PROBLEMS.
This Article is not meant to be a complete step by step guide for installing arch on a xencon vserver. Rather it outlines the steps I have taken and describes problems and workarounds I used to get archlinux running on my xencon vserver. It is required that you have an understanding of archlinux, chroots, manual partitioning and so on. Make sure to fully understand what the steps described here do before trying anything of it on your own vserver.
Everything is based on a x|entry server running the xencon provided gentoo image
Step one: getting an image ready
The first thing to do is to create an image of the arch system that you can copy over to the vserver and install it there. I did essentially create a chroot using the arch devtools-provided mkarchroot. I won't go into more detail here since http://wiki.archlinux.org has guides on how to do this. After installing it and chrooting into the new system I deleted some stuff that I won't need like kernel26 and mkinitcpio, grub, unneeded filesystem utils (using ext3 I only left e2fsprogs), ppp, rp-pppoe, pcmciautils and wpa_supplicant.
Next I did edit fstab to reflect the planned partition setup on the vserver (note that the xen-kernel provided by xencon exposes the partitions as /dev/hdaX) I also setup the usual system files like in the arch installation (rc.conf, hosts, hosts.allow and so on). Pay special attention to the network setup here, and make sure to setup eth0 and eth1 for dhcp to have working internal and external interfaces. I also did add '-h <hostname>' to the dhcpcd options in /etc/conf.d/dhcpcd
After this I installed and set up sshd so I could ssh into the system later. Lastly I set the root-password and exited the chroot. After that I tar'ed up the chroot (make sure to use the -p switch for tar to preserve file permissions and ownership)
Step Two: Partitioning and Installing
MAKE SURE YOU HAVE BACKUPS OF ALL IMPORTANT STUFF BEFORE THIS, THE NEXT STEP WILL DELETE ALL YOUR DATA ON THE VSERVER!
Next thing I did is to switch the vserver into the Rescue System. This can be done from the my.xencon.net menu. Xencon will send you an email with details on how to connect to the rescue system. First thing I did on the system was to partiton the virtual drive using cfdisk /dev/hda. (make sure the partition setup matches the fstab-configuration!). After this I formated the partitions and mounted them to /media/arch (which I created beforehand). Now its time to get your tar'ed up image to the vserver. This can for example be done using scp or by putting it on some webserver and downloading it with wget.
After the image is on the vserver you can unpack it with a command similar to this one:
tar xvjpf /media/arch/archimage.tar.bz2 -C /media/arch/
Now your arch system is almost ready.
Step three: Known problems and workarounds
In my first atempt I tried to boot the system after the above step. But there is one major problem that still remains to be solved: udev won't start for some reason and therefor the system has no valid /dev/ entries. There are two ways to solve this:
- edit /etc/rc.sysinit and comment out or delete the lines that mount the tmpfs to /dev and start udev stuff
- use the static dev entries that the system copies to /dev
I used the second method since the first may be undone from system upgrades. The sysinit scripts will copy any device entries from /lib/udev/devices to /dev at system startup. So all I did is to copy the device entries from the rescue system there:
cp -a /dev/* /media/arch/lib/udev/devices/
This way the static entries will be copied to /dev and the system will work without udev.
After this step you can reboot into the new system. Make sure you have set the boot-partition right in the my.xencon.net menu. If everything did go according to plan you should be able to ssh into the new arch system. If you can't ssh in try using the konsole access to see what might have gone wrong.
There are some more things that may fail but aren't critical. Especially setting the keymap and switching consoles to UTF-8 doesn't work. But this isn't something that will prevent the system from running. Also Calculating the module dependencies won't work since there are no modules used.
With this I got archlinux running quite nicely on my xencon vserver. To my surprise the only major problem was the not starting udev, the rest went pretty smooth the way I had planned. It might not be something you want to do for some professional or mission critical systems but it works. There might be better ways to get it running, and if you have one, I would like to hear about it :) I used the article from here (randys.org) to get a basic idea on what to do. If you have questions or suggestions feel free to use the comments section below.