HowTo create a Ubuntu + System Rescue CD USB startup disk

Motivation

Ubuntu is a great distro. The USB startup disk creating tool is great. You can carry Ubuntu everywhere. Although you can use the live/install iso image of Ubuntu to make rescue opperations, System Recue CD is much better for that. Here you are a way to have them both into the same USB drive by following a few simple steps. I am sure a better, more elegant integration is possible, but this one tries to be as easy to setup as possible.

Tested with:

  • Ubuntu 8.04.2 desktop i386 + SystemrescueCD 1.1.5
  • Ubuntu 8.10 desktop i386 + SystemrescueCD 1.1.5
  • Ubuntu 9.10 desktop i386 + SystemrescueCD 1.3.4

Steps

  1. Download desired Ubuntu iso image and SysrescCD iso image from their respective sites.
  2. Create a USB startup disk with the Ubuntu tool included under System->Administration menu.
  3. Extract System Rescue CD image in a folder with “Extract here” option on the context menu.
  4. Copy everything in the SysrescCD root folder to the USB drive root folder, except the “isolinux” folder.
  5. Copy the content of the isolinux folder into SysrescCD to syslinux folder in the USB drive except files “boot.cat” and “isolinux.bin”. From nautilus, just copy them all and skip copying this two files when asked.
  6. Edit “syslinux.cfg” and add these lines at the end:
label SystemrescueCD
  kernel rescuecd
  append initrd=initram.igz
include isolinux.cfg

Test

Now boot from the USB drive. It behaves like a normal Ubuntu installation CD but you have System Rescue CD boot images in the menu, starting with “SystemrescueCD” which is the standard boot. Press ESC to go to the boot prompt and press F1-F10 to access System Rescue CD boot prompt and help screens.

You can use “qemu” to test the install:

$ sudo apt-get install qemu

Umount the USB drive and boot within qemu (change /dev/sdg to your actual USB device). To do this as a normal (non-root) user you need to be in the disk group.

$ qemu /dev/sdg

Add some customization

Create a file “autorun” on the USB drive root directory. Example:

# Mount boot media read-write (in case it is USB, etc.)
mount /mnt/cdrom -o remount,rw
# Configure network with DHCP
dhclient

Cusmomize some boot options. Edit /syslinux/syslinux.cfg and add options to the “append” line:

...
append initrd=initram.igz setkmap=es
...

Enjoy

Leave a comment if it works for you.

Bye bye Scheduleworld

Scheduleworld is a funambol based SyncML service to synchronize your personal data: calendar, to-do and addressbook. They have started charging for the service a few days ago. It never worked fine for me: some data never synchronized, lots of duplicates, etc. I think the service is not ready for production so I cannot see the point of start charging a fee right now, specially when you announce the change in service conditions with only five days of time.

Also, I think it is wiser to offer a basic free service and chage for the extras, but it is up to the author, of course.

So I deleted my SW account. I’ll try myFunambol again.

Bye bye Scheduleworld.

FAT file system sorting script for MP3 players, etc.

Many MP3 players, OGG players, DVD/DIVX/XVID players, etc. use FAT file system and do not sort directory entries, but use the natural sorting in the file system, which typically depends on the order the files have been copied to the device. It is really annoying to not been able to listen to compressed music in the right order or having the chapters of your favorite series unordered.

There are several solutions for it:

  • fatsort: works directly on the fat filesystem device. Very efficient, but you need to umount the filesystem and be sure it is not corrupted. Not adequate for the “regular” user.
  • Another fatsort: this is for Windows, who cares…
  • Scripts people have done: they work by moving files around in the right order. The work for FAT, but not necessarily for other file system. There is a nice such scripts in linuxforums called findalpha.

I have written my own script you can find below. It started as an enhancement to the one on linuxforums, but I have finally rewritten it completely. You can put several paths in the command line or none to work on the current working directory. You can use it as a nautilus script (as I do). Just put the script on ~/.gnome2/nautilus-scripts and you will be able to sort a whole folder just by right-clicking on it and selecting the script.

I am sorry this blog service does not allow to attach text files, so you will have to copy the script to a text file, put a cool name like “sortdirfat” and save to a place in the path like $HOME/bin, /usr/local/bin or right to ~/.gnome2/nautilus-scripts. Do not forget to give exec permission to the script.

Enjoy.

-------------------- CUT BELOW THIS LINE -------------------------
#!/bin/sh

# This script is in the public domain
#
# Usage:
#   sortdirfat [<paths>]

# Reorder recursively the directory entries alphabetically in FAT filesystems
# (maybe in other FS too, who knows).  Useful for preparing files for playing on
# an MP3 player that follows natural directory order.
# Action takes place in directories given as argument or in current directory
# if no arguments are given.
# It can be used as a nautilus script: just copy or symlink to
# ~/.gnome2/nautilus-scripts/
# It also works on files and directories containing spaces and maybe other
# special characters.

start="`pwd`"

if [ $# -eq 0 ]; then
  set .
fi

find "$@" -type d |
while read dir; do
  cd "$dir"
  tmp=`mktemp -d -p .`
  ls -UA | grep -v `basename $tmp` | xargs -n1 -d"\n" -I'{}' mv '{}' $tmp
  cd $tmp
  ls -A --group-directories-first | xargs -n1 -d"\n" -I'{}' mv '{}' ..
  cd ..
  rmdir $tmp
  cd "$start"
done
-------------------- CUT ABOVE THIS LINE -------------------------