Friday, May 30, 2014

Damn Small Linux (DSL) Frugal install under QEMU/KVM

intent

I want a virtual router within QEMU/KVM where I control iptables so I can build systems on simulated subnets.

libvirtd config

  • 1 2Gbyte hard drive (default DSL install doesn't recognize SCSI drive)
  • from within DSL, cfdisk to create 3 partitions: hda1 100Mbyte type Linux bootable, hda2 128Mbyte type Linux  swap, hda3 the remainder type Linux
  • 256Mbyte memory
  • one cpu
  • Install from ISO image

Frugal install

  • specified install onto hda1
  • specified backup (also used for /home and other) as hda3

edits to Grub menu.lst

  • mount /mnt/hda1 and edit /mnt/hda1/boot/grub/menu.lst
  • turned on dma - without that, significant (virtual) disk access pegged the CPU
  • changed init runlevel target to 2 to avoid GUI startup
  • final grub stanza looked like
    title Optimized
    kernel /boot/linux24 2 root=/dev/hda1 quiet vga=normal noacpi noapm dma noscsi toram ssh fuse mydsl=hda3 restore=hda3 frugal host=vrouter
    initrd /boot/minirt24.gz 

Changing /etc/inittab

By default, DSL in run level 2 puts a root shell prompt on the console tty[1234] but that makes me queasy, especially since this CentOS 6.4 system running QEMU/KVM puts no password on the VNC console access to the running virtual machine.  So I did the following
  • Added "etc/inittab" to /opt/.filetool.lst
  • In /etc/inittab file, replaced the instances of /bin/bash -login with /sbin/getty 38400 tty1 (appropriate tty used for each the four consoles)
  • In /opt/bootlocal.sh, did
    /sbin/telinit q
    

iptables

  • I used MyDSL to install iptables.dsl
  • In /opt/bootlocal.sh start iptables, which will be essential to simulating various subnets.
    /etc/init.d/iptables start
    
  • In /opt/.filetool.lst specify persistence of /var/lib/iptables

ssh

Put "etc/ssh" into /opt/.filetool.lst

Passwords

To persistently change the root and dsl account passwords, I used "passwd" then specified "etc/shadow" in /opt/.filetool.lst

Persistence

The command line reboot and shutdown -r commands do not save persistent data; you need to explicitly run /usr/sbin/filetool.sh backup before rebooting.

Networking

I have static configuration rather than the default dhcp for eth1, eth2, .... To that end I add "etc/sysconfig/network-scripts" to /opt/.filetool.lst