Creating a Bootable ISO from a Live Linux System

⚠️ This document is still a draft. Please note that there might be mistakes or inaccuracies.

Creating a bootable ISO from a live Linux system can be a bit complex. However, if you follow the steps carefully, you can achieve your goal. Here’s a step-by-step guide:

Table of Contents


  • A live system running Ubuntu or its derivative.
  • Enough storage space to hold the contents of the live system and some additional tools.
  • Root access or sudo privileges.


Install Required Packages

Open a terminal and install the required packages:

   sudo apt update
   sudo apt install squashfs-tools genisoimage

Backup your data

Before proceeding further, ensure you’ve backed up any important data on your live system.

Prepare the Workspace

Create a workspace to hold necessary files:

   mkdir ~/livecdtmp

Copy Necessary Files

Copy the necessary files from your live system to the workspace:

   rsync --exclude=/proc/ --exclude=/tmp/ --exclude=/sys/ --exclude=/mnt/ --exclude=/dev/ --exclude=/home/ --exclude=/root/livecdtmp / ~/livecdtmp

This command excludes directories that contain runtime system information or personal data.

Prepare the SquashFS Filesystem

SquashFS is a compressed read-only file system. We’ll create a SquashFS image of the live system:

   sudo mksquashfs ~/livecdtmp/livefilesystem.squashfs ~/livecdtmp/

Create ISO Directory Structure

   mkdir -p ~/livecdtmp/ISO/casper

Move the SquashFS Filesystem to the ISO Directory

   mv ~/livecdtmp/livefilesystem.squashfs ~/livecdtmp/ISO/casper/

Copy Bootloader Information

This step will vary based on your bootloader. Assuming you are using GRUB:

   cp /boot/grub/grub.cfg ~/livecdtmp/ISO/boot/grub

Modify GRUB Configuration** (if necessary)

If you have custom boot parameters or specific kernel options, you’ll need to edit the grub.cfg file appropriately.

Create the ISO File

Navigate to the ISO directory:

   cd ~/livecdtmp/ISO/

Now, use genisoimage to create the ISO:

   sudo genisoimage -r -V "LiveSystem" -cache-inodes -J -l -b boot/grub/grub.cfg -c boot/grub/ -no-emul-boot -boot-load-size 4 -boot-info-table -o ../livesystem.iso .

This command will create an ISO named “livesystem.iso” in the ~/livecdtmp directory.


Remove the temporary directory:

   rm -rf ~/livecdtmp

Test the ISO

You can use virtualization software like VirtualBox or QEMU to test the newly created ISO to ensure it boots correctly.

This is a basic guide, and there may be additional steps or modifications needed based on the specifics of your system and requirements. Always test the ISO in a safe environment before using it for any critical applications.

This post is licensed under CC BY 4.0 by the author.