Revision of Customizing a Trisquel iso from Fri, 08/30/2013 - 21:56

The revisions let you track differences between multiple versions of a post.

To customize a Trisquel .iso image, you must first download it and place it in an empty directory. Open a terminal and go to that directory, then follow these steps. Note that your architecture must be same as the target, i.e. you cannot customize a 64 bit iso from a 32 bit system (beyond editing the preseed file).

Unpacking

  • Become root. All commands below will be run as root.

sudo su
  • Create an empty directory and mount the iso on it, then extract the contents:

mkdir tmp
mount -o loop trisquel-original.iso tmp
cp tmp -a src
umount tmp
  • Extract the squashed image files into casper/filesystem.squashfs:

mount src/casper/filesystem.squashfs -o loop tmp
cp tmp -a jail
umount tmp

The Preseed File

Trisquel comes with a preseed file which allows preloading values into the debconf database. You can find the file at src/preseed/trisquel.seed. The file contains commented examples on the changes it can make, like changing the default locale, setting a static network configuration, or automagically installing an extra set of packages before the live-to disk install process (which you need internet access during the install to do).

If you can achieve all the customization you need by changing this file, you can omit the next step.

Making Changes

Now you have the Trisquel system files in the jail directory, and you can start to apply changes. To install or remove packages, you need to enter the jail using chroot:

cp /etc/resolv.conf jail/etc
chroot jail
mount none /proc -t proc
The first command allows you to have network access. The second command puts you "inside" your new system. The last command is to have communication to your current system.

You can now start doing the changes that you need. First update aptitude:

aptitude update
aptitude install package
When you are done, clean-up a little and go back to your normal system:
echo "" > /etc/resolv.conf
rm /var/lib/dbus/machine-id
rm /sbin/initctl
echo "" > /root/.bash_history
dpkg-divert --rename --remove /sbin/initctl
umount /proc
exit
If you replaced the kernel or the boot scripts, copy the new kernel binary and initrd image as needed:
cp jail/boot/vmlinuz-custom src/isolinux/vmlinuz
cp jail/boot/initrd.img-custom src/isolinux/initrd

Repacking

After your modifications are done, you will need to rebuild the squashfs and .iso images. Install squashfs-tools:

apt-get install squashfs-tools genisoimage
  • Update the list of packages

chroot jail dpkg-query -W --showformat='${Package} ${Version}\n' > \
./filesystem.manifest
cp -f ./filesystem.manifest src/casper/filesystem.manifest
  • Compress the jail into the squashfs file, deleting the original one:

rm src/casper/filesystem.squashfs
mksquashfs jail src/casper/filesystem.squashfs
(you may need to add -nolzma for Trisquel 2.0 to 3.0 to the last line. This option was removed in Trisquel Awen 3.5. The option was to "use ZLIB compression method instead of LZMA", but ZLIB is now the default as shown in the man-pages. Optionally, you can install xz-lzma and add -comp xz to increase the compression ratio)

  • Update the information of the integrity of the files:

printf $(sudo du -sx --block-size=1 jail | cut -f1) > \
src/casper/filesystem.size
nano src/README.TXT #if you want to edit your distribution README
rm src/md5sum.txt
cd src
find casper -type f -print0 | xargs -0 md5sum > md5sum.txt
  • Finally, create a new .iso image (notice the dot at the end of the last line):

mkisofs -D -r -V "My Trisquel modified version" -cache-inodes \
-J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -o trisquel-modified.iso .

Optional test

Install qemu

aptitude install qemu
  • For a 64-bit system:

qemu-system-x86_64 -boot d -cdrom trisquel-modified.iso -m 512
  • For a i386 (486 and 586) system:

qemu-system-i386 -boot d -cdrom trisquel-modified.iso -m 512
If it runs well, congratulations, you are done! If it doesn't, review your steps or get in touch.

Please make clear to anyone you distribute your version to that it is not an official Trisquel .iso image. If any non-free software is included, please rename your project and do not use our logo.

Revisions

01/22/2010 - 23:39
Trisquel
02/16/2010 - 05:03
AndrewT
04/04/2011 - 16:12
lembas
08/13/2013 - 17:52
lloydsmart
08/30/2013 - 12:27
amrprznu
07/05/2015 - 00:16
vinzv
01/26/2017 - 01:34
Peter Boughton
02/14/2023 - 00:46
quidam
09/05/2023 - 06:38
icarolongo
09/16/2024 - 14:35
knife