Remastering the Install ISO

From ParabolaWiki
Jump to: navigation, search

Remastering the official Parabola install ISO image is not necessary for most applications. However, it may be desirable in some cases.

  • Basic hardware is not supported by the core install. (rare)
  • Installation on a non-internet capable machine.
  • Deployment of Parabola on many similar machines, requiring the same installation procedure.

As these ISOs are bootable, they can also be used for system rescue, testing, project demos, and more.

1 Parabolaiso

It is often preferable to rebuild the installation ISO with Parabolaiso, instead of remastering an existing ISO.

2 Manually

2.1 How it works

The installer ISO contains two separate Parabola systems. One for 32 bit (i686) and one for 64 bit (x86_64). The root filesystems of those systems are stored in parabola/i686/root-image.fs.sfs and parabola/x86_64/root-image.fs.sfs. The kernels and initramfs are in parabola/boot/i686 and parabola/boot/x86_64. This means in order to fully remaster the ISO, you have to do your changes for both the 32 bit and the 64 bit system.

When booting, the initramfs will search for the device it was booted from via its label, PARA_201611 for example, and will mount the root filesystem for the correct architecture.

2.2 Extracting the ISO

To remaster the Parabola ISO, you will need a copy of the original ISO image. Download it from the download page

Now, create a new directory to mount the ISO:

# mkdir /mnt/parabolaiso

Mount the ISO to this directory (due to the nature of ISOs, the result is read-only):

# mount -t iso9660 -o loop /path/to/parabola.iso /mnt/parabolaiso

Copy the contents to another directory, where they can be edited:

$ cp -a /mnt/parabolaiso ~/customiso
# umount /mnt/parabolaiso
Note: Make sure customiso does not exist beforehand, otherwise this will create a subdirectory called parabolaiso inside customiso

2.3 Customization

2.3.1 Modifying the x86_64 system

Change into the directory of the x86_64 system:

 $ cd ~/customiso/parabola/x86_64

Unsquash root-image.fs.sfs (to squashfs-root):

 $ unsquashfs root-image.fs.sfs
Note: You need squashfs-tools in order to do that.

Now you can modify the content of the system in squashfs-root.

 # mount squashfs-root/root-image.fs /mnt/parabolaiso

You can also chroot into this system to install packages etc.:

 # arch-chroot /mnt/parabolaiso
Note: arch-chroot is part of the package arch-install-scripts
Note: If the arch-chroot script is not available in your system (e.g, when remastering arch-based distros), mount the api file systems and copy over your DNS details. See Change Root#Change root.

To be able to install package, you have to initialize the pacman keyring:

 (chroot) # pacman-key --init
 (chroot) # pacman-key --populate archlinux parabola
Note: This step can take quite a while, be patient. (see Pacman-Key)

If the kernel or initrd is updated, additional steps are required. In this case you have to install parabolaiso-git inside the chroot and change the content of /etc/mkinitcpio.conf:

 (chroot) # pacman -Syu --force parabolaiso linux-libre
 (chroot) # nano /etc/mkinitcpio.conf

Change the line that says HOOKS="... to:

HOOKS="base udev memdisk parabolaiso_shutdown parabolaiso parabolaiso_loop_mnt parabolaiso_pxe_common parabolaiso_pxe_nbd parabolaiso_pxe_http parabolaiso_pxe_nfs parabolaiso_kms block pcmcia filesystems keyboard"

Now update the initramfs:

 (chroot) # mkinitcpio -p linux-libre

When you are done, create a list of all installed packages, clean the pacman cache and exit the chroot:

 (chroot) # LANG=C pacman -Sl | awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > /pkglist.txt
 (chroot) # pacman -Scc
 (chroot) # exit

If you updated the kernel or the initramfs, copy them over to the system:

 $ cp /mnt/parabolaiso/boot/vmlinuz-linux-libre       ~/customiso/parabola/boot/x86_64/vmlinuz
 $ cp /mnt/parabolaiso/boot/initramfs-linux-libre.img ~/customiso/parabola/boot/x86_64/parabolaiso.img

Move the list of packages:

 $ mv /mnt/parabolaiso/pkglist.txt ~/customiso/parabola/pkglist.x86_64.txt

Now recreate root-image.fs.sfs:

 $ rm root-image.fs.sfs
 $ mksquashfs squashfs-root root-image.fs.sfs -comp xz


 # umount /mnt/parabolaiso
 # rm -rf squashfs-root/

Now update the MD5 checksum of root-image.fs.sfs:

 $ cd ~/customiso/parabola
 $ md5sum x86_64/root-image.fs.sfs > checksum.x86_64.md5

2.3.2 Modifying the i686 system

Follow the same steps as for the x86_64 system but with the following differences:

  1. In every command use i686 instead of x86_64
  2. When doing the chroot, use this command instead:
 # setarch i686 arch-chroot /mnt/parabolaiso
Note: If you do not have the arch-chroot script, put setarch i686 before the line where you do chroot

2.3.3 Modifying the EFI boot image

If you have updated the kernel or the initramfs and wish to boot on EFI systems, update the EFI boot image. You will need dosfstools as the EFI boot image is a FAT16 filesystem.

 $ mkdir mnt
 # mount -t fat -o loop ~/customiso/EFI/parabolaiso/efiboot.img mnt
 $ cp ~/customiso/parabola/boot/x86_64/vmlinuz mnt/EFI/parabolaiso/vmlinuz.efi
 $ cp ~/customiso/parabola/boot/x86_64/parabolaiso.img mnt/EFI/parabola/parabolaiso.img
 # umount mnt

If you see No space left on device errors, you might need to resize efiboot.img. You can also create a new efiboot.img and copy the old files (replace 50 with the required size).

 $ dd if=/dev/zero bs=1M count=50 of=efiboot-new.img
 $ mkfs.fat -n "PARABOLAISO_EFI" efiboot-new.img
 $ mkdir new
 # mount -t fat -o loop efiboot-new.img new
 # mount -t fat -o loop ~/customiso/EFI/parabolaiso/efiboot.img mnt
 $ cp -r mnt/* new/
 # umount new mnt
 $ mv efiboot-new.img ~/customiso/EFI/parabolaiso/efiboot.img

And use the new efiboot.img as above.

2.4 Create a new ISO

The ISO volume label of the new ISO must be the same as the original ISO for the image to boot successfully (in this case PARA_201611). This volume label can be found using the isoinfo program, also from the cdrkit package.

 $ isoinfo -d -i /path/to/parabola.iso | grep 'Volume id:'

Note the 'Volume id' to be inserted in the next command, e.g.:

 Volume id: PARA_201611

Create a new ISO image with genisoimage, which is part of cdrkit. Be sure to replace 'PARA_201611' below with the volume label from the previous step.

 $ genisoimage -l -r -J -V "PARA_201611" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/ -o ../parabola-custom.iso ./
Note: The -b and -c options expect paths relative to the root of the ISO

The resulting ISO image will boot only from CD, DVD or BD. For booting from USB stick or hard disk, it needs the isohybrid feature. This can be achieved by post-processing the ISO by program isohybrid included in syslinux. Officially, the version of installed SYSLINUX has to be the same as the version of /isolinux/isolinux.bin in the ISO. It is not known whether really incompatible version combinations exist.

An alternative to genisoimage plus isohybrid can be derived from the xorriso run of mkarchiso.

$ iso_label="PARA_201611"
$ xorriso -as mkisofs \
       -iso-level 3 \  
       -full-iso9660-filenames \
       -volid "${iso_label}" \
       -eltorito-boot isolinux/isolinux.bin \
       -eltorito-catalog isolinux/ \
       -no-emul-boot -boot-load-size 4 -boot-info-table \
       -isohybrid-mbr ~/customiso/isolinux/isohdpfx.bin \
       -output parabola-custom.iso \ 

Option -isohybrid-mbr needs an MBR template file. Most probably there is already such a file /isolinux/isohdpfx.bin in the original ISO, which matches the SYSLINUX version used in the ISO. Only if this file is missing in the copied ISO content, it has to be cut out of the original ISO image file, before above xorriso run is performed:

$ dd if=/path/to/parabolaISO bs=512 count=1 of=~/customiso/isolinux/isohdpfx.bin
Warning: It has not been proved that EFI partition activation works

If the original ISO supports bootability via EFI, this can be activated in the new ISO by inserting the following options between the lines "-isohybrid-mbr ..." and "-output ...":

       -eltorito-alt-boot \
       -e EFI/parabolaiso/efiboot.img \
       -no-emul-boot -isohybrid-gpt-basdat \

The file /EFI/parabolaiso/efiboot.img is a FAT filesystem image file. If it is missing in the original ISO, then there was no EFI support in that ISO.

The newly created ISO image parabola-custom.iso is found in the home directory. You can write the ISO image to a USB stick as explained in this article. Alternatively you can burn the ISO image on a CD, DVD, or BD with your preferred software. On Parabola, that is covered in the article about burning an ISO image.

3 See also