Remastering

Finnix, the LiveCD for system administrators

(Redirected from Remastering Finnix)
Finnix-dev-machine.jpg

Warning: This guide is valid as of Finnix 101. Finnix 100 and earlier used a substantially different filesystem layout, and will not work with this guide.

Quick remaster guide

1. Boot the Finnix CD.

2. Mount a disk to work within. For this guide, the mount point /srv/finnix/build is assumed. If you do not use /srv/finnix/build, you will need to edit the build scripts later in this guide.

(finnix)# mkdir -p /srv/finnix/build
(finnix)# mount /dev/sdaX /srv/finnix/build

The disk's file system must be a POSIX filesystem (ext2/3/4, xfs, jfs, etc).

3. Create the necessary filesystem layout for this guide.

(finnix)# mkdir -p /srv/finnix/build/master
(finnix)# mkdir -p /srv/finnix/build/source/FINNIX

4. Copy the contents of /cdrom to /srv/finnix/build/master.

(finnix)# cp -a /cdrom/* /srv/finnix/build/master/

5. Copy the contents of /FINNIX (which is a mounted squashfs filesystem) to /srv/finnix/build/source/FINNIX. Remember that POSIX filesystems are case sensitive, so /FINNIX and /finnix are two separate directories.

(finnix)# cp -a /FINNIX/* /srv/finnix/build/source/FINNIX/

6. (Optional) If you plan on upgrading the kernel, you must extract the initrd.

Finnix 101

x86:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# gunzip -c /cdrom/isolinux/initrd.gz | cpio -idm

PPC:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# gunzip -c /cdrom/boot/initrd.gz | cpio -idm

Finnix 103

x86:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# xz -dc /cdrom/isolinux/initrd.xz | cpio -idm 

PPC:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# xz -dc /cdrom/boot/initrd.xz | cpio -idm 

7. Chroot into the extracted Finnix filesystem. Setting FINNIXDEV=1 allows for some chroot-specific features to make, for example, dist-upgrading easier. In most cases, you do not need to mount /proc and /sys manually; the Finnix dev enironment should do it for you in many cases (during apt-get operations, for example).

(finnix)# export FINNIXDEV=1
(finnix)# chroot /srv/finnix/build/source/FINNIX /bin/bash -l

8. Now that you are chrooted, you can make your desired modifications. What you do now is up to you. For ideas, please see Modification Ideas below.

9. When you are finished, exit the chroot.

(chroot)# exit

10. Creating the squashfs filesystem and ISO are very easy, with the assistance of two helper scripts, finnix-build-stage1 and finnix-build-stage2. They're located within the chroot, but must be executed outside of the chroot.

Please review these build scripts! They are the same scripts used to create the main Finnix distribution, and have a couple extra features, such as updating the boot menu with the build tag. However, you do not need to worry about this, as they are only used by the scripts if necessary files are present. Likewise, the initrd will be re-created only if you extracted it in step 6.

Beware, the scripts can be somewhat destructive to 3rd-party modifications. To save space, many files in the chroot are automatically removed if found. For example, the contents of /usr/share/doc and /root are completely deleted. Again be sure to review the scripts, and have proper backups.

(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2

Again, while the scripts are within the chroot, they must both be executed outside of the chroot. For simplicity, I like assigning aliases:

(finnix)# alias stage1=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# alias stage2=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
(finnix)# stage1 && stage2

If all goes well, you should have a file named /srv/finnix/build/finnix.iso (or /srv/finnix/build/finnix-ppc.iso). Burn it, test it and enjoy!

Modification ideas

  • Add proprietary software that can't be included in free download, such as compression tools like rar. (Obviously, if you do this, you will not be able to release your modified copy to the public.)
  • Add software that is not included due to size reasons or because it is not needed often enough.
  • Update clamav's database for AV scans of systems with no internet connection.
  • Personalize your Finnix -- add boot messages and such to show that it is your personalized copy.
Personal tools