Skip to content

HOWTO quickly reset the root password on a Linux system with a native ZFS root filesystem

dajhorn edited this page Sep 20, 2011 · 2 revisions
  1. Start the computer and hold the left <shift> button to get the GRUB boot menu.

  2. Select the desired system and push the edit button. (Look for a key legend at the bottom of the screen.)

  3. Append break=init to the existing linux line and save it.

  4. Start the system and wait for the (initramfs) # recovery prompt.

  5. Run chroot /root /bin/bash at the recovery prompt. Ignore errors about missing /dev nodes.

  6. Run passwd root and input the new root password.

  7. Run exit to return to the recovery prompt.

  8. Run reboot.

This method is effective on Linux systems that use the initramfs-tools boot stack, like most DEB and RPM distributions. It is especially useful on systems that override or ignore the single kernel parameter, or where the init=/bin/sh trick doesn't work.