597
submitted 4 months ago by cm0002@lemmy.world to c/linuxmemes@lemmy.world

It was also actually pretty fun!

you are viewing a single comment's thread
view the rest of the comments
[-] Prunebutt@slrpnk.net 51 points 4 months ago* (last edited 4 months ago)

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

[-] cm0002@lemmy.world 88 points 4 months ago

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

[-] exu@feditown.com 25 points 4 months ago

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

[-] cm0002@lemmy.world 74 points 4 months ago

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

[-] 4am@lemm.ee 27 points 4 months ago

This is god-tier technique, kudos

[-] pineapplelover@lemm.ee 12 points 4 months ago
[-] barkingspiders@infosec.pub 15 points 4 months ago

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

[-] InnerScientist@lemmy.world 6 points 4 months ago

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

[-] Wilzax@lemmy.world 3 points 4 months 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

[-] A_cook_not_a_chef@lemmy.world 27 points 4 months ago

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

[-] smb@lemmy.ml 3 points 4 months ago

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

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

linuxmemes

21631 readers
40 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
  •  

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't fork-bomb your computer.

    founded 2 years ago
    MODERATORS