Categories
Design

How to customize your ubuntu kernel

Don’t adapt to what you got with the installation, simply customize targeting your productivity instead.

How to customize your ubuntu kernel

How to customize your ubuntu kernel

People use different types of operating systems based on what they do and their preferences. The majority of die-hard fans use their first operating system forever even though it has some drawbacks. Meanwhile, some people switch operating systems so often until they find the best one for them. Also, a few persons do a quick research about the history of operating systems and the modern state of those to find the best matching operating system for them. I used many versions of Windows for 10 years and switched completely to Ubuntu around 2 years ago.

Before switching to Ubuntu, I did a small research about the Linux kernel and eventually became a fan of Linus Torvalds, the creator of the Linux kernel. The GUI of an operating system initially shows us the default configuration that was made for a general-user by its developers. For example, Ubuntu has its navigation icons set (also knows as the dock) on the left of the screen, and also the top bar is visible all the time. I also didn’t like the default UI configuration of Ubuntu because it didn’t give the productive workspace I expected. I think for most users who have a Windows background, it’s a bit unfamiliar. I did the following customization in the GUI using the GNOME Tweaks application and some extensions to boost productivity for programming on Ubuntu.

How to customize your ubuntu kernel

The default configuration had fixed large icons on the left of the screen wasting the available workspace. When it comes to any work such as coding and reading, the larger workspace gives better productivity. Therefore, I moved the dock to the bottom and also minimized the icon size to 20 pixels to expand the workspace. Thereafter, sorted icons according to the usage by dividing all icons into two segments. In other words, leftmost and rightmost things are frequently used, but applications in the center are not. For example, I often take quick screenshots, therefore its icon is placed near the right corner. On the other hand, the application launcher of the VLC media player resides in the center.

This configuration of the dock gave a great productivity boost rather than the default setup of the dock because it saved so much area for the workspace and also horizontal navigation is more comfortable with the mouse.

How to customize your ubuntu kernel

The default top bar is also an obstacle when we do some actions with the title bar of a particular window. Further, it also covers up the workspace by pushing all content down. I hid the top bar using a GNOME extension. Now, it doesn’t even annoy me when I point the cursor into the top of the screen because I just used the F10 hotkey to toggle the top bar. Because I use the top bar often only to check the current time. Besides, I just press and hold the power button for a second to open the menu to turn off the laptop.

This customization also gave a fresh minimalist environment for work because the workspace doesn’t have rarely-used elements such as the network and power menu section.

Native applications are undoubtedly better than hybrid applications which often become bloatware. I believe that I only use 2 hybrid applications: Skype and vscode. There are no better native alternatives for those applications. When the performance of your computer decreases, your productivity also decreases since each user-action may lag for an additional time. Moreover, hybrid applications will drain your laptop’s battery faster than native applications do. Therefore, it is always better to choose native software over hybrid software.

I use Slack but I don’t use its desktop app because it is also yet another hybrid application. I already installed Google Chrome and made it the default browser. So, why do I need to download another web browser just to wrap a web application? Similarly, I always prefer cloud applications first before installing any kind of standalone software. Then, we don’t need to waste our time cleaning unwanted software on our computers frequently. The following piece of writing will explain more about the drawbacks of hybrid software.

@lowellheddings
December 27, 2006, 9:17am EDT

Kernel customization is not for everyone. Please note before you try any of this that it can break your system.

There’s a bunch of reasons that you’d want to customize your kernel. You may want to trim down your kernel to only the necessary services, especially if you are running a server or dedicated device that only requires the essentials. You also may need to patch your kernel to support hardware that isn’t currently supported with the kernel you are running on.

This article will not explain how to patch your kernel, just how to customize your current one. I’ll have another followup article that explains how to patch your kernel, and some practical reasons why you’d want to do so.

To start, we need to figure out what version of the kernel we are currently running. We’ll use the uname command for that

Now we need to Install the linux source for your kernel, note that I’m running the 2.6.17-10 kernel, so the installer line reflects that. For the purposes of this article, you can substitute the kernel number for whatever you are running. We also need to install the curses library and some other tools to help us compile.

sudo apt-get install linux-source-2.6.17 kernel-package libncurses5-dev fakeroot

If you are curious where the linux source gets installed to, you can use the dpkg command to tell you the files within a package. Here’s the output on my system:

$ dpkg -L linux-source-2.6.17
/.
/usr
/usr/src
/usr/src/linux-source-2.6.17.tar.bz2
/usr/share
/usr/share/doc
/usr/share/doc/linux-source-2.6.17
(trimmed)

We can see that the source has been installed to the /usr/src directory in a zipped file.

To make things easier, we’ll put ourselves in root mode by using sudo to open a new shell. There’s other ways to do this, but I prefer this way.

Now change directory into the source location so that we can install. Note that you may need to install the bunzip utility if it’s not installed. (it was on mine)

tar xvf linux-source-2.6.17.tar

ln -s linux-source-2.6.17 linux

Make a copy of your existing kernel configuration to use for the custom compile process. Note that the ` character is the one below the tilde

Now we will launch the utility that will let us customize the kernel:

First, go down to Load an Alternate Configuration File, and load the .config file. (just hit enter)

Now that we are inside the utility, we can set the options for our custom kernel. Navigation is pretty simple, there’s a legend at the top if you get lost. I decided to select Networking and hit the Enter key to go down into that category.

How to customize your ubuntu kernel

Amateur Radio Support? What in the hell is that installed for? You’ll note by the * that it’s built-in to the kernel.

How to customize your ubuntu kernel

By pressing the ? key, we can see the help for that particular item. Here’s the explanation:

How to customize your ubuntu kernel

Well, I’m going to disable that immediately. Why on earth is that installed in my kernel anyway? I hit Esc to exit the help screen, and then hit N to exclude that from my kernel.

When you are finished making whatever choices you want, hit Exit and save the configuration when prompted.

Now we have a configuration ready for compile. First we’ll do a make clean, just to make sure everything is ready for the compile.

Next we’ll actually compile the kernel. This will take a LONG FREAKING TIME, so go find something interesting to do.

fakeroot make-kpkg –initrd –append-to-version=-custom kernel_image kernel_headers

This process will create two .deb files in /usr/src that contain the kernel. The linux-image**** file is the actual kernel image, and the other file contains the You can install both with dpkg. The filenames will probably be different on your system.

Please note that when you run these next commands, this will set the new kernel as the new default kernel. This could break things! If your machine doesn’t boot, you can hit Esc at the GRUB loading menu, and select your old kernel. You can then disable the kernel in /boot/grub/menu.lst or try and compile again.

dpkg -i linux-image-2.6.17.14-ubuntu1-custom_2.6.17.14-ubuntu1-custom-10.00.Custom_i386.deb

dpkg -i linux-headers-2.6.17.14-ubuntu1-custom_2.6.17.14-ubuntu1-custom-10.00.Custom_i386.deb

Now reboot your machine. If everything works, you should be running your new custom kernel. You can check this by using uname. Note that the exact number will be different on your machine.

I plan to write a series of articles on kernel customization, so subscribe to the RSS feed for updates.

Also, In the interests of full disclosure, I learned how to do this from the article at HowtoForge, which is a great website for some very advanced tutorials on linux. You’ll note that many of the steps in this article are similar, although I tried to make this article more “Ubuntu”.

1. Overview

Building a bespoke image for a supported platform enables an Ubuntu Core device to be customised at the point of deployment. Customisation options include configuration for both hardware and software, specific kernels, and which snap packages to pre-install.

We are going to create an image, first by generating our own authority keys, then making the snap store aware of them, then creating and signing a model assertion before building the image.

This document will walk you through all the steps to build an image for an x86 device, but the same instructions will work for other platforms.

What you’ll learn

  • Different fundamental snap notions on the board, like gadget, kernel and core snap
  • Assembling a kernel and gadget snaps
  • Creating and using your authority keys
  • Create a model assertion for your target device
  • Compose and build a custom image using the ubuntu-image command

What you’ll need

  • Ubuntu 18.04 LTS desktop. You can’t do this on an Ubuntu Core device directly as creating your image can take quite some disk spaces. A VM can work as well.
  • A Snap Store account to register your authority keys
  • Some very basic knowledge of command line use, know how to edit files.

How will you use this tutorial?

    Only read through it Read it and complete the exercises

What is your current level of experience?

    Novice Intermediate Proficient

2. Getting started

To build a custom image, first use the snapcraft command to login to the Snap Store:

Snapcraft can be installed with sudo snap install snapcraft –classic , see Snapcraft overview for further details, and visit Create a developer account if you don’t yet have an account.

Before creating a custom model assertion, you will need to retrieve your developer ID and generate a properly formatted timestamp. The snapcraft command can be used to retrieve your developer id:

Use the following date command to output the correctly formatted timestamp for the model assertion:

3. Custom model assertion

The following is a tweaked JSON-formatted custom model assertion based on
ubuntu-core-18-amd64:

We’ve saved the above example in a file called my-model.json , and it contains the following modified properties:

  • base : provides the run-time environment
    core18 is the current standard base and as is built from Ubuntu 18.04 LTS. See Base snaps for more details.
  • authority-id , brand-id : defines the authority signing the assertion
    reference assertions are signed by canonical . Non-reference assertions are
    signed by their brand store. For a custom model
    assertion, this needs to be the developer ID.
  • timestamp : UTC formatted time and date
    used to denote the assertion’s creation time.
  • required-snaps : one or more snaps to be pre-installed for deployment
    any snap can be listed here. If there’s a dependency on a different base, such as core, this will be installed too.

For a complete list of model assertion keywords, see Model assertion.

4. Signing a model assertion

The difference between building an image from a reference model assertion and
building from a modified model assertion is that the modified model assertion needs to be digitally signed. This is accomplished in four stages:

  1. create a key
  2. export/register the key
  3. sign the model assertion
  4. build the image

First, sign in to the Snap Store (snap login) and check whether there is already a published key available. You can list any published snaps with the snap keys command:

If you have no registered keys, create one as follows:

With a key created, use the snapcraft command to upload and register it with the store:

A custom model assertion is signed by piping the assertion through the snap sign command with the key name as its sole argument:

The resulting my-model.model file contains the signed model assertion and can now be used to build the image.

5. Building the image

With a signed model assertion, the Ubuntu Core image can now be built just like a reference image, using the ubuntu-image command. First, install ubuntu-image if it isn’t already installed:

You can now use ubuntu-image to build the image:

The output includes the img file itself, alongside seed.manifest and snaps.manifest files. These manifest files simply list the specific revision numbers for the snapd, pc, pc-kernel and core snaps built within the image.

6. Testing the image

You can now test the resulting image. Using QEMU, for instance, the following command will boot the image inside a VM and forward (SSH) port 22 to 8022 on your machine:

After running through the Ubuntu Core network setup and entering your account details, you will be able to SSH to your new Ubuntu Core deployment:

You are now connected to the Ubuntu Core virtual machine, from where you can configure and install whatever apps you need.

From within a running session on a custom image, you can run the pre-installed
snaps:

Use snap list to see which snaps are installed:

The snap known model command will show the read-only custom model assertion used to build the image:

7. Congratulations!

You now have your own device image file for your specific device. This image is easily flashable on any SDCard or eMMC and can be booted right away.

You should by now be familiar with the various snaps composing an Ubuntu image: Core snap, kernel, gadget. You know that snapd is using a model assertion to define all pieces composing an image and this is what is used to build the image via the ubuntu-image tool.

Finally, you know also that you can change those default snaps, and add more applications snaps as you require them. If you produce your own gadget or kernel snap, you can swap as well default ones and enable a new board that way.

Next steps

  • You should flash your new image to your device to test how it behaves
  • Join the snapcraft.io community on the snapcraft forum.
  • Take a look at the Ubuntu Core documentation

Was this tutorial useful?

Thank you for your feedback.

© 2020 Canonical Ltd.
Ubuntu and Canonical are registered trademarks of Canonical Ltd.
Powered by Charmed Kubernetes

The default GNOME desktop in Ubuntu can be customized in many ways. There are many available GTK and icon themes which you can easily apply and transform your daily driver desktop to a different look without losing performance and productivity.

In this guide, I will apply one icon theme on top of the earlier customization we did for GNOME. If you are trying to configure the GNOME desktop look from a stock Ubuntu installation you can follow the below guide step by step.

Customize GNOME Desktop in Ubuntu

To Customize GNOME Desktop in Ubuntu in this guide, you need to enable GNOME Extensions, install GNOME Tweaks. You can do both with these quick steps.

Enable Ubuntu for GNOME Extensions

Open Firefox and visit the official GNOME Extension page here. You can get a popup message at the top saying the steps. Follow the instructions to enable GNOME extensions for your browser.

Install GNOME Tweak Tool

To install the GNOME Tweak Tool. You can use Ubuntu Software to install Or, run below from the terminal.

Install Extensions

Then, install all the below extensions. Open the link and click on the “OFF” at the right side of the page button to enable and install respective extensions.

Not all these GNOME Extensions require configurations. We will configure the Dash to Panel, Open Weather, Arc Menu.

Configure Dash to Panel

After installation, the Dash by default moves to the bottom of the screen. Right, click on the panel at the bottom and open ‘Dash to Panel Settings’. Change the below settings.

On the Position Tab

  • Disable the Show Applications Button
  • Move the Date menu after the System menu
  • Change Desktop button width to 15px.
  • Turn on the override panel theme background opacity. Give value to 50%.

On the style tab

  • Change the running indicator style to dots.

Configure Open Weather

Change the display, City, and temperature unit if you like.

Configure Arc Menu

Open Arc Menu Settings

General Tab

  • Choose Display Arc menu on Dash to panel.
  • Choose Hot Key for Arc menu to Left Super key.

Menu Layout Tab

  • Choose Modern menu layout to Redmond Menu Style

Menu Theme

  • Choose the override menu theme. Keep the theme as default, or, you can change as you wish.

Button Appearance

  • Change the icon to anyone. I have selected the Ubuntu icon.
  • Change Icon size to 40px.

Additional Configurations

Open the GNOME Tweak tool and go to the Appearance tab. Choose Shell theme to Yaru Dark.
Open Settings and change the Appearance to Dark.

Configure Icons

In this guide, I have used the “BeautyLine” icon theme which you can download from the below link. This icon theme has a distinct and bright look and available icon sets for almost all generic applications. Once you apply, the overall desktop looks more focused on the dark theme backdrop.

Once downloaded, extract the file. Then copy the top-level folder ‘beautyline” to the /usr/share/themes .

  • Open GNOME Tweak tool
  • Go to the Appearance tab
  • Change the Icon to BeautyLine
  • Change the cursor to White glass.

Configure Wallpaper

For this guide, I have used the “GNOME AGAIN” wallpaper. You can use any dark themed wallpaper of your choice.

If all goes well, your desktop should look like this.

If you do not want to customize more, simply apply the Icons and set the Ubuntu’s default Dark mode, your desktop still looks nice (see below).

This is just a guide and outlining the settings. You can play around with many settings of Arc Menu and GNOME tweaks settings to make it more personalized for you. You can even apply many GTK3 icon themes or shell themes as well.

We bring the latest happenings in the Linux universe, app reviews, tutorials, easy to understand guides for you. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

At the core of the Ubuntu operating system is the Linux kernel, which manages and controls the hardware resources like I/O (networking, storage, graphics and various user interface devices, etc.), memory and CPU for your device or computer. It is one of the first software programs a booting device loads and runs on the central processing unit (CPU). The Linux kernel manages the system’s hardware environment so other programs like the operating system’s user space programs and application software programs can run well without modification on a variety of different platforms and without needing to know very much about that underlying system.

How to customize your ubuntu kernel

Identifying a kernel

The easiest way to determine the kernel you’re running is to type cat /proc/version_signature on the terminal. For example:

Ubuntu 5.4.0-12.15-generic 5.4.8

This output provides important information about the kernel:

  • Canonical adds ” Ubuntu
  • Ubuntu kernel-release = 5.4.0-12.15-generic
    • kernel version is 5.4 , which is identical to upstream stable kernel version
    • .0 is an obsolete parameter left over from older upstream kernel version naming practices
    • -12 application binary interface (ABI) bump for this kernel
    • .15 upload number for this kernel
    • -generic is kernel flavour parameter, where -generic is the default Ubuntu kernel flavour
  • Mainline kernel-version = 5.4.8

Kernel and OS releases

Canonical provides long-term support (LTS) kernels for Ubuntu LTS releases. Canonical also provides interim operating system releases with updated kernels every 6 months.

For customers and business partners that don’t have specialised bleeding-edge workloads or latest hardware needs, the latest LTS release “-generic” kernel is the best option for them such as the 4.15 default kernel in Ubuntu 18.04 LTS. Customers who need the latest hardware support capability can install the latest HWE kernel such as the ones contained in interim releases, keeping in mind the shorter support lifespan associated with these kernels (9 months). HWE kernel customers are recommended to upgrade to a newer LTS release that supports their hardware and/or software needs as soon as it is available. Another option for customers is to use point releases. For example, there is an 18.04.4 point release as of February 2020, which includes an updated 5.3.x kernel but is also considered LTS, exactly like the original GA 4.15 kernel in 18.04.

Kernel security

The Canonical Kernel Team’s primary focus is the careful maintenance of kernels and their variants for regular delivery via the Ubuntu SRU process. This includes rigorous management of all Linux kernel Common Vulnerabilities and Exposures (CVE) lists (with a focus on patching all high and critical CVEs) review and application of all relevant patches for all critical and serious kernel defects in the mailing lists and then rigorously testing newly updated kernels end-to-end each SRU cycle.

General Availability (GA) and variant Ubuntu kernels

The complete functionality of any given kernel is determined by the included modules and the kernel configuration for both hardware and the expected workloads that are run on it.

Kernel modules are binary programs that extend a kernel’s ability to control the computing system’s hardware or add additional system capabilities like high-performance networking or non-standard graphics, etc. The GA kernel that is shipped by default, with the Canonical Ubuntu Long Term Support (LTS) and Hardware Enablement (HWE) releases, are tuned for stable, reliable, secure, high-performance operation over a wide variety of hardware platforms and workloads.

A kernel variant is a kernel that deviates from the generic GA kernel by changes to its configuration, and/or by having modules added and/or removed.

Custom kernels

Canonical advocates for customers to use the GA kernel shipped with Ubuntu as the best and most cost-effective option in their business environment. We also offer the option for customers to customize their own Ubuntu kernels. Several of our enterprise, Telco and cloud provider customers have systems and workload needs, which justify both the time investment to optimise their kernels and the pay to develop and maintain those custom kernels over time.

© 2020 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.

Expert Aproved
Technical writer Approved
Maintainer Approved

Contents

  • 1 Prerequisites
  • 2 Updating the kernel configuration
    • 2.1 Saving the current configuration
    • 2.2 Creating a new kernel configuration
    • 2.3 Testing the new kernel configuration
    • 2.4 Applying the newly generated kernel configuration
  • 3 Changing the kernel command line
  • 4 Changing the Device Tree

1 Prerequisites [ edit ]

The environment must be installed using the Distribution Package adapted to your microprocessor device. See the list of Android Distribution Package.

Get the kernel sources as explained in How to build kernel for Android.

To execute the following instructions, go to your distribution root directory and initialize your environment as follows:

The bspsetup command needs to be run only once for the distribution

2 Updating the kernel configuration [ edit ]

The kernel configuration file used is merged between the following files (this operation is performed at the beginning of the kernel build process):

By using menuconfig , you can adapt the configuration file to your needs. Some guidelines are given below.

2.1 Saving the current configuration [ edit ]

Before changing the kernel configuration, it is recommended to build the kernel using the current configuration:

A default config file named defconfig.default is generated in out-bsp/ STM32Series > /KERNEL_OBJ/ directory.

2.2 Creating a new kernel configuration [ edit ]

You can load a .config file and modify any entry using this interface. Instructions on how to navigate are provided at the top of the windows.

Do not forget to click save.

This generates a .config file located in out-bsp/ STM32Series > /KERNEL_OBJ/ , as well as a defconfig file at the same location.

2.3 Testing the new kernel configuration [ edit ]

To test the new configuration, rebuild the kernel, update the prebuilts and flash, as explained in How to build kernel for Android.

2.4 Applying the newly generated kernel configuration [ edit ]

To make your change permanent, first compare the new defconfig file with the defconfig.default file generated at first build.

You can use a graphical tool such as meld .

Then report the changes into the android-soc.config file located in device/stm/ STM32Series > -kernel/source/kconfig/ / .

Eventually force the regeneration of the .config:

Note: the defconfig.default is then updated.

To test your configuration, rebuild the kernel and update the prebuilts and flash, as explain in How to build kernel for Android.

3 Changing the kernel command line [ edit ]

You can customize the kernel command line call at boot time. The arguments are defined in the BoardConfig.mk file located in device/stm/ STM32Series > / BoardId > / .

Adapt the value of the BOARD_KERNEL_CMDLINE variable to your needs.

Rebuild the bootimage to apply the changes:

Then flash the boot partition:

Check the “command line args” value from the output: it must match your changes.

4 Changing the Device Tree [ edit ]

The kernel device tree used is set in the dt.mk file available under the device/stm/ STM32Series > /build/tasks/ directory. For more information refer to the Device tree and How to create your board device tree pages.

The device trees are located inside the Linux ® kernel source code previously loaded. A Device Tree can be modified directly in device/stm/ STM32Series > -kernel/linux- STM32Series > /arch/arm/boot/dts .

Once the Device Tree has been modified, rebuild it:

Then flash again the DT partition.

eval,disco (Generic term used, to complete configuration modules paths depending on used board)

Expert Aproved
Technical writer Approved
Maintainer Approved

Contents

  • 1 Purpose of article
  • 2 Pre-requesites
  • 3 Adding kernel customization (including Linux kernel device tree, configuration, driver modification)
    • 3.1 Adding kernel configuration modifications
    • 3.2 Adding kernel driver or device tree modifications

1 Purpose of article [ edit ]

This article gives the main steps needed to add kernel customization within the Yocto build process (with a Distribution Package).

2 Pre-requesites [ edit ]

You are already familiar with the Yocto build process and OpenSTLinux distribution.

You have already created a customer layer (How to create a new open embedded layer) to update, for your own needs, the OpenSTLinux distribution.

We describe here what you must do once you have:

so that these modifications are taken into account in your build process.

3 Adding kernel customization (including Linux kernel device tree, configuration, driver modification) [ edit ]

  • First, create (in your custom layer) a .bbappend file

3.1 Adding kernel configuration modifications [ edit ]

  • Identify all new configs you set or unset with: PC $> bitbake -c menuconfig
  • Put them inside a new fragment file and copy the fragment here:
  • Update accordingly .bbappend:
  • Create fragment-cma-size.config with the following line:
  • Copy fragment-cma-size.config to ../meta-my-custo-layer/recipes-kernel/linux/linux-stm32mp/4.14/
  • Update ../meta-my-custo-layer/recipes-kernel/linux/linux-stm32mp.bbappend accordingly by adding these lines:

3.2 Adding kernel driver or device tree modifications [ edit ]

The example given below is associated with the STM32MP15 Evaluation board, but the method is independent of the board.

Sorry if this is an extremely stupid question, but I’m brand new to Linux and I’d like to try to figure out how to modify my own system. From what little I know so far about Linux, I would imagine that what I’m actually looking for is the kernel’s source code. I know that there are some resources out there that would allow me to download a copy of the kernel (like kernel.org), but presumably that is just a copy, and I would have to switch from my current kernel to that new one after modifying it in order to see the changes that I make take effect. Is there a way to avoid doing that, and just modify the kernel that I already have? And if not, how do I tell Ubuntu to use the new Kernel that I’ve downloaded rather than the original one? And how do I know whether or not my changes will screw up the system? Thanks in advance for your help!

3 Answers 3

Your question can be broken down into two parts, as you can tweak some kernel parameters during runtime and also bytepatching but as a beginner i would strongly not suggest you to try bytepatching.

In your case, to getting started would i strongly suggest to do modifications to the source code recompile it, and install and test it. It do also exist ways to test your kernel in emulators eg. without the need to reboot your system eg. QEMU is one.

It exist a lot of ways to do kernel development, here is way that should be simple if you have some expirence with using ubuntu.

Quick and dirty (you need to complete some arguments\paths):

Just enter the menu tweak around if you wanna or just exit and save.

The level of parallelism when compiling it. (number of processor-cores +1)

Pick the targeted system, google it or leave it out. Two examples

If you want the compiler to optimize eg.

Do your tweaks, eg.

Compile the kernel and make deb packages, and report time used.

Install your compiled kernel and the headers.

Your kernel should be installed and show in your grub-boot-menu. Reboot.

Enable the grub boot menu or tap shift a few times during startup.

Select your desired kernel to boot.

If you use this guide, feel free to improve it.

One of the major advantage of Linux is you can customize it however you like. You can add a new feature, remove an existing feature, modify the appearance of the Linux distribution and many. You can either customize an already installed Linux distribution or create a new customized image from a Linux ISO. In this guide, we are going to learn what is Cubic and how to create a custom Ubuntu live ISO image with Cubic application.

Introduction to Cubic

Cubic, stands for Custom Ubuntu ISO Creator, is a free, open source graphical application to create a customized bootable Ubuntu Live CD (ISO) image.

Cubic allows you to easily and effortlessly create a customized Ubuntu live cd. It has an integrated command-line chroot environment where you can do all customization as listed below:

  • Install new packages,
  • Remove existing packages,
  • Install additional Kernels,
  • Add more background wallpapers,
  • Add files and folders.,
  • Modify existing ISO
  • And more.

Cubic’s Graphical interface allows effortless navigation (back and forth with a mouse click) during the live image creation process.

Since Cubic is used to make Ubuntu live images, I guess it can also be used in other Ubuntu flavours and derivatives such as Linux Mint. I tested it in Ubuntu 20.04 LTS, 18.04 LTS and 16.04 LTS versions. It worked just fine!

Install Cubic in Ubuntu

To install Cubic on Ubuntu 18.04 and newer versions, run the following commands one by one in your Terminal:

“Cubic Classic” works on older Ubuntu LTS versions such Ubuntu 14.04.6 LTS Trusty Tahr and Ubuntu 16.04.6 LTS Xenial Xerus. To install Cubic Classic on your Ubuntu system, run:

Please note that you should not install both “Cubic” and “Cubic Classic” version at the same time. They conflict with one another and may not work. Also projects you created with Cubic can’t be opened with Cubic Classic version.

Create Custom Ubuntu Live Cd Image With Cubic

Launch Cubic from Dash or Application launcher. The following screenshot shows the default interface of Cubic application.

Select a project directory to store the customized Ubuntu live ISO image and click Next. For the purpose of this guide, I will be using /home/sk/cubic/ as my project’s directory.

Select the Ubuntu ISO image you want to customize. Here, I chose Ubuntu 20.04 LTS desktop image. Once the ISO image is selected, Cubic will automatically fill the details of original and custom images. You can modify the custom ISO image’s details as you please.

Cubic will now start to locate the compressed Linux filesystem, extract the compressed filesystem and copy the important files from the original ISO image. It will a couple minutes. Please be patient.

Now you will be placed inside the Cubic command line virtual environment.

From here, you can start customizing the Ubuntu ISO as per your liking. You can update the packages, install your favorite applications, remove unwanted applications from the ISO, install additional Kernels, add files and folders and add wallpapers, install themes, modify the software repositories and so on.

Please note that you don’t need to use “sudo” to add or remove something from the ISO, because we’ve already logged in as root user.

I am going to install Vim application in the live cd, so I ran the following command in the virtual environment:

Similarly, add additional software or remove unwanted software from ISO. If you modified the sources list, don’t forget to update the software repository list using this command:

You can also add files or folders to the live cd. Copy the files/folders (right click on them and choose copy or CTRL+C) and right click in the Terminal (inside the Cubic window), choose Paste file.

Click Copy at the top corner of the Cubic wizard to paste the files/folders in the live ISO image.

You can add your own wallpapers if you want. To do so, cd into the /usr/share/backgrounds/ directory,

and drag/drop the images into the Cubic window. Or copy the images and right click on Cubic Terminal window and choose Paste file(s) option. Also, make sure you have added the new wallpapers in an XML file under /usr/share/gnome-background-properties, so you can choose the newly added image Change Desktop Background dialog when you right-click on your desktop.

Once you are done with the customization, click Next to continue.

Cubic will start analyzing the customizations and preparing other important options such as identifying boot kernels, boot configuration, pressed files, installed packages, and creating the package manifest for typical and minimal install, and Saving the package manifest etc.

Select the packages that will be removed after a typical or minimal install. Go through the list and choose the software that you want to remove from the custom ISO and click Next to continue:

This is important section. In this wizard, you need to configure the ISO kernel, Preseed and ISO boot settings for the customized ISO. Select the Kernel that will be used to boot the customized Ubuntu live ISO in ISO Kernel tab. Then, update, add or delete preseed used to automate the installation under the Preseed tab. Finally, From the ISO boot tab, you can configure or customize the boot menu entries. After configuring the Kernel related parameters, click Next.

Select the compression algorithm for the Linux filesystem. By default, Cubic will use gzip compression. The other available compression methods are lz4, lzo, zstd, lzma, and xz. The compression algorithms are shown in a graph format as shown in the following screenshot. The upper side of the graph indicates lower compression and bottom side of graph indicates the higher compression.

If you choose a lower compression algorithm from upper side of the graph, for example lzo, lz4, the image creation process will be faster but the resulting image will be larger in size. If you choose higher compression algorithms such as zstd, lzma, xz from the bottom, the image creation will be slower but you will get the smaller size image.

After choosing the preferred compression, click Generate button to create custom Ubuntu live cd image with Cubic:

Now the custom live ISO image creation process will start. It will take a couple minute depending upon your system’s speed. Once the image creation is completed, click Finish button.

Finally, Cubic will list the details of newly created customized ISO image. Click Close button to exit Cubic. If you want to delete all project files except the ISO and checksum files, check the box that says “Delete all project files. ” at the bottom and then click Close.

The customized image will be saved in your Cubic project directory.

Create a bootable USB with this ISO image and test it on your system to verify if it works. There are many tools available to create bootable USB drive in Linux. Here are some for your reference:

Modify Custom Ubuntu Live Cd Image Using Cubic

You might want to do some changes in the existing custom ISO. To do so, open the Cubic application and choose the directory and then select the path of custom ISO (not the original) that you want to modify. And the rest of the steps are exactly same as above.

There are many Linux distributions out there, and each one of them has its own features and programs. You may have asked yourself before about how to create a Linux distribution, we are explaining how to do it in our series about “Creating a Linux Distribution“, and today’s topic is about Ubuntu, previously we had:

Ubuntu is the most popular Linux distribution, featuring a lot of features that make life easier on end users, therefore creating a distribution based on it will be a good choice if you are beginner and want to learn a new thing, or share your own copy of the operating system with the world.

Why We Don’t Build a Distribution From Scratch?

Why should it always be based on other distributions instead of building everything from zero, just like the main major distributions? Well, that’s a possible approach you can take alone using Linux from Scratch, but it’s very hard and non-effective; you will need to do tons of work by yourself if you use this method.

You will have to maintain the main repositories holding at least 20000 packages for your users, you will have to fix any possible incompatibility between the components that you choose to ship in your distribution, you will have to create a very big community around you to keep the project up and running, you will have to hire a lot of people in order to ensure quality and security of your operating system.

That’s why people are always building their distributions on Debian, Ubuntu, openSUSE, Fedora… etc, no one is ready to take such effort to create another distributions with some extra features, that’s why we have building on other distributions, don’t re-invent the wheel, unless you will make a difference!

Create a Linux Distribution Based on Ubuntu

How to customize your ubuntu kernel

You have many ways to do that actually, from using normal building software to manual building and customizing process and passing by combination of two:

The Easy Way

Just use programs; they are there for a reason, you know, to make life easier, you can use some already available special programs to build the ISO file you want from your local installed system and distribute it later.

For that, you can use PinguyBuilder, it’s a program that was originally forked of Remastersys (One of the first re-mixing software for Ubuntu) and developed by the PinguyOS team, it’s working well with Ubuntu 16.04 LTS and up.

I have personally tested it on Linux Mint 18 (Which is based on Ubuntu 16.04) to see how things will go, and it worked great, just choose the settings and files you want to ship in your distribution and wait the program while it builds the ISO file.

For installation, download the latest .deb file and install it, or run the following commands in terminal:

Then open the program from the applications menu:

How to customize your ubuntu kernelPinguy Builder Beta for 16.04

  • The first option will create a file combining all your files and programs (Will be so big and may not work with huge data).
  • The second option will create an ISO combining the installed programs and the settings you choose only, not all your data, just the ones you choose from the settings to include.
  • The third option will create a file-system tree only, no ISO file, you can include files or packages in that file system manually using “chroot” command and then use the 4-th option.
  • The fourth option will create an ISO file from the file-system tree. You should have already used option 3 to do this.

As you can see also, you can choose the Plymouth theme (the graphics after the boot loader directly), edit the Live CD boot menu or choose whom user data you want to include. All files that you place under /etc/skel will be there by default in the users’ home directory who will use your distribution.

Switch for the settings tab for more option:

The options here are explaining themselves I guess.. After you finish, return to the main tab and choose whatever build option you want to start, you will see the ISO file beside the checksums in /home/PinguyBuilder/ folder:

How to customize your ubuntu kernelISO file and Checksums by built Pinguy Builder

The Hard Way

You can create your distribution based on Ubuntu by extracting the components of the ISO file of Ubuntu to a folder, modify them and then re-build the ISO file. This is how it works theoretically.

You can use this complete official guide from the Ubuntu community to learn how to do so, as you can see, it takes a lot of effort to do the same results, your time will be wasted between downloading packages and compressing and extracting file-systems, copying and modifying all the files manually, which is why people use programs.

If you want, you can use UCK (Ubuntu Customization Kit), it’s a tool that will do all the mentioned work in that article using graphical interfaces with less-need to tune things, it’s free and available to install from the repositories:

If you want to be a first class-citizen in the Ubuntu family, you may consider building a distribution based on Ubuntu from the source ISO files for Ubuntu, you will have to download all the ISO files, combine them and then build your distribution manually using them.

Testing the Distribution

Don’t ever release a thing to the world without testing; it’s an essential thing today if you don’t want to get insults from users who will download your distribution and use it on their own.

You have a lot of methods to do so, like:

  • Using KVM, a virtual technology implemented in the kernel itself to run virtual systems. You can use many interfaces available to it like QEMU or GNOME Boxes. Read our guide on how to use QEMU to test your distribution.
  • VirtualBox, a famous program developed by Oracle to run and test virtual systems.

All are available from the official repositories for Ubuntu:

Or to install VirtualBox:

Then just search in the applications menu for the program and launch it to start testing.

Conclusion

There are a lot of ways to build a customized Linux distribution based on Ubuntu, you may choose any one of them that fits your needs, but don’t forget testing; it’s a very important step in order to insure that your system is error-free and working well on any hardware that a user may have.

Have you ever built a distribution before? What methods did you use and how was your experience?

Subscribe to Monthly Newsletter

Once per month, you can subscribe to receive our newsletter that contains everything we published during the month.

Thank you!

You have successfully joined our subscriber list.