Rescuing Linux: Difference between revisions
| (4 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
==firmware== | ==firmware== | ||
System firmware configuration can usually be entered by holding one of Delete, F2, or F1. A boot menu can commonly be accessed with F10. | System firmware configuration can usually be entered by holding one of Delete, F2, or F1. A boot menu can commonly be accessed with F10. All of these are of course motherboard-specific. | ||
If you need clear a firmware password, try removing the battery and unplugging the machine for 30s. | If you need clear a firmware password, try removing the battery and unplugging the machine for 30s. | ||
<tt>systemctl reboot --firmware-setup</tt> will attempt to reboot into firmware configuration. | |||
==grub== | ==grub== | ||
| Line 16: | Line 18: | ||
==kernel command line== | ==kernel command line== | ||
The bootloader can provide command line parameters to the kernel (they can also be specified at build time, see <tt>CONFIG_CMDLINE</tt>). [[systemd]] can take many parameters off of the kernel command line. | The bootloader can provide command line parameters to the kernel (they can also be specified at build time, see <tt>CONFIG_CMDLINE</tt>). GRUB supports providing them in interactive mode. With UEFI firmware, they can be specified in the EFI shell. | ||
[[systemd]] can take many parameters off of the kernel command line, including <tt>systemd.unit=</tt> to specify a boot target. | |||
For more output, ensure "quiet" is not present. For still more output, add "debug=vc" (by default, <tt>debug</tt> writes to <tt>/run/initramfs/initramfs.debug</tt>; this sends it to the console). | For more output, ensure "quiet" is not present. For still more output, add "debug=vc" (by default, <tt>debug</tt> writes to <tt>/run/initramfs/initramfs.debug</tt>; this sends it to the console). | ||
| Line 23: | Line 27: | ||
Note that the kernel does not by default reboot following a panic. This can be undesirable on remote machines. <tt>panic=N</tt> will reboot N seconds after a panic, if N is positive. <tt>/proc/sys/kernel/panic</tt> exposes this. | Note that the kernel does not by default reboot following a panic. This can be undesirable on remote machines. <tt>panic=N</tt> will reboot N seconds after a panic, if N is positive. <tt>/proc/sys/kernel/panic</tt> exposes this. | ||
Modules can be blacklisted with <tt>modprobe.blacklist=</tt>. | |||
===my video is borked=== | ===my video is borked=== | ||
| Line 43: | Line 49: | ||
===initramfs can't mount root=== | ===initramfs can't mount root=== | ||
An unpleasant situation is one where initramfs fails to mount the root partition, in which case you will be dumped to the dreaded BusyBox or klibc shells (ash, as in "a shitty shell"). A day when one sees BusyBox is never a good day. If the machine is remote, you are fucked without server-style out of band access (e.g. Dell iDRAC, BMC, KVM-over-IP). Otherwise, if you have a valid root partition somewhere, you can manually continue the boot by mounting that partition to <tt>/mnt/root</tt> and running <tt>exec switch_root /mnt/root /sbin/init</tt> or its non-union equivalent. Usually this means you've specified the wrong root partition in your bootloader; check the <tt>root</tt> command line option to the kernel. | An unpleasant situation is one where initramfs fails to mount the root partition, in which case you will be dumped to the dreaded BusyBox or klibc shells (ash, as in "a shitty shell"). A day when one sees BusyBox is never a good day. If the machine is remote, you are fucked without server-style out of band access (e.g. Dell iDRAC, BMC, KVM-over-IP). Otherwise, if you have a valid root partition somewhere, you can manually continue the boot by mounting that partition to <tt>/mnt/root</tt> and running <tt>exec switch_root /mnt/root /sbin/init</tt> or its non-union equivalent. Usually this means you've specified the wrong root partition in your bootloader; check the <tt>root</tt> command line option to the kernel. | ||
If you have [[systemd]] running in the emergency shell (its <tt>emergency.target</tt>), try manually mounting the root filesystem to <tt>/sysroot</tt> and then running <tt>systemctl restart mount-sysroot</tt>. If this succeeds, exiting the shell ought continue the boot. | |||
==fsck on boot== | ==fsck on boot== | ||
this doesn't happen much anymore since most everyone's running at least ext3, but ext2 required <tt>fsck</tt> on boot when not cleanly unmounted, and every so often just to make sure things hadn't shifted around. | |||
if you don't want a filesystem to block booting under [[systemd]], use <tt>nofail</tt> in <tt>/etc/fstab</tt>. | |||
==access sans password== | ==access sans password== | ||
| Line 84: | Line 95: | ||
<b>ESP, bootloader, initramfs...</b> | <b>ESP, bootloader, initramfs...</b> | ||
==reassembling a degraded MDRAID== | |||
... | |||
==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] | ||