summaryrefslogtreecommitdiffstats
path: root/content/blog/multi-distro-usb.md
blob: fe1760217a02ee76d18563b68c8c26d9edd3458b (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
69
70
71
72
73
---
title: Multi Distro Linux USB
date: 2024-09-02
draft: false
---

I have 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 a specific purpose.
Like using [Tails][1] Linux to generate or restore a PGP key and install it on the smart card,
or using [ParrotSec][2] for testing or [HTB][3]/[OTW][9] challenges.

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

# How to create a 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 a 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 as anything else.

Tools like [glim][5] and [uGRUB][6] only work with a single `fat32` partition.

Tutorials like [this][4] -which is amazing btw and explains in details how to work with multi-partition USB sticks,
including with `ext4`- work 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 works on
**only one** of my machines (the old one that has an 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
the required parameters to run Proxmox Linux are.

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 or why it couldn't insert the `thinkpad_acpi` module,
but for the original purpose of having a convenient 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 a few minutes, for now.

[1]: https://tails.net/
[2]: https://parrotsec.org/
[3]: https://git.sr.ht/~a14m/HTB
[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/
[9]: https://git.sr.ht/~a14m/OTW/tree/master/Natas.md