fedora-silverblue / issue-tracker

Fedora Silverblue issue tracker
https://fedoraproject.org/atomic-desktops/silverblue/
122 stars 3 forks source link

Unable to successfully reset root password using rescue mode #524

Closed miabbott closed 10 months ago

miabbott commented 10 months ago

When trying to follow the instructions on resetting the root password using rescue mode, I found that I'm unable to login with my user account or root account afterwards.

  1. Using a fresh Silverblue 39 install, I appended rw init=/bin/bash to the linux line in the boot entry.
  2. I used passwd to configure the root password from the resulting shell.
  3. Because touch /.autorelabel does not work with ostree-based hosts, I tried using /sbin/restorecon -v /etc/{passwd,shadow} (see https://github.com/coreos/fedora-coreos-docs/pull/48) to fix any SELinux labeling before using /sbin/reboot -f.
  4. After rebooting, my user login and root login no longer worked.

I was unable to observe any errors on the console during the login attempts.

miabbott commented 10 months ago

Based on investigations in https://github.com/ublue-os/main/issues/469, one set of instructions that seem to work for resetting normal user passwords and the root password are:

  1. Edit grub entry and add rd.break enforcing=0 to the end of it
  2. mount -o remount rw /sysroot
  3. /sysroot/usr/sbin/chroot /sysroot
  4. passwd [your username here]
  5. Continue booting your system
  6. Run restorecon /etc/shadow as root
  7. setenforce 1 to re-enable SELinux

I'm not sure if this is the best way to achieve the results, but it appears to be successful.

noelmiller commented 10 months ago

Thanks to Colin, there is also another option and will be simpler to execute: https://github.com/ublue-os/main/issues/469#issuecomment-1885264886