Optimizing a new Linux LivePC
Publishing a Linux LivePC isn't very different than installing a Linux operating system. However, there are a few tricks you can do to make your LivePC smaller, faster, and easier to use.
Follow these steps to build a great Linux LivePC!
IMPORTANT NOTE BEFORE STARTING: You should NEVER type a private password into a LivePC you are building. The password could end up in the swap partition or any number of other places and get published along with your LivePC.
Just use an existing one!
If someone has already done all of the work for you, why replicate it? Before going through an install, why not try one of our Linux Templates or the LivePC Library to see if you can base your LivePC on an existing one. Not only will you avoid all the work of setting up the LivePC, it will also be more efficient. When you build a LivePC based on another one, the LivePC Engine automatically calculates the differences and only stores those differences. So downloading a derived LivePC will be much faster and take up less space. Always a good thing!
If you deriving from an existing LivePC, just turn on "Let me keep my changes" and skip all the way down to "Zero the empty space". That was easy, wasn't it?
Creating a new LivePC
- Find an install ISO image for your favorite Linux distro. It can be local or on a web server somewhere.
- Click to create a LivePC.
- Specify title, OS type, minimum and default memsize.
- The system.cdsk disk will hold all of the system files and be reverted every time the user powers off the LivePC. The local.cdsk will hold the home directories and persist across power cycles. Increase the local.cdsk file size to 20000MB.
- If you are using an ISO to install, change IDE 1:0 to cdrom-image and put the local path (e.g.
C:\FC-5-i386-DVD.iso
) in the "path" box. (There is a bug in the current version of the LivePC Engine where the path box is too short. A workaround is to put your file in C: with a short name. This bug is fixed in the upcoming version.) If you are using a normal install CD/DVD, just leave it as "cdrom-raw". - Click create.
Installing the guest
- Launch the new LivePC and run through the installer to install to the hard disk. For LiveCDs, this can usually be accomplished by selecting some "Install to HD" program on the desktop or menus.
- If given a choice of file system, ext2 or ext3 seems to perform well with LivePCs.
- Partition hda1 as a big partition with label "
/
" and a small (256MB to 512MB) swap partition. - Partition hdb as a single big partition with label "
/home
". - The convention is to name the user "m5" with password "m5". Root password also "m5".
- After the installation, shut down and edit the configuration to change IDE 1:0 back to "auto detect" and "cdrom-raw", if you changed it in the last step.
Installing VMware tools
- In the LivePC, download VMware tools tar.gz file to /tmp and extract it. The VMware tools tar.gz file is available in the linux.iso file distributed with VMware Player 2.0. (Instead of downloading the whole VMware Player, you can directly download the Linux tar file or the Linux rpm file.)
- Run the perl script to install. Don't install the hgfs or the vmxnet drivers.
- The installation script may install the vmmouse drivers, which allow you to seamlessly move the mouse between the guest and host. Try "urpmi vmmouse" on Mandriva to install it. Change the mouse driver in /etc/X11/xorg.conf to "
vmmouse
". - If there are problems detecting an X installation, you can manually change the mouse driver to "
vmmouse
" and the video driver to "vmware
". If these drivers are missing you may need to rebuild X with support for them.
Setting up auto login
Each Linux distro has a different way to set up autologin. If you can't find a way to do it, you can try this technique:
- Install mingetty if you don't have it already.
- Edit
/etc/inittab
. Look for the lines that start with c0/c1/c2/etc and replace the *getty with "mingetty --autologin m5 -- noclear tty?
"
Configuring the LivePC guest OS
- Configure guest with standard resolution of 1024x768. If the guest uses X, you can make
/etc/X11/xorg.conf
be a symlink to a file in /home, so a user's resolution changes will persist across reboots and updates. - Disable time-based fsck by executing
tune2fs -i 0
on a filesystem. - If possible, configure for autologin with username "m5".
- If given a choice, set timezone to Pacific for consistency.
- Optional: Run the update tool to update the packages. After installing, the system keeps the packages around, so find where they are cached and delete them to save space.
- Optional: If you are experiencing time skew, add these kernel options to grub/lilo: "
clock=pit nosmp noapic nolapic
". See this link for more info. - Optional: Take a look at the files in
/etc
, any files that contain settings that should be persistent (like X resolution configuration) should be symlinked to a copy in/home
.
Kernel Configuration (optional)
- For those with time to kill, recompile the kernel with minimal drivers.
- AMD PCNET32 is the required network driver.
- Timer refresh should be 100Hz not 250Hz or 1000Hz. Change the define in /usr/src/linux-2.6/include/asm-i386/param.h to "
#define HZ 100
" - Install the zero-free patch to automatically zero deleted blocks.
Faster guest bootup (optional)
- Don't run ldconfig and depmod during boot. For DSL, comment them out in
/etc/init.d/knoppix-autoconfig
- Set timeout entry in
grub.conf
(if booting with grub) (For Ubuntu, edit/boot/grub/menu.lst
) or delay entry entry inlilo.conf
(if booting with lilo) to zero or a small value. - Disable hardware probing. For DSL, adding the following to the boot line in lilo.conf disables most unnecessary boot steps in LivePCs:
nohwsetup nofstab nomkxf86config noagp nopcmcia nousb nofirewire nomce noapic
Zero the empty space
- Clean up the disk as much as possible. Delete any installation files, files in
/tmp
, cached files in/var
, etc. (This varies by installation.) Use "du
" to find where space is being used. - Run these two commands as root to free up space:
dd if=/dev/zero of=/tmp/garbage bs=65536
rm -f /tmp/garbage
- If you have a local disk, do the same thing for /home:
dd if=/dev/zero of=/home/garbage bs=65536
rm -f /home/garbage
- Also zero the swap partition:
swapoff -a
dd if=/dev/zero of=/dev/hda2 bs=65536
mkswap /dev/hda2
Packaging
- Once everything is configured, shut down and exit the LivePC.
- Boot it up once to generate a boot trace. Click on whatever functionality the user is likely to use.
- Shut down cleanly.
- Click "package". If this is a brand new LivePC, select "No" when it asks you if you just want to package differences. Otherwise select "Yes". Select a directory and wait a while.
- After it finishes, you can host it on moka5 servers or your own servers. To host on your own servers, make a new directory on a web server somewhere and upload the files to that directory using e.g. winscp. Name the directory after the date for easier bookkeeping. Post it into the LivePC Library. Point it to the
vm.xml
file that you uploaded. - You can edit the description and logo of your new LivePC in the LivePC Library. distrowatch.com is a good source for logos. Try to use a logo of the correct resolution (96x96) and try to avoid using JPEG images, as they don't look as good.
- Click to subscribe, and verify that your new LivePC works.
- Note that once you publish, you shouldn't change the uploaded files. If you want to update your LivePC, just package the differences and upload to a new directory.
Double-checking before you publish
- Did you remove the cdrom-image install iso and replace it with "auto detect" and "cdrom-raw"?
- Is the total size reasonable? Did you forget to delete something?
- Is there a
system.cdsk.fetch_order
file? Is it a reasonable size (10-20KB)? - Is the resolution 1024x768?
- Does guest shutdown work? Some VMs get stuck on shutdown.
- Is the default memory size still correct? Packaging on a system with not enough RAM may reduce the number to a level below what you wanted.
- Do changes to the user's home directory persist across LivePC shutdown?
- If the LivePC should use sound, is the sound working?
Congratulations, you've published a new LivePC! Now spread the word and let everyone try out your new creation!