Remastering ubuntu 9.04 Jaunty Jackalope

( This document was written in connection with a one day ubuntu ramastering workshop held at College of Engineering Attingal. See this post)

System Requirement

You need a reasonably  good PC with Ubuntu 9.04 installed. It should have plenty of free space ( say 4 GB ) and minimum 1 GB

Preparing the host system

Create a work directory

# mkdir jaunty

Create the following sub directoires

# mkdir  jaunty/cdrom
# mkdir  jaunty/tmp
# mkdir jaunty/root
#mkdir jaunty/remaster

Mount the jaunty iso image on jaunty/cdrom directory
#mount -o loop jaunty.iso jaunty/cdrom

Copy everything from the cdrom to jaunty/image directory

#cp -r jaunty/cdrom  jaunty/image

Now the  image directory has  the content of your cdrom.

You may refer to this post for an explanation of the contents of the image directory.

Rebuilding the squashfs image.

We are going to rebuild filesystem.squashfs under jaunty/image/casper

Move the filesystem.squashfs image to jaunty/tmp directory

#mv  jaunty/image/casper/filesystem.squashfs jaunty/tmp

Mount the filesystem.squashfs under jaunty/root direct

#mount -o loop jaunty/tmp/filesystem.squashfs jaunty/root

Copy the contents of fileystem.squashfs  to jaunty/remaster

#cp -r jaunty/root jaunty/remaster

Now the jaunty/remaster directory holds the uncompressed root filesystem for your live CD.

Copy resolv.conf and sources.list from the host system

#cp /etc/resolv.conf jaunty/remaster/etc/

Preserve   original sources.list.

#cp jaunty/remaster/etc/apt/soures.list   jaunty/remaster/etc/apt/soures.list.backup

#cp /etc/apt/sources.list /jaunty/remaster/etc/apt/

Make sure that sources.list points to jaunty archive

Now you can chroot to  jaunty/remaster .

#chroot jaunty/remaster

Now run the following ( You are inside chroot )

# mount /proc

# mount /sys

# mount -t devpts none /dev/pts

The above commands mount the respective directories inside chroot.

# apt-get update

Install/remove necessary packages using apt.

Cleanup the unwanted files.

#apt-get clean
#rm -rf /tmp/*
#rm /etc/resolv.conf
#umount -l -f /proc

#umount -l -f /sys

#umount /dev/pts
Exit chroot
#exit

Now replace the sources.list with the original sources.list

#cp jaunty/remaster/etc/apt/soures.list.backup   jaunty/remaster/etc/apt/soures.list

Repack squashfs

# cd jaunty
#mksquashfs remaster image/casper/filesystem.squashfs

Recreate filesystem.manifest& filesystem.manifest.desktop:
Run the following  commands.

# chroot remaster  dpkg-query -W –showformat=’${Package} ${Version}\n’ |  tee image/casper/filesystem.manifest

#cp -v image/casper/filesystem.manifest{,-desktop}

# REMOVE=’ubiquity casper live-initramfs user-setup discover xresprobe os-prober libdebian-installer4′

# for i in $REMOVE
do
sed -i “/${i}/d” image/casper/filesystem.manifest-desktop
done

Recreate md5sum

#cd image && find . -type f -print0 | xargs -0 md5sum > md5sum.txt

Recreate the iso image.

# mkisofs -r -V “Jaunty_remix” -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-jaunty-remix.iso .
# cd ..

You can test the new image with virtual box.

