Rescuing Linux: Difference between revisions

Line 42: Line 42:
==all my binaries are gone==
==all my binaries are gone==
The situation can arise that one has an active process context (we'll assume a shell) on a machine where the standard POSIX binaries are unavailable. This can happen due to e.g. a network error, a disk error, memory error, wayward <tt>rm -rf /</tt>, misadventures in package management. What can be done in such a case?
The situation can arise that one has an active process context (we'll assume a shell) on a machine where the standard POSIX binaries are unavailable. This can happen due to e.g. a network error, a disk error, memory error, wayward <tt>rm -rf /</tt>, misadventures in package management. What can be done in such a case?
===display a file without cat===
===cat without cat===
The bash shell's <tt>echo</tt> or <tt>printf</tt> builtin can be used:
The bash shell's <tt>echo</tt> or <tt>printf</tt> builtin can be used:
<pre>
<pre>
Line 53: Line 53:
[freebird](0) $
[freebird](0) $
</pre>
</pre>
===reboot without reboot===
Enable and apply sysrq reboot:
<pre>echo 128 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger</pre>
Alt+SysRq+B will accomplish this at the terminal if sysrq reboot is enabled. Unlike <tt>reboot</tt>, there will be no syncing and unmounting of disks.


==External links==
==External links==
* Debian wiki page for [https://wiki.debian.org/initramfs initramfs]
* Debian wiki page for [https://wiki.debian.org/initramfs initramfs]
* Kernel documentation for [https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html Ramfs, Rootfs, and Initramfs]
* Kernel documentation for [https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html Ramfs, Rootfs, and Initramfs]