Skip to content

cheroliv/magic_stick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

184 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Magic Stick

Standardized portable environment on a bootable USB drive

Version 0.1.8 Base Xubuntu 24.04 License Apache 2.0

Download v0.1.8

Important
Flash the ISO directly:
sudo dd if=magic_stick_0.1.8.iso of=/dev/sdX bs=4M status=progress && sync

Why Magic Stick?

You’re a field technician, trainer, or nomadic developer. Every time you sit at a different computer, you lose 30 minutes setting it up. Magic Stick eliminates that problem: a USB drive that boots a complete, identical environment on any PC.

  • Training: every student gets the same drive, ready to work on day one

  • FTTH/Network technician: full network diagnostics regardless of the host machine

  • Nomadic dev: find your full stack (Docker, Java, Ollama) on any computer

  • Tech teams: shared standardized environment, zero time wasted on setup


How it works

Magic Stick uses an A/B partition system with persistence:

Partition Size Role

System A

~8 GB

Active Xubuntu live system (default boot)

System B

~8 GB

Backup Xubuntu live system (inactive)

Persistence

Remaining space

User data + software config

Atomic updates

  1. update-system.sh detects the active partition (A or B)

  2. It writes the new ISO to the inactive partition

  3. It flips the GRUB boot flag

  4. On next boot: new version is active

  5. Something went wrong? Reboot into the previous partition β€” instant rollback

  6. The Persistence partition is never touched


Included software

Category Software

Desktop

Xubuntu Desktop (XFCE)

Containerization

Docker CE + Docker Compose, Podman

Local AI

Ollama (on-device LLM)

Development

SDKMAN + JDK 25 Temurin, Git, curl, wget, jq, JetBrains Toolbox

JavaScript/Node

NVM, Node.js, pnpm

Python

Python 3.14.4, uv package manager

Network/FTTH

nmap, iperf3, Wireshark, tshark, traceroute, dnsutils

System diagnostics

htop, ncdu, tree, lshw, smartmontools

Search/Navigation

ripgrep, fd, fzf

Git tools

lazygit

HTTP/REST

xh

Task runner

just

Package manager

Flatpak

Shell

zsh + oh-my-zsh, starship

Media

opencode, graphify, ffmpeg

SSH/Transfer

OpenSSH client, rsync, tmux, terminator


Quick start

Prerequisites

  • A USB drive with at least 32 GB (64 GB recommended)

Download the ISO

Note
The ISO is built by GitHub Actions on every tag push. No local build needed.

Flash to a USB drive

# Identify the USB drive
lsblk

# Flash (WARNING: erases all data on the target device)
sudo scripts/flash.sh /dev/sdX

Update the system (A/B)

# Update the inactive partition
sudo scripts/update-system.sh /dev/sdX

# If the new system fails to boot:
# select the previous partition in the GRUB menu

Project architecture

magic_stick/
β”œβ”€β”€ build/                             # live-build output (generated ISOs)
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ live-build/
β”‚   β”‚   β”œβ”€β”€ package-lists/            # Package lists
β”‚   β”‚   β”œβ”€β”€ hooks/                     # chroot + binary hooks
β”‚   β”‚   β”œβ”€β”€ includes.chroot/          # Files included in the system
β”‚   β”‚   └── includes.binary/          # Files included in the ISO
β”‚   └── overrides/
β”‚       └── skel/                      # Custom /etc/skel (home template)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ build.sh                       # ISO build via Docker (entry point)
β”‚   β”œβ”€β”€ build-inner.sh                # ISO build (inside Docker)
β”‚   β”œβ”€β”€ flash.sh                       # USB flash
β”‚   β”œβ”€β”€ test-boot.sh                   # QEMU boot test
β”‚   β”œβ”€β”€ update-system.sh               # A/B update
β”‚   β”œβ”€β”€ install-software.sh            # Software in chroot
β”‚   └── verify.sh                      # ISO verification
β”œβ”€β”€ src/
β”‚   └── main/resources/                # Gradle build resources
β”œβ”€β”€ Dockerfile                         # Docker image for the build
β”œβ”€β”€ build.gradle.kts                   # Gradle build config
└── .github/workflows/build.yml       # CI/CD pipeline

Partition

Size

Type

Flag

1 (System A)

8 GB

squashfs

boot

2 (System B)

8 GB

squashfs

-

3 (Persistence)

~48 GB

ext4

-

The Persistence partition uses persistence.conf with / union to save data between sessions.


Security

  • No personal data in the ISO β€” SSH keys and user files go in the Persistence partition

  • Automatic rollback if the new system fails to boot

  • Persistent data is never touched by system updates

  • Atomic updates: if it breaks, revert to the previous version with a single reboot


Project status

EPIC Status

EPIC 1: Project initialization

βœ… Done

EPIC 2: Xubuntu base ISO build

βœ… Done β€” Download v0.1.8

EPIC 3: A/B partition + Persistence

βœ… Done

EPIC 4: Software (Ollama, Docker, SDKMAN, tools)

βœ… Done

EPIC 5: XFCE customization

βœ… Done

EPIC 6: A/B update script

βœ… Done

EPIC 8: Docker CLI image

βœ… Done

Docker CLI image

A cheroliv/magic-stick-cli Docker image is available on Docker Hub. It mirrors the CLI software stack from the live-build chroot (no GUI) for CI/CD jobs and Ollama Cloud.

Pull

docker pull cheroliv/magic-stick-cli:latest

docker-compose.yml

services:
  magic-stick-cli:
    image: cheroliv/magic-stick-cli:latest
    stdin_open: true
    tty: true
    working_dir: /workspace
    volumes:
      - ./:/workspace
    deploy:
      resources:
        limits:
          memory: 4G

GitHub Actions job

jobs:
  my-job:
    runs-on: ubuntu-latest
    container: cheroliv/magic-stick-cli:latest
    steps:
      - uses: actions/checkout@v4
      - run: python3 script.py
      - run: uv run --with requests fetch.py
      - run: xh GET https://api.example.com/data

Authentication Ollama Cloud

Caution
Never store credentials in image layers.
docker run --rm -e OLLAMA_DEVICE_KEY="$OLLAMA_DEVICE_KEY" cheroliv/magic-stick-cli ollama login

Distinction with live system

  • The Docker image is CLI-only β€” no XFCE, no JetBrains Toolbox, no VS Code

  • The live ISO is the full bootable desktop environment

  • Both share the same pinned tool versions (versions.sh)



License

Apache License 2.0

About

🐧 Portable standardized Linux environment on a bootable USB stick. Features A/B partition system for atomic updates with instant rollback, persistent user data across reboots, and a complete dev/diagnostic toolkit built on Xubuntu. Plug in any PC, boot, and work or install on the host OS.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors