summaryrefslogtreecommitdiffstats
path: root/content/blog/multi-distro-usb.md
blob: 58eb23a9335e2ecd5d58e11f6bd056038fc2f4d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: Multi Distro Linux USB
date: 2024-09-02
draft: false
---

I often found myself needing to create a bootable USB stick with some Linux distro,
either to install and try it, or to use it live for specific purpose,
like using [Tails][1] Linux to generate/restore a PGP key and install it on the smart card,
or using [ParrotSec][2] for testing or [HTB][3] challenges.

I know it was possible to create a hard drive with multiple OS in different partitions, so
I thought, it has to be possible to do the same thing using a USB drive.


# How to create multi-distro bootable Linux stick
Unless you are into [GRUB][8], and want to learn more about it and feel more comfortable fixing GRUB issues by yourself.

## Don't.
After spending days, looking into the grub configurations for running Rocky Linux and Proxmox (to no avail).
I'm going to save you some deep rabbit hole dive.

**Short answer**, if you will only work with images less than 4GB, then it _can*_ work, but
if you are going to work with bigger images that you need live (Parrot Security 6+GB) it won't work.

**Long answer**, I didn't find a lot of info online on how to create a multi-partition multi-boot USB stick,
with the `efi` "boot" partition formatted as `fat32` and the "data/iso" partition formatted to anything else.

Tools like [glim][5] (which is amazing btw), and [uGRUB][6] only work with a single `fat32` partition.

Tutorials like [this][4] (which is amazing btw and mentioning how to work with multi-partition USB sticks,
including with `ext4`), works too. **But never stable enough**.

I have seen the same setup randomly failing while being used in live mode. I have seen the same image work on
**only** one of my machines (the old one that have HDD) and fails on the others machines.

To quote the documentation:
> If you have any problem to boot, for instance stuck at the GRUB prompt before the menu,
> try re-installing. If you have other exotic GRUB errors,
> such as garbage text read instead of the configuration directives, try re-formatting your USB memory from scratch.
> I've seen weird things happen...

[Glim][7]

## Why?
At this point, I can't tell you why an image would work or not. I can't tell you how to boot Rocky Linux, or what is
the required parameters to run proxmox linux.

All I can tell you, is that it took me way too long to figure out, that it's not stable enough to run reliably.
There might be a reason why it fails on the machine with the SSD, and why it couldn't insert `thinkpad_acpi' module,
but for the original purpose of having a convinient way of setting up linux and updating images,
I will stick with having to run
```bash
$ diskutil list
$ diskutil eraseDisk JHFS+ Untitled /dev/diskX
$ diskutil unmountDisk /dev/diskX
$ sudo dd bs=4M if=path/to/image.iso of=/dev/diskX status=progress oflag=sync
```
and waiting for few minutes, for now.

[1]: https://tails.net/
[2]: https://parrotsec.org/
[3]: https://www.hackthebox.com/
[4]: https://linuxconfig.org/how-to-create-multiboot-usb-with-linux
[5]: https://github.com/thias/glim
[6]: https://github.com/adi1090x/uGRUB/
[7]: https://github.com/thias/glim?tab=readme-ov-file#troubleshooting
[8]: https://www.gnu.org/software/grub/