Build your own custom Ubuntu distro
Linux Format|November 2021
Why settle for what the existing distributions have to offer? Michael Reed looks at Cubic, a tool for creating your own custom respin based on Ubuntu.
Michael Reed

QUICK TIP

When you modify an Ubuntu distribution that makes use of a live CD environment, using Cubic, you’re also modifying the live environment. This means that Cubic is perfect for making a bootable ISO with some extra tools on it. All you need to do is select ‘Try Ubuntu’ when it starts up.

QUICK TIP

There are a lot of Linux utilities for remixing an existing distribution floating about, but we found that most of them aren’t maintained! This means that they only work properly with distributions that are now out of date. Even if they seem to work, chances are they’ll fall over halfway through the process or what they produce won’t work properly.

Part of the beauty of Linux is the freedom of deployment that distributions offer, but when installing it for yourself or others you’ll want to change things. So, why not make your own version, or ‘respin’? That’s what a tool called Cubic is for, and we’re going to look at how you use it to modify the standard Ubuntu installation ISO and bend it to your will in terms of content and aesthetics.

As for the difficulty? If you can install packages from the command line and boot from an ISO in a virtual machine, you should find it easy to get started with Cubic as the defaults were always usable in our experience. We’ll start with the simplest example of just adding some new packages and rebuilding the ISO. This modified ISO can be used as an installer or as a live desktop environment.

Once that’s working, we’ll show you how to customise it further by making LXDE the default desktop environment, customising that environment and adding some PPAs so that it really does feel like its your own personal spin on how Linux should look and work.

Install Cubic

Cubic expects to run under Ubuntu or Linux Mint or one of their derivatives. If you are running a different distribution, you can still use Cubic and follow this tutorial by running Ubuntu in a VM. Begin by installing from PPA. To do this, locate the Cubic page on Launchpad (https://launchpad.net/cubic) and follow the instructions by cutting and pasting the needed commands from that page.

sudo apt-add-repository ppa:cubic-wizard/release adds the repository to your system. sudo apt update updates the system so that it can see contents of the Cubic PPA. sudo apt install --no-install-recommends cubic mn adds Cubic itself. Other than that, the installation should then take care of itself in terms of dependencies.

The next step is to obtain an up-to-date Ubuntu installation ISO to work with. We’ll use Ubuntu 21.04, but 20.04 LTS (Long Term Service) is a good choice as well. Launch Cubic in the normal way that you launch GUI apps or load it in a terminal window for extra progress information. When running, Cubic requires no super-user privileges, unlike some tools of this sort. The first page of the Cubic user interface enables you to specify the project directory. Cubic doesn’t run any tests for free space itself, and you’ll need quite a lot of space for the uncompressed ISO. The Ubuntu Desktop installation ISO may weigh in at around 2.7GB, but its actual content is about double that as it’s compressed using Squashfs. We’d recommend having at least 20GB free before you begin using Cubic.

The decompressing and recompressing of an ISO is rather time-consuming and an SSD works faster than a mechanical hard drive for this task. One way of speeding things up is to leave the project directory intact between different build attempts.

This way, the decompression stage of the process only has to be carried out once, and you keep the changes you’ve already made. Delete the folder and start again if you want a true fresh start at modifying the ISO.

Having specified the working directory for the project, press Next to proceed to the next page, the Project page. Click the icon next to the filename field and specify the base ISO that you plan to use as your starting point for customisations. Once you’ve done that, most of the fields on this page will be filled in automatically, but you can safely change things like the release name and the name of the output ISO.

Click next to move on to the Extract page. You don’t have to do anything on this page, but be warned that it might be a good time for a quick tea break, as extraction can take a few minutes. Once this is complete, you can open the same directory again in the future. Once you’ve extracted the files from the ISO, you can quit the application at any time as long as you don’t interrupt an operation that is in process, and this means that you don’t have to complete the customisation in a single session with the program.

The Terminal page

Without doing anything else, you’ll be moved onto the next page, the Terminal page, and this is where we’ll be spending a lot of our time. Cubic employs some Linux wizardry (a chroot terminal) to give you a virtual terminal that operates on the filesystem that will later be rolled into an installation ISO.

In general, most customisations that you can carry out from the command line on a running Linux system can be done from here, and you can use familiar tools, such as apt, to carry them out. More advanced customisation can get quite technical, but on the positive side, there is practically no limit to the changes you can make. Note that we can cut and paste commands into the window. There is also a copy icon at the top of this window, and this allows you to copy files and folders into the currently selected directory.

Continue reading your story on the app

Continue reading your story in the magazine

MORE STORIES FROM LINUX FORMATView All

Zephix 3.0

A fan of portable, modular distros, Mayank Sharma runs across a relatively new one and wonders how it stacks up against his all-time favourite: Slax.

3 mins read
Linux Format
December 2021

Whonix 16

Mayank Sharma is a busy man, but when it comes to privacy and security then, like Louis Armstrong, he has all the time in the world.

3 mins read
Linux Format
December 2021

UBUNTU VS FEDORA

Jonni Bidwell wants to know everything – and he means everything – about the two most popular Gnome-based distros…

10+ mins read
Linux Format
December 2021

SERIAL PERIPHERAL INTERFACE: Driving SPI displays

Let’s go on an adventure into the SPI protocol, LCD displays and model trains with Sean Conway toot-tooting away!

5 mins read
Linux Format
December 2021

Sensor and motor control with the GPIO

Les Pounder shows how we can take Scratch further with a community-developed tool that builds on our Scratch knowledge.

7 mins read
Linux Format
December 2021

LICENCE TO BILL

Jonni Bidwell has been reading licence minutiae and fears big business threatens the future of copyleft and software freedom.

10+ mins read
Linux Format
December 2021

Devuan GNU+Linux

The backlash against Systemd resulted in this sysvinit-friendly distro, now on version 4. Mayank Sharma assesses its progress.

3 mins read
Linux Format
December 2021

AUTOMOTIVE GRADE LINUX

Mats Tage Axelsson shows how open source frameworks and Linux can help navigate you safely to your coding destination.

10+ mins read
Linux Format
December 2021

Atari VCS

Monetising nostalgia should be an easy win for Atari so Matt Safford can‘t believe it’s created another E.T.

3 mins read
Linux Format
December 2021

How To Create Efficient Backups

Backups aren’t just a safety net for Trekkies such as Shashank Sharma, but a way of life. But they can take up quite a lot of space if not done right…

6 mins read
Linux Format
November 2021