Slackware on KVM

It's probably nothing new.

Below are the sites that I checked.

1. check your CPU for HW support

$ grep -E 'vmx|svm' /proc/cpuinfo

2. install kvm and bridge-utils
# apt-get install kvm bridge-utils

3. Add user (that executes kvm) to group kvm
# adduser <user> kvm

4. prepare images
$ kvm-img create -f qcow <somename>.img 10G

5. prepare guest OS images or CDs

I used ISO file.
# mount -t iso9660 -o loop <isofile> <mount point>

6. execute kvm
$ kvm -drive file=/usr/local/kvm_images/slak01.img,if=virtio,boot=on -cdrom /usr/local/os_images/slackware64-13.37-install-dvd.iso -boot d -m 512 -monitor stdio

Then, you'll be seeing Slackware installer boot.
Now, never forget to use virtio.
You need this to install Slackware.

7. install Slackware
You do this, Just as you install Slack on physical server,
except that you'll fail to install LILO.
* never choose btrfs as a filesystem for /boot, lilo don't like it

8. exit setup(we're gonna install LILO from here)

9. mount devices/sys/proc -> chroot
# mount -obind /dev /mnt/dev

# mount -obind /sys /mnt/sys
# mount -t proc proc /proc /mnt/proc
# chroot /mnt

10. make initrd

Edit mkinitrd.conf
# cd /etc/
# cp mkinitrd.conf.sample mkinitrd.conf
# vi mkinitrd.conf

Edit following lines:

Get a command line for making initrd.
# /usr/share/mkinitrd/ -r
# <execute above command's output ! >

11. edit lilo.conf
# vi /etc/lilo.conf

Add following line after boot = /dev/vda
disk = /dev/vda bios=0x80 max-partitions=7

Add following line after image = /boot/vmlinuz
initrd = /boot/initrd.gz

Comment out root = /dev/vda3.

12. install LILO
# lilo

13. reboot
# reboot

14. pray it to boot up

That's all for today.
That did it for me, I think.

{ 6 comments... read them below or add one }

Aleksei K said...

what partition do you have on /dev/vda?
if i have 3 /boot and /, [swap] partitions, what is my lilo.conf?

xengineer said...

Hi Aleksei K.

This is my slice.

/dev/vda3 => /
/dev/vda2 => /boot
and a swap partition.

On lilo.conf, I put

boot = /dev/vda
disk = /dev/vda bios=0x80 max-partitions=7
image = /boot/vmlinuz
initrd = /boot/initrd.gz

(there are other configs, but the above configs only matters if we are talking about slices)

Aleksei K said...

then i do something wrong my vm output is:
VFS: Cannot open root device "fc01" or unknown-block(252,1)
Please append a correct "root=" boot options; here are the available partitions:
0b00 1048575 sr0 driver: sr

maybe i miss something.

xengineer said...

Aleksei K
I am sorry to be late.
I was out of town for a while.

It seems to me that you could have missed something in step 10.
When you generate the initial ram disk image.

Maybe the following lines.

Get a command line for making initrd.
# /usr/share/mkinitrd/ -r
# <execute above command's output ! >

Where you have to execute the output of previously executed command.
Can you see if this works ?

Aleksei K said...

xengineer, thanks for you reply.
i boot vm from cd and after mkinitrd with params all works fine.

xengineer said...

I am glad to hear that.
I hope you enjoy it.

Post a Comment