--- license: mit tags: - ubuntu - iso - google-colab - cubic - linux - squashfs - xorriso - remaster - no-gui --- # 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. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/#file=https://huggingface.co/Asukaa02/cubic-colab/resolve/main/cubic_colab.ipynb) ## 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 /sys` are 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_mkisofs` output 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 `.sha256` sidecar to `Drive ▸ 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 1. Open the notebook in Colab (badge above, or `File ▸ Upload notebook` with `cubic_colab.ipynb`). 2. Edit the `CONFIG` cell (source ISO URL, packages, files, boot-menu titles…). 3. `Runtime ▸ Run all`. The finished ISO lands in `WORK_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: ```bash 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 `SHA256SUMS` is built in. - The chroot step always regenerates a clean `filesystem.manifest(-remove)` and `filesystem.size`, and the ISO's `md5sum.txt` is 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](https://github.com/PJ-Singh-Net/Cubic). Code released under the MIT license (see `LICENSE`).