5

I am based in India and we don't have reliable Internet everywhere. I would like to build an Ubuntu installer ISO with the following features:

  • All proprietary drivers should be available offline
  • At least one complete language pack (say, English/USA) should be available offline
  • Certain extra packages
  • And finally, things like flashinstaller or Chrome, which download data from the web while installing, should also work.

How do I go about building something like this? -

  • 7
    start here http://askubuntu.com/questions/409607/how-to-create-a-customized-ubuntu-server-iso/409651#409651 and add all the packages you want to the dvd you create. It is based of the live server dvd (a bit easier to use than the one based of the live desktop dvd (http://askubuntu.com/questions/48535/how-to-customize-the-ubuntu-live-cd/49679#49679)) . – Rinzwind Aug 27 '14 at 12:33
  • I looked into Remastersys and Ubuntu-Builder but both projects seem to be discontinued now. – curiousboy Aug 27 '14 at 13:20
  • I prefer the manual method. It is one time extra effort in understanding how BUT after that that base is the same and only the contents of the live dvd change. And doing that is manual work anyways. And that base setup you can zip and re-use (or make a timestamp per working live dvd so you can fall back to older verions). – Rinzwind Aug 27 '14 at 13:41

1 Answers1

9

Test this: Customise the Ubuntu Desktop CD Install the needed tools

sudo su

apt-get install squashfs-tools genisoimage

Download an official Desktop CD from http://releases.ubuntu.com/ Copy it into an empty directory

mkdir ~/livecdtmp

mv ubuntu-14.04.1-desktop-i386.iso ~/livecdtmp

cd ~/livecdtmp

Mount the Desktop .iso

sudo su

mkdir mnt

mount -o loop ubuntu-14.04.1-desktop-i386.iso mnt

Extract .iso contents into dir 'extract-cd'

sudo su

mkdir extract-cd

rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd

Extract the Desktop system & the SquashFS filesystem

sudo su

unsquashfs mnt/casper/filesystem.squashfs

mv squashfs-root edit

Prepare and chroot

sudo su

cp /etc/resolv.conf edit/etc/

cp /etc/hosts edit/etc/

mount --bind /dev/ edit/dev

chroot edit

mount -t proc none /proc

mount -t sysfs none /sys

mount -t devpts none /dev/pts

export HOME=/root

export LC_ALL=C

Customizations Before installing or upgrading packages you need to run

dbus-uuidgen > /var/lib/dbus/machine-id

dpkg-divert --local --rename --add /sbin/initctl

ln -s /bin/true /sbin/initctl

Remove, install & upgrade packages.

If you've modified the kernel, init scripts or added new kernel modules, you need to rebuild the initrd.lz file and substitute it into the casper directory.

sudo su

chroot edit mkinitramfs -o /initrd.gz 3.13.0-25-generic

(replace the kernel version with the one that the CD will boot with - this can be found in edit/lib/modules)

Exit from the chroot jail and move this file to extract-cd/casper:

exit

mv edit/initrd.lz extract-cd/casper/

Remove any temporary files which are no longer needed.

apt-get clean
Or
rm -rf /tmp/* ~/.bash_history

If you installed software, be sure to run

rm /var/lib/dbus/machine-id
&
rm /sbin/initctl

dpkg-divert --rename --remove /sbin/initctl

Unmount special filesystems and exit chroot

umount /proc || umount -lf /proc

umount /sys

umount /dev/pts

exit

sudo su 

umount edit/dev

Producing the CD image and compress filesystem

sudo su

chmod +w extract-cd/casper/filesystem.manifest

chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest

cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop

sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop

sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop

rm extract-cd/casper/filesystem.squashfs

mksquashfs edit extract-cd/casper/filesystem.squashfs -comp xz -e edit/boot

printf $(sudo du -sx --block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size

nano extract-cd/README.diskdefines

cd extract-cd

rm md5sum.txt

find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt

mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-14.04.1-desktop-i386-custom.iso .

Burning the image to CD

cdrecord dev=/dev/cdrom ubuntu-14.04.1-desktop-i386-custom.iso
kyodake
  • 15,401
  • Thanks for this answer, it's been helpful. A couple of things, has initrd.gz been replaced by initrd.lz? After "Exit from the chroot jail" should everything (e.g. from "Remove any temporary files which are no longer needed." to the create image part) be run on the host system creating the image? – Dr.Avalanche Feb 23 '15 at 15:40