Create A LiveCD Media

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
339
Reaction score
369
Credits
11,689
Nearly everyone using Linux has come across a LiveCD of some type. If you haven't, a LiveCD is an ISO file that can be burned to a USB or CD and booted from to create a running version of Linux in RAM. This means you can use the Linux Distro in RAM and not install it.

You can also make an image to install to a hard disk. The process will allow you to install specific programs into the image. When Linux is installed you will have all of the custom programs already installed. Having the custom programs lets you perform Linux roll-outs on a large scale with pre-installed apps for public systems. The systems will revert to what they were when booted. No data can be saved to the storage media. You can create the LiveCD with the apps. You can then perform one install on each system and not have to install Linux and then each application you require. You will be able to save quite a bit of time overall. You can also keep the image active in a virtual machine to update the LiveCD as needed and create a new ISO after each update.

Create a Linux System

First, you need to install VirtualBox and choose your Linux Distro. The VirtualBox Storage should be ‘Dynamic’ and set to 10 GB.

NOTE: You can find instructions for VirtualBox at https://linux.org/threads/lfcs-os-in-virtualbox.4465/. For the distro you want, you need to go to the specific website for the distro and download the ISO. Instead of using VirtualBox you can install your distro on a hard disk and follow the instructions as if you were running a virtual system.

NOTE: After installation, you will want to perform software updates. I strongly suggest using VirtualBox to do these procedures.

Once you have Linux installed under VirtualBox (or a hard disk), you can start Linux. The main issue some may have is that to create a LiveCD your Linux Kernel must support AUFS. To check if your Kernel supports it you need to run the following command in a Terminal:

Code:
grep aufs /proc/filesystems

If you get a response that does not include ‘aufs’ then your kernel does not support it. If your kernel does not support ‘aufs’ then you will need to update your kernel or even build your own.

NOTE: At this point most newer Linux Kernels support ‘aufs’.

The next step is to install ‘squashfs’. ‘Squashfs’ is a compression utility that supports both files and folders. To install it open a Terminal and use the commands:

Code:
sudo apt update
sudo apt install squashfs-tools

You may not need to perform an update if you selected to install updates during the Linux installation, but it won’t hurt to do it again.

NOTE: You can open a Terminal and type the command ‘mksquashfs’. If you get a long listing of parameters for ‘squashfs’ then it is already installed.

At this point, you can add or remove any software. Keep in mind that any software you add will be on the LiveCD. Remove all software that is not necessary to be on the LiveCD.

You can change any of the System Settings that need to be set on all systems. The wallpaper can be changed to a specific logo along with other tweaks specific to your roll-out. You can delete the files in ‘/tmp’ if you want to save space. You can also perform a reboot to make sure all changes are set and saved as needed. Make sure your new settings are retained after the reboot.

NOTE: Tweaks can include the configuring of programs such as the Internet Browser and other applications.

Creating the Image

Since everything is set as you like, it is time to make the image file.

Go to https://github.com/Tomas-M/linux-live form the Linux Distro of which you want to make an image. You can download it in the Virtual System or from the Host. If you do copy it to the Host then you can set up a Shared Folder and copy it to the Virtual System.

NOTE: If you do download the file on the Host system and intend to copy it across to the Virtual Machine you will need the Guest Additions. You will want to install the Guest Additions after the ISO file has been generated.

Once you are on the https://github.com/Tomas-M/linux-live page you can click the ‘Clone or download’ button then click ‘Download ZIP’. Save the file in the ‘/tmp’ folder. Once it has completed downloading you can extract it in the same folder.

At this point, you need to clean up the system so there are no unneeded files which will be included in the image. My suggestion is to use BleachBit, which can be found at https://www.bleachbit.org/download. Run BleachBit and let it remove all unnecessary files. Be careful that if it cleans out the ‘/tmp’ file that you have the ‘linux-live-master’ folder or you may need to download it again.

Before creating the image you need to close all open programs. Any programs could continue to create or change files on the hard disk during the image creation.

Open a Terminal and perform the following:

Code:
cd /tmp
cd linux-live-master
sudo ./build

The first line changes the current folder to ‘/tmp’. The second will move into the extracted folder of the downloaded files. The last line will start the creation of the image which can take some time depending on your system.

When the script starts you will see something similar to Figure 1.

Figure 01.jpg

FIGURE 1

Once the process has completed you should see output similar to Figure 2.

Figure 02.jpg

FIGURE 2

Using the Image


If you want an ISO image you need to run the command ‘/tmp/gen_linux_iso.sh’. The script will convert the Squashfs image to an ISO file. The ISO file will be ‘/tmp/linux-x86_64.iso’. You may start getting warnings of low disk space if you only made you Virtual Disk 10 GB.

You may need to take permission of the ISO file if you want to move it. Use the command ‘chown user:user linux-x86_64.iso’. Change the ‘user:user’ to your username. My ISO file is around 1.9 GB in size. I only installed one extra application but made quite a few tweaks to the system.

NOTE: At this point, you will want to install the Guest Additions so you can copy the ISO file off of the Virtual Machine if you are using one.

I will extract the ISO file to USB Stick. You can use any type of Archive program which can open an ISO file. Format your USB Stick or Hard Drive as EXT4. Extract the folders and files to the media you have chosen. The root folder of the media should be a folder named ‘linux’,

NOTE: Do not use a program like ‘BalenaEtcher’ to place the ISO image on the media. The program will format the media as an unusable format.

Open a Terminal and change to the ‘linux’ folder and then the ‘boot’ folder on the media. From the command-line type the command ‘sudo bash ./bootinst.sh’. You should see a line appear showing the device name of the media. A few minutes will pass and you should see a response ‘Boot installation finished.’.

You can now boot from the media.

The media works as an Operating System (OS) with no persistence. This means that any changes made to the OS will not be stored when the system is rebooted.
 



Staff online

Members online


Top