Announcement

Collapse
No announcement yet.

remastering - the hard way (with explanations)

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    remastering - the hard way (with explanations)

    Preamble:

    If you are after a simple remastering howto go here

    This is basically a simplified write up of https://help.ubuntu.com/community/LiveCDCustomization in that it concentrates on what is happening behind the scenes only.

    I am grateful for all comments, improvements, tips and tricks.

    Live CD:

    A basic Xbuntu life system must at least have a working framework including isolinux and the core squashfs.

    core -
    - squashfs - this what we need to manipulate to change the desktop system. Consists of the highly compressed live CD file system from / all the way up. It accounts for some 90% of the size of the entire CD.

    framework -
    - isolinux - linux bootloader, contains everything on how the CD is going to start. The CD's grub is located here including graphics and menu – if you just want to change the packages included in the CD this is of no interest. If, however, you want to change the CD's boot behaviour you will need to look into this a little further.
    - the folder /preseed – preseeding appears to be interesting to those who need to streamline installs, good info here https://help.ubuntu.com/community/In...omization#Copy the CD to your hard drive
    - out of the other stuff on the live CD you could safely get rid of the windows executive files (the wubi installer) if you so wish.

    Requirements:

    space – 10GB should do for a large job
    packages – sudo apt-get install squashfs-tools mkisofs
    iso – a kubuntu iso
    environment – a directory structure to a) mount the iso in and b) manipulate its contents, see under process below

    Process:

    Load the squashfs module to be able to mount and manipulate the live CD's file system.
    sudo modprobe squashfs
    Set up remastering environment – my motto is “keep your home clean” so I prefer a separate partition to do this in rather than /home

    Create the iso environment and change into it
    mkdir tmp1 && cd tmp1
    create directory to mount original live CD into
    mkdir mnt
    sudo mount -o loop path_to_iso/iso_name.iso mnt
    create directory for new framework and copy the original into it
    mkdir extract-cd
    rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
    create directory for new core and mount original into it (perhaps having to mount twice is at first somewhat confusing, but consider that squashfs is in itself a read-only file system which needs to be mounted and copied before it can be manipulated).
    mkdir squashfs
    sudo mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
    create editing directory within which to manipulate the squashfs and copy over the mounted original
    mkdir edit
    sudo cp -a squashfs/* edit/
    The environment is created. To make it liveable in connect it to the network
    sudo cp /etc/resolv.conf edit/etc/
    sudo cp /etc/hosts edit/etc/
    Mount the live CD to the edit/dev mountpoint within our environment, chroot into the copied squashfs, mount both /proc and /sys volumes and get the locale right:
    sudo mount --bind /dev edit/dev && sudo chroot edit
    mount -t proc none /proc
    mount -t sysfs none /sys
    export HOME=/root
    export LC_ALL=C
    Now work your magic adjusting repositories, packages, looks, processes, whatever. When finished clean up behind yourself
    apt-get clean
    rm -rf /tmp/*
    rm /etc/resov.conf
    umount /proc
    umount /sys
    Then leave chroot and release the live CD mounted in it
    exit
    sudo umount edit/dev
    Regenerate the list of installed packages so that everything is congruent
    chmod +w extract-cd/casper/filesystem.manifest
    sudo chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
    sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop
    sudo sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
    Now compress your new edited squashfs (takes some 20 minutes on my single core AMD 2600+)
    sudo rm extract-cd/casper/filesystem.squashfs
    sudo mksquashfs edit extract-cd/casper/filesystem.squashfs -nolzma
    And finally create the iso (replace space holders in “” with appropriate values, note the full stop at the end of the command)
    cd extract-cd
    sudo mkisofs -r -V “_name_of_newly_created.iso" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o “/_path_/_name_of_your_original_kubuntu.iso” .
    Testing:
    Try your remastered version in a virtual environment, put it on a usb stick or burn it using k3b.
    Once your problem is solved please mark the topic of the first post as SOLVED so others know and can benefit from your experience! / FAQ
Working...
X