| ▲ | Joker_vD 11 hours ago | |||||||||||||||||||||||||
What if we remount the filesystem(s) at /dev/sda as read-only first? Then make a small ramfs with statically-linked curl in it and exec it. Hmm. Ideally, you'd also want to call reboot(2) after it's done... | ||||||||||||||||||||||||||
| ▲ | duskwuff 3 hours ago | parent | next [-] | |||||||||||||||||||||||||
One bit of magic you may be interested in is pivot_root, which allows another filesystem to take the place of the root filesystem (e.g. / and /mnt become /old and /). It's usually used during startup, to allow the "real" root filesystem to take the place of the initrd, but could have other uses. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | tremon 4 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
You also don't want to do this under any kind of memory pressure, because the kernel will happily drop read-only pages from memory if it thinks they can be re-read from disk when needed. | ||||||||||||||||||||||||||
| ▲ | astralbijection 10 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
All of those things get covered in parts 2, 3, and 4 :) | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | akdev1l 10 hours ago | parent | prev [-] | |||||||||||||||||||||||||
in most cases you could just drop back into the initramfs that is included in most distros Or if you have access to the boot command line you can also usually stop the boot process before pivot_root happens (hence you’ll be left running in the initramfs environment) On Fedora/EL it would be done by putting `rd.break` in the kernel command line | ||||||||||||||||||||||||||