Debian kFreeBSD in QEMU-KVM
April 15, 2010 6 Comments
Assuming you don’t have KVM already installed, you’ll need to run:
sudo apt-get install kvm
Then check for the presence of /dev/kvm. If it doesn’t exist, check that virtualisation is turned on in BIOS, else your system does not have the CPU extensions required to use KVM, so will fall back to using qemu instead.
Create a hard drive image.
kvm-img create -f qcow kfreebsd.img 10G
And get started.
kvm -drive file=kfreebsd.img,index=0,cache=writeback,media=disk -cdrom debian-20090729-kfreebsd-i386-install.iso
Note: I use -drive instead of -hda because I find that it increases I/O performance of the guest system.
For installing Debian GNU/kFreeBSD and other useful information, refer to the install notes.
You have two ways of running through the installer, Express or Custom, I chose “Express”. This brings you to a command-line partitioner, simply press ‘a‘ to create a slice across the whole hard drive, and ‘q‘ to finish.
Next is the BootMgr, in this program, press ‘c‘ to create a ‘9500M‘ filesystem to mount on ‘/‘, followed by a the creation of a swap to fill the rest. Once done press ‘q‘ to finish.
Next, you’ll be asked what distribution you wish to install. I selected ‘minimal‘, and if you plan to do a CD installation, I suggest the same too. Else with a Network installation, you could get away with what you want.
In the next menu, select the medium you wish to install off, either choose Network or CDROM here, then wait around to let the extraction finish. Then you’ll need to press ‘Alt+F3‘ to proceed with the installation, answering any questions you may be asked.
Once finished, you’ll be prompted to answer ‘No’ to reboot. Don’t do this, instead answer ‘Yes‘ to return to the configuration menu, where you should set the Root Password first, then optionally configure anything else you may wish to. Once done, then exit the install and reboot into your new system.
Configuring for Network
Unfortunately, some of the defaults of the installation aren’t setup correctly for immediately usage.
First thing you’ll notice is no networking, so login to the root account and get that set.
And put in the file
auto re0 iface re0 inet dhcp
Save, then restart networking
service networking restart
You can now update your system. Before you upgrade though, there is a nasty bug that prevents ‘rm’ working properly on directories on the freebsd 7.x kernels, so we’ll need to put the coreutils package on hold.
echo coreutils hold | dpkg --set-selections apt-get update apt-get dist-upgrade
Configuring for X
apt-get install xorg
Now to address some issues.
Firstly, if you haven’t already noticed, during the installation of xorg, the package ‘hal’ (as of writing) fails to install properly, leaving xorg in an unconfigured state.
Simply reboot the VM, login, and restart dbus.
service dbus restart
then run the installer again to finish the setup.
apt-get install -f
Secondly, xorg.conf needs to be setup correctly. To create a configuration file run:
Allow about a 30-60 seconds for it to finish, then open the generated file for editing.
Without going into too much detail, remove ‘Files’ and ‘Modules’ section, then edit the Sections outlined below as seen.
Section "InputDevice" Driver "kbd" [...] Section "InputDevice" Driver "mouse" Option "Protocol" "SysMouse" Option "Device" "/dev/sysmouse" [...] Section "Device" Driver "vesa" [...]
Note: If you have support for kvm, you can get away with having Driver “cirrus” instead of “vesa” in your config file. Am not sure of the benefits either or though.
Once done, install the file in it’s proper location.
mv xorg.conf.new /etc/X11/xorg.conf
Lastly, you need to create the mouse and keyboard policies for hal, as without them, will unusable under X.
First is the keyboard policy
And put into the file:
<?xml version="1.0" encoding="ISO-8859-1"?> <deviceinfo version="0.2"> <device> <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="GNU/kFreeBSD"> <match key="info.capabilities" contains="input.keys"> <merge key="input.x11_driver" type="string">kbd</merge> </match> </match> </device> </deviceinfo>
Ditto for the mouse policy.
And put into the file:
<?xml version="1.0" encoding="ISO-8859-1"?> <deviceinfo version="0.2"> <device> <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="GNU/kFreeBSD"> <match key="info.capabilities" contains="input.mouse"> <merge key="input.x11_driver" type="string">mouse</merge> </match> </match> </device> </deviceinfo>
Finally, install your favourite Window-Manager and Display-Manager. I chose xfce and gdm.
apt-get install xfce gdm
And reboot once more to be greeted by a graphical login screen.
As you can see, there is still alot of work to go into the port, a lot of work to setup correctly, and even then it is not guarenteed to work everytime. :)
However, hope you find a place for this fun Debian port when you get it stable + working.