(Not So) Simple Plain Cubic Tutorial
Tags: cubic, ubuntu, iso, debian
Published: 2023-02-27 15:42:40



Welcome back dear reader. for your notice, I am Silent-Mobius, A.K.A. Alex M. Schapelle, your cybernetic writer that can write these letters without help of chatGPT, because [AI systems are heresy of high level](https://warhammer40k.fandom.com/wiki/Silica_Animus)

It has occurred to me that providing complex tutorials in regards to ISO's has somewhat discouraging effect, thus, in today's discussion, we'll delve into a tool named [Cubic](https://launchpad.net/cubic).
Cubic, an anagram of "Custom Ubuntu ISO Creator", is a graphical wizard tool that can aid to create a customized Live ISO image for Ubuntu and Debian based distributions.

Cubic permits effortless navigation through the ISO customization steps and features an integrated virtual command line environment to customize the Linux file system. You can create new customization projects or modify existing projects. Important parameters are dynamically populated with intelligent defaults to simplify the customization process.

Let's plan our steps in order to provide you some guidance:
- lets see how we proceed **installation** 
- initial run and setup
- example of custom ISO **generation**


## Installation
Surprisingly to me, Cubic is usable in most Debian  based systems yet support for Debian itself, although added, is still a struggle, even with acclaimed  Cubic version 2022.11.73.

Why surprised ? My first use of cubic was in its early stages and at that point of time, it was usable with Ubuntu distribution only and even there it had bugs. At leaset with Ubuntu 22.04 those bugs are gone, yet I am afraid same pleasure can not bet stated with Debian itself.

The install process on Ubuntu is standard launchpad repository addition to your device:

```sh
$ sudo apt-add-repository universe
$ sudo apt-add-repository ppa:cubic-wizard/release
$ sudo apt update
$ sudo apt install --no-install-recommends cubic
```

For Debian though, this is where the knots are dropped. My  install suggestion would be to get the package manually from launchpad repository and try to repackage it with small script I found on the github by @DeeDeeRanged in hopes that it will work for you as it worked for me:

the script is :
```sh
#!/bin/bash

DEBPACKAGE="${1%.deb}"

[[ -z "$1" ]] && echo "Usage: $0 <package.deb>" && exit 1

set -e
ar x $DEBPACKAGE.deb
zstd -d < control.tar.zst | xz > control.tar.xz
zstd -d < data.tar.zst | xz > data.tar.xz
ar -m -c -a sdsd "$DEBPACKAGE"_repacked.deb debian-binary control.tar.xz data.tar.xz
rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst

```

Save it - It will provided the repackaging assistance once we'll get cubic.deb package.

How do we get the package you may ask ? follow me:

```sh
$ echo 'deb https://ppa.launchpadcontent.net/cubic-wizard/release/ubuntu jammy main' | sudo tee /etc/apt/sources.list.d/cubic.list
$ curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb7579f80e494ed3406a59df9081525e2b4f1283b' | sudo apt-key add - # keep in mind that apt-key will soon be removed
$ sudo apt-get update
$ sudo apt-get install --download-only cubic
$ sudo mv /var/cache/apt/archives/cubic_2023.02-75-release~202302190210~ubuntu22.04.1_all.deb ~/cubic.deb
```
One might notice that it is somewhat overkill to install package, yet it is necessary if you need that package.
Once the package is in your home directory, let us use the script from before to repackage it.

```sh
$ sudo apt-get install -y zstd # required dependency to repack the deb package
$ script.sh cubic.deb # script.sh is an arbitrary name, you may use what ever you wish
$ ls 
  cubic.deb cubic_repacked.deb
$ sudo apt-get install -y ./cubic_repacked.deb
```
If you have not lost at this point dear reader, then please go to your menu and seek for cubic software on your Debian or Ubuntu device.

## Setup

In order to continue with our custom ISO build, I'd suggest to get ourselves with clean Ubuntu distro, which we'll customize with various changes later on.
```sh
curl -L https://releases.ubuntu.com/22.04.2/ubuntu-22.04.2-desktop-amd64.iso -o ~/Downloads/ubuntu_22.04.iso
```
Once the ISO is downloaded, we'll start the Cubic software which should prompt us with initial folder of generation as a prompt that looks like this:

![Cubic Prompt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytnh545n1ake8jg8w6yy.png)

Please keep in mind that folder that you provide **must be local drive** and **NOT network based drives**.

## Generation

It must be emphasized, that despite hardships of cubic's install on Debian, the tool itself, provides easy-to-use user interface that enables us to reach the goal of custom Debian/Ubuntu Iso for later use. Down below are illustration of such ease :

- Start by opening Cubic and choosing folder where all the Cubic operations will perform: I have chosen to work under my `~/Download/ISOs` folder and press `Next`

![Choose the folder](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvjq5kbvate0ewfy7675.png)
  
- On the next page, we'll need to choose Ubuntu ISO, we downloaded before, and edit parts such as output file names and naming convention of the ISO that will be generated. Once chosen use `Next` button


![Before choosing the ISO file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8h65gj3ti94hiyl9545.png)

![After choosing the ISO file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3as7ay4myu64plr7js0z.png)

- Once `Next` is pressed, Cubic will disassemble the Ubuntu ISO in chose folder, and the screen will change to next menu.

![Disassembling ISO](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/il4p9tewum9goc4on1op.png)

- Cubic tries to provide shell access for user to configure kernel configuration. My suggestion:if you do not know what to do keep on pressing `Next`
    - In case you do know what to do : Please remember to generate `initramfs` for any change you will do for kernel, or it will not be saved and default configuration will be loaded instead. Once done, press `Next`

![Terminal Kernel configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t31ii0jskz26d0f5alfy.png)


- In the next menu screen, you'll be forwarded to package installation. Here you may add any software you'd like to have installed on your device. All and all, you can install what ever you wish. Please remember that Cubic or not, ISO is a standard based on ISO-9660, which max size is usually either 2Gib or 4Gib max. **Meaning that in case you'll install too many software package, ISO will not boot, under the claim that ISO is not standard and it will not boot**.


![Transition screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yniyuenfewc9lho0qym.png)


![Package Choice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0xkuuv7btk31zu7bunx.png)

- After choosing the packages, kernel choice screen is provided, in case you have installed new kernel and configured. In case there is only one option, choose to press `Next`


![Kernel Choice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyzfhi8500ez4mytl9u5.png)

- One of the ways to reduce ISO-9660 size, is to choose correct type of compression, `xz` being the best choice, yet it takes a lot of time to compress and de-compress, which might be some what in-convenient. Choose and press `Next`


![Compression](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8diot7c1hxva4gzzgen.png)

- Once pressed `Next`, Cubic will start generating the Custom ISO. **Please Note That It Will Put Your CPU To Work**

![Generation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6yd8ad9spt2xsvd2r1y9.png)

Eventually you'll be presented with Custom ISO you've configured, and can use, whether in Virtual-Machine engine or in Hardware of your choice.

## Conclusion

Thank you dear reader, for staying with me to this part. In  this (not so) simple tutorial, I've tried to answer request for Debian and Debian based distributions, in relation to install and use **Cubic**. 

I have tested, run and executed each provided command in hopes to answer every question you might have, as you go through use case of **Cubic**.

In case you would like to do all the same steps **without** Cubic, then you should read [this tutorial]()
Hope that you've enjoyed and would appreciate `like` and `repost`. 

Either way: Please Try To Have Some Fun.