this post was submitted on 02 Aug 2024
593 points (98.4% liked)

linuxmemes

20751 readers
1101 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 

It was also actually pretty fun!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 51 points 1 month ago* (last edited 1 month ago) (2 children)

Impressive, sounds like magic, tbh! You know any tutorials?

[–] [email protected] 27 points 1 month ago (1 children)

Yeah, I'd love to see a write up on this to follow.Sounds like useful practice in the lab if nothing else.

[–] [email protected] 3 points 1 month ago

i experimented with this some time ago, see my post here: https://lemmy.ml/post/18706002/12772832

[–] [email protected] 88 points 1 month ago (4 children)

Not really, I pulled it together from a bunch of random posts lol

Maybe I should write one, but in essence you:

  • Stop all non-OS essential services

  • Create a filesystem in a chunk of RAM

  • Pull essential OS files from the installed OS into it recreating needed directories (Though you could probably just use a tiny pre-built distro but meh)

  • Pivot root into it

  • Reload services (when they restart they'll be restarted in the context of where you pivot rooted, prior they're still running under the context of the installed OS)

  • Unmount the boot drive

  • Then do what ever you need to do

  • ???

  • Profit

[–] [email protected] 3 points 1 month ago

Imagining this process, despite having never done 50% of the steps on the list, makes my brain imagine this: Turning a sphere outside in

[–] [email protected] 6 points 1 month ago

FYI you can use kexec and a prepared initrd to do something similar with only one command.

[–] [email protected] 15 points 1 month ago

I work in this field and I think this is 🔥 af

[–] [email protected] 25 points 1 month ago (2 children)

How exactly so you pivot root? Simply chroot or something more involved?

[–] [email protected] 73 points 1 month ago (2 children)

chroot isn't enough, you need "real" pivot_root

chroot just changes the shells root point, pivot_root actually changes the root mount point and enables this trick to work

[–] [email protected] 12 points 1 month ago
[–] [email protected] 27 points 1 month ago

This is god-tier technique, kudos