Cubic for Colab β custom Ubuntu ISO creator, no GUI
A headless, notebook-native re-implementation of the classic Cubic (Custom Ubuntu ISO Creator) workflow, built for Google Colab. No desktop, no VNC, no windows β open the notebook, edit one CONFIG cell, run everything top to bottom, and collect a bootable custom ISO from Google Drive.
Pipeline
source ISO βββΊ xorriso extract βββΊ unsquashfs βββΊ chroot customise βββΊ mksquashfs βββΊ xorriso rebuild βββΊ Drive / download
(no loop-mount!) (live rootfs) (apt Β· PPAs Β· files) (repack) (boot layout kept)
- Extract uses
xorriso -osirrox, so nothing is ever loop-mounted β safe inside restricted containers. - Customise runs a generated script inside a chroot of the unpacked live system (bind-mounts of
/dev /proc /sysare attempted best-effort and skipped gracefully when the runtime forbids them). - Rebuild re-uses the exact boot equipment of the original ISO: xorriso's own
report_el_torito as_mkisofsoutput is transformed into a fresh build command, so BIOS (grub2 MBR + El Torito) and UEFI (GPT appended ESP) boot paths survive repacking. Cell 7 prints the new ISO's boot report next to the original's and verifies the ESP content byte-for-byte. - Deliver copies the ISO plus a
.sha256sidecar toDrive βΈ MyDrive βΈ CubicColab, with an optional browser-download switch.
What you can customise
| Option | Effect |
|---|---|
APT_INSTALL / APT_PURGE |
add or remove apt packages in the live system |
PPA_REPOS |
add Launchpad PPAs (via add-apt-repository) |
DEB_URLS |
standalone .deb files, installed with dpkg -i |
ROOTFS_FILES |
drop files anywhere in the rootfs (wallpapers, configs, scripts) |
RUN_IN_CHROOT |
extra shell one-liners inside the chroot |
SET_HOSTNAME |
change the live + installed hostname |
KERNEL |
install another kernel (e.g. HWE) and optionally purge the old ones |
BOOT_MENU_EDITS |
rename GRUB boot-menu entries (text replacements in boot/grub/grub.cfg) |
ISO_FILES |
add extra files to the ISO tree itself |
SQUASH_COMPRESSION |
auto (detected from the original) or force zstd / gzip / xz |
OUTPUT |
Google Drive copy and/or browser download |
Quick start
- Open the notebook in Colab (badge above, or
File βΈ Upload notebookwithcubic_colab.ipynb). - Edit the
CONFIGcell (source ISO URL, packages, files, boot-menu titlesβ¦). Runtime βΈ Run all. The finished ISO lands inWORK_ROOT/output/and on your Google Drive.
A desktop ISO (~6 GB) needs ~30 GB of scratch disk and 40β90 minutes on the free CPU runtime; smaller flavours (server, Lubuntu, Xubuntu) are faster and lighter. No GPU is used.
Command-line twin
cubic_pipeline.py is the exact same pipeline as a plain script for any root Linux box:
sudo python3 cubic_pipeline.py
Both files are generated from one source, so notebook and CLI never drift apart.
Requirements & notes
- Ubuntu/Debian system (Colab is preconfigured):
squashfs-tools,xorriso,grub-pc-bin,mtools,libarchive-toolsβ installed automatically by cell 2. - Works with modern Ubuntu flavours (>= 20.04, casper + GRUB layout): desktop, server, Kubuntu, Lubuntu, Xubuntu, MATE, Budgie, Studio, Kylin. Layered ISOs (e.g. server) are handled like Cubic: the largest squashfs layer is edited.
- The source ISO can be a URL, a Files-panel upload, or a file from your Google Drive.
- SHA-256 verification against the official
SHA256SUMSis built in. - The chroot step always regenerates a clean
filesystem.manifest(-remove)andfilesystem.size, and the ISO'smd5sum.txtis rebuilt after repacking.
Validation
The pipeline was validated end-to-end on a synthetic ISO carrying the modern-Ubuntu hybrid boot
layout (grub2 MBR, GPT appended ESP, El Torito BIOS + EFI): the rebuilt image reproduces the
original boot report exactly β same ESP interval, same El Torito EFI pointer, ESP content
byte-identical to efi.img, patched grub.cfg intact, md5sum.txt consistent.
Troubleshooting
See the FAQ cell at the bottom of the notebook (re-run map, disk-space advice, SHA-256 recovery, boot-menu string tips). Always smoke-test the ISO in a VM before flashing it.
Credits & license
Unofficial community tool β not affiliated with the Cubic project or Canonical. Inspired by
Cubic. Code released under the MIT license (see LICENSE).