How to Create Custom Live CD image using Cubic on Ubuntu

We have the possibility to discover Ubuntu systems with the live mode which simulates the system as if it was installed. The system even not installed has some basic packages that you can use directly. But you can need to use some other tools which are not presents, so you will need to install it. It means that you might want to make your own customized Ubuntu to use in your business, or for your personal needs, or make your own ultimate rescue Ubuntu for performing rescue and recovery tasks. You can create your custom live image of Ubuntu 18.04 by using Cubic tool.

What is Cubic?

Cubic for Custom Ubuntu ISO Creator is a GUI application to create a customized bootable Ubuntu Live CD (ISO) image. Cubic integrates a command-line chroot environment that can be used for customization, such as installing new packages, adding additional files (background images, etc) and folders during the process.

To start the process with cubic you will need to create a directory for the project. During this process, cubic creates a squashfs-root folder that weighs a bit too much when you choose to don't delete the iso project at the end in order to be able to modify it later. It's just approximatively 4 Go so make sure to have at least 7 Go free space on the partition/disk which will store the project.

1) Install and launch cubic

You can install cubic on Ubuntu 18.04 to create your customized image of your Ubuntu. It is not present by default in the repositories so you need to add the ppa and update the sources

# apt-add-repository ppa:cubic-wizard/release
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6494C6D6997C215E

Now you can update and install

# apt update && apt install cubic

Now you can launch cubic from the dock

Now you can start with the steps to customize your iso.

2) Customize your live CD

When cubic starts, you will need to choose a directory for your new project. It is the directory where your files will be saved. You should notice that you can have multiple customization projects but each project should be into its own directory. In our case, it is the isoproject folder

Cubic will create a custom live cd from an Ubuntu installation cd that you will use and not a live cd of your system. You will see some information on the new project page will be automatically filled out for you. On the "Original Iso" section, the information that you see is relative to the original ISO image and can not be changed, just select the ISO path but you can edit some information on the "Custom iso" section

On the next page, you can see the compressed Linux file system will be extracted from the ISO source to the custom ISO project’s directory

Now cubic will show you the chroot environment where you can install personalize your ISO by installing some packages

Now you can start downloading new packages. You can face the DNS lookups which may not work in the chroot environment so the custom live cd doesn't have some valid network files to access on the internet. You can try the ping command on a domain name. You can try an update. You will that it can not resolve the domain name.

# ping www.google.com
# apt update

You can see that the file /etc/resolv.conf points to /run/systemd/resolve/stub-resolv.conf which does not exist.

You can see that we don't have a result while listing any file that the name starts with st in /run/systemd/resolve/ folder

To resolve it, we will create a new link of stub-resolv.conf

# ln -sr /run/systemd/resolve/resolv.conf /run/systemd/resolve/stub-resolv.conf

Then you can check with the ping command on a domain name

Now we can install some packages that we will need such as vim or lamp or whatever you think

# apt install vim

You can also decide to install lamp on your live cd

Ubuntu 18.04 comes with kernel 4.15 but you can decide to use an old version such as 14.13 for example. You will need to create a folder to download all the kernel packages

# mkdir kernel-4-13 && cd kernel-4-13
# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb
# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb

Then you can install all the packages

# dpkg -i *.deb

On the next page you can choose the default kernel to use when booting the custom live iso. you can always come back to the terminal environment of the project for additional customizations

On the next page, you will be asked to select the packages that you want to remove from your live image.The packages with a check mark next to them are flagged to be automatically removed. Those packages will be automatically removed after the custom Ubuntu OS will be installed using the custom live image. Be careful when selecting the packages to remove, because additional dependent packages may also be removed, and these will not be indicated in the list. So you can just accept the recommended defaults on this page.

For example I don't need some packages language because I will never use it so I will mark them to be removed.

Now, the live image creation process will start. It will take some time depending on your system’s specifications. When the image creation process will be completed, click Finish. Cubic will also generate an MD5 checksum file that can be used to verify your customized iso file.

After you can see that the process is completed

If you want to modify the newly created custom live image in the future, uncheck the option which will appear saying “Delete all project files, except the generated disk image and the corresponding MD5 checksum file”

Now you can try your custom live cd. To be sure that your customization worked fine, check the packages that we have installed such as apache. You know that it not installed by default

Now you can check php

Now you see that your custom live cd is ready to be used.

Read also :

Conclusion

You can need to customize an ISO cd depending on your needs. You can use a disk burning program such as Brasero to burn a copy of the new live ISO or, you can use a USB boot program such as Startup Disk Creator to create a bootable USB. To create a new live image for different Ubuntu versions, you can use a different project directory.

Alain Francois 12:05 am

About Alain Francois

IT Linux administrator passionate of free and open source software, I work on Linux Systems since some years on installations and deployments of certain solutions. I like to share my experiences with a wider audience by training and conferences.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.