How to Package an Installed Linux system into a UEFI-bootable ISO
In a previous tutorial, we discussed the Systemback application that allows us to create a bootable live system from an installed Linux system. However, Systemback was no longer maintained. Luckily, we can do the same with standard ISO packaging tools in Linux.

The key is to create a hybrid ISO that contains both legacy BIOS and UEFI boot records. Two approaches are available :
- Method 1 (GRUB 2) is modern and recommended.
- Method 2 (SYSLINUX) is a viable alternative.
| Feature | ✅ Method 1: GRUB 2 (Recommended) | ⚠️ Method 2: SYSLINUX (Alternative) |
|---|---|---|
| Core idea | Build a standalone GRUB 2 image | Convert an existing ISO with isohybrid |
| Boot mechanism | Unified by GRUB 2 | SYSLINUX (Legacy) + isohybrid |
| UEFI support | Native, full | Works from USB/HDD, not from optical media |
| Compatibility | High (used by modern distros) | Lower, specific use cases |
| Complexity | Medium | Medium |
For simplicity, I will only show you how to do it with Grub. It’s easier and straightforward.
🚀 Using GRUB 2 (Recommended)
This is the method used by mainstream Linux distributions. GRUB 2 handles both legacy BIOS and UEFI boot.
Install grub2-common and xorriso.
sudo apt install grub2-common xorriso
Create working directories
mkdir ~/{source_fs,iso_content}
~/source_fs: You will copy the root file system to this directory.iso_content: This will be the root directory for the ISO
Copy your running system into source_fs. Exclude virtual & temporary directories (/proc, /sys, /dev, /run, /tmp) and also exclude ~/source_fs and ~/iso_content to avoid recursion. Example:
sudo rsync -avx --exclude={"/proc/*","/sys/*","/dev/*","/run/*","/tmp/*","/home/your_username/source_fs/*","home/your_username/iso_content} / ~/source_fs/
Edit the fstab file.
sudo vi source_fs/etc/fstab
Comment out every line in this file. Save and close the file. Then make sure the /media/your_username/ directory is owned by you.
sudo chown your_username:your_username source_fs/media/your_username/ -R
Create the SquashFS Image: Compress a complete Linux root filesystem (with directories like /bin, /etc, /usr) into a SquashFS file, usually named filesystem.squashfs
sudo mksquashfs source_fs/ iso_content/live/filesystem.squashfs -comp zstd
Copy the necessary Linux kernel (vmlinuz) and initramfs (initrd.img)
cp source_fs/vmlinuz iso_content/live/ cp source_fs/initrd.img iso_content/live/
Create the grub.cfg file.
mkdir -p iso_content/boot/grub/ nano iso_content/boot/grub/grub.cfg
Add the following content.
menuentry "My Live Linux System" {
linux /live/vmlinuz boot=live live-config live-media-path=/live findiso=${iso_path}
initrd /live/initrd.img
}
If your computer has plenty of RAM, you can add the toram parameter at the end of the second line, so the entire live system will be copied into RAM.
linux /live/vmlinuz boot=live live-config live-media-path=/live findiso=${iso_path} toram
Save and close the file. Finally, run grub-mkrescue to create the final ISO file
sudo grub-mkrescue -o my_live_system.iso iso_content -iso-level 3
Now you can test your ISO file in VirtualBox, or use dd to write the ISO file to USB flash drive. You can also use Grub to boot the ISO file without creating a bootable USB drive.