8 comments

  1. Thanks for the instructions. Just one thing – in the future, when you are including code, please put them in the pre tag. Otherwise wordpress will change some chars(like “) and it will cause trouble for people who don’t know about the changes.

  2. Nice howto guide. Thanks a lot.

    3 things:
    The step “cp -r jaunty/root jaunty/remaster” leaves you with jaunty/remaster/root/…”
    There are recurring typos in sources.list (-> soures.list)
    There is an absolute path, while all the others are relative: /jaunty/remaster/etc/apt/

  3. another 2 things:
    – the dpkg-query command has a formatting problem. Copy paste does not work for me. Typing by hand works fine.
    – I ended up without a kernel and initramdisk in jaunty/remaster/boot. Guess that it only a detail for everyone else. 😉

  4. some more typos… here comes a corrected version:

    Remastering ubuntu 9.04 Jaunty Jackalope

    ( This document was written in connection with a one day ubuntu
    ramastering workshop held at College of Engineering Attingal. See this
    post)

    System Requirement

    You need a reasonably good PC with Ubuntu 9.04 installed. It should
    have plenty of free space ( say 4 GB ) and minimum 1 GB

    Preparing the host system

    apt-get install squashfs-tools
    wget -c … ubuntu-9.04-desktop-i386.iso

    Create a work directory

    # mkdir jaunty

    Create the following sub directoires

    # mkdir jaunty/cdrom
    # mkdir jaunty/tmp
    # mkdir jaunty/root
    # mkdir jaunty/remaster

    Mount the jaunty iso image on jaunty/cdrom directory
    # mount -o loop jaunty.iso jaunty/cdrom

    Copy everything from the cdrom to jaunty/image directory

    # cp -r jaunty/cdrom jaunty/image

    Now the image directory has the content of your cdrom.

    You may refer to this post for an explanation of the contents of the
    image directory.

    Rebuilding the squashfs image.

    We are going to rebuild filesystem.squashfs under jaunty/image/casper

    Move the filesystem.squashfs image to jaunty/tmp directory

    # mv jaunty/image/casper/filesystem.squashfs jaunty/tmp

    Mount the filesystem.squashfs under jaunty/root direct

    # mount -o loop jaunty/tmp/filesystem.squashfs jaunty/root

    Copy the contents of fileystem.squashfs to jaunty/remaster

    # cp -r jaunty/root jaunty/remaster

    Now the jaunty/remaster directory holds the uncompressed root
    filesystem for your live CD.

    Copy resolv.conf and sources.list from the host system

    # cp /etc/resolv.conf jaunty/remaster/etc/

    Preserve original sources.list.

    # cp jaunty/remaster/etc/apt/soures.list jaunty/remaster/etc/apt/soures.list.backup

    #cp /etc/apt/sources.list /jaunty/remaster/etc/apt/

    Make sure that sources.list points to jaunty archive

    Now you can chroot to jaunty/remaster .

    # chroot jaunty/remaster

    Now run the following ( You are inside chroot )

    # mount /proc

    # mount /sys

    # mount -t devpts none /dev/pts

    The above commands mount the respective directories inside chroot.

    # apt-get update

    Install/remove necessary packages using apt.

    Cleanup the unwanted files.

    # apt-get clean
    # rm -rf /tmp/* /etc/resolv.conf
    # umount -l -f /proc
    # umount -l -f /sys
    #umount /dev/pts

    Exit chroot
    #exit

    Now replace the sources.list with the original sources.list

    # cp jaunty/remaster/etc/apt/soures.list.backup jaunty/remaster/etc/apt/soures.list

    Repack squashfs

    # cd jaunty
    # mksquashfs remaster image/casper/filesystem.squashfs

    Recreate filesystem.manifest& filesystem.manifest.desktop:
    Run the following commands.

    # dpkg-query -W -f=’${Package} ${Version}\n’ | tee image/casper/filesystem.manifest

    # cp -v image/casper/filesystem.manifest{,-desktop}

    # REMOVE=’ubiquity casper live-initramfs user-setup discover xresprobe os-prober libdebian-installer4′

    # for i in $REMOVE
    do
    sed -i “/${i}/d” image/casper/filesystem.manifest-desktop
    done

    Recreate md5sum

    #cd image && find . -type f -print0 | xargs -0 md5sum > md5sum.txt

    Recreate the iso image.

    # mkisofs -r -V “Jaunty_remi” -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-jaunty-remix.iso .

    # cd ..

    You can test the new image with virtual box.

  5. When i got to the chroot prt, it didn’t work. Said it was impossible to chroot to the directory. By the way, those mount commands require root privilege.

  6. I compiled the iso image, but i don get these things specified working when i boot up my customized Live cd.
    1. no volume control gstreamer plugins and/or devices found
    2. No network support, i cant connect to the internet
    3. Is there any tutorial to change the usplash theme of Ubuntu Live CD???

  7. When running the ‘cp -r jaunty/root jaunty/remaster’ file permissions are not kept. So things like sudo are nolonger suid. That’s why the network didn’t start etc. Or the install.
    cp -r -p (p to preserve perms) would work better …
    Maybe should do a rsync -p -o jaunty/root jaunty/remaster

Comments are closed.