Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some troubleshooting steps for access recovery #48

Merged
merged 1 commit into from Feb 21, 2020

Conversation

@jlebon
Copy link
Member

@jlebon jlebon commented Feb 14, 2020

The init=/bin/sh trick is known, but let's give a clear step-by-step
to make this easier. (The SELinux step in particular is easy to miss.)

See related user question:
https://discussion.fedoraproject.org/t/recommended-password-recovery-procedure/17034

@lucab
Copy link
Member

@lucab lucab commented Feb 14, 2020

@jlebon can we maybe remove all the password-setting references and just stick to show the SSH flow? I'm worried users could end with forgotten weak temporary passwords.

Also, I'm somehow surprised that init=sh still manages to boot into rootfs given all the missing things from systemd and rpm-ostree. Did you try this on a recent FCOS?

@jlebon
Copy link
Member Author

@jlebon jlebon commented Feb 14, 2020

@jlebon can we maybe remove all the password-setting references and just stick to show the SSH flow? I'm worried users could end with forgotten weak temporary passwords.

I think the only places it's showing up right now are where it makes sense. Once in the specifications for FCC, and once about migrating from AH: https://docs.fedoraproject.org/en-US/fedora-coreos/migrate-ah/. Hmm, I guess we should probably add a warning there though about SSH password logins being disabled by default and discouraged?

Also, I'm somehow surprised that init=sh still manages to boot into rootfs given all the missing things from systemd and rpm-ostree. Did you try this on a recent FCOS?

Bash doesn't need systemd nor rpm-ostree though :) It's functional enough to at least reset passwords and do other basic things. (Edit: and yup, tried this before posting it!).

@austinnichols101
Copy link

@austinnichols101 austinnichols101 commented Feb 14, 2020

I just tried init=/bin/sh with FCOS 31 and it just hangs at boot. Possibly I am not following the correct procedure...

image

@jlebon
Copy link
Member Author

@jlebon jlebon commented Feb 14, 2020

@austinnichols101 What message does it hang on?

I'll admit I tested it on a local build. Will sanity-check against the latest release.

@austinnichols101
Copy link

@austinnichols101 austinnichols101 commented Feb 14, 2020

@jlebon Here's the last of the boot log (running VMware Workstation 15).

image

modules/ROOT/pages/access-recovery.adoc Outdated Show resolved Hide resolved
@austinnichols101
Copy link

@austinnichols101 austinnichols101 commented Feb 14, 2020

@jlebon - here's an MP4 video of the boot failure.
RCOS Boot 2020-02-14_12-59-32.zip

@jlebon
Copy link
Member Author

@jlebon jlebon commented Feb 14, 2020

@austinnichols101 Ahhh, you're doing this over tty0, right? Try adding console=tty0 at the end.

@austinnichols101
Copy link

@austinnichols101 austinnichols101 commented Feb 14, 2020

@jlebon - Adding console=tty0 helped. Then at the prompt I

  • Loaded the SELinux policy: /sbin/load_policy -i
  • Reset the password for root and core: passwd <user>
    . Reboot: /sbin/reboot -f

However, after I reboot I'm unable to log on as either core or root.

image

Note that I did make a first attempt WITHOUT loading the SELinux policy so that might have screwed things up.

@jlebon
Copy link
Member Author

@jlebon jlebon commented Feb 14, 2020

Note that I did make a first attempt WITHOUT loading the SELinux policy so that might have screwed things up.

Yeah, judging from the AVC denials, that seems to be the issue. You can fix it using /sbin/restorecon -v /etc/{passwd,shadow} from the shell boot again.

@jlebon jlebon force-pushed the jlebon:pr/pw-recovery branch 2 times, most recently from 64d146f to 779fec5 Feb 14, 2020
@austinnichols101
Copy link

@austinnichols101 austinnichols101 commented Feb 14, 2020

That solved the problem. Thanks!

@jamescassell - I think the /sbin/restorecon -v /etc/{passwd,shadow} should be included in the procedure with a note/warning to load the selinux policy as the first step after logging in.

@jlebon jlebon force-pushed the jlebon:pr/pw-recovery branch from 779fec5 to 7c6ee8b Feb 14, 2020
@jlebon
Copy link
Member Author

@jlebon jlebon commented Feb 14, 2020

I added a bit about restorecon to be explicit.

Copy link

@jamescassell jamescassell left a comment

Looks good to me. I've never tried restorecon without a loaded policy...

The `init=/bin/sh` trick is known, but let's give a clear step-by-step
to make this easier. (The SELinux step in particular is easy to miss.)

See related user question:
https://discussion.fedoraproject.org/t/recommended-password-recovery-procedure/17034
@jlebon jlebon force-pushed the jlebon:pr/pw-recovery branch from 7c6ee8b to f83e059 Feb 20, 2020
Copy link

@jamescassell jamescassell left a comment

Maybe we need a "intro to sysadmin" link we assume folks have already read, though.


If you've lost the private key of an SSH keypair used to log into Fedora CoreOS, and do not have any password logins set up to use at the console, you can gain access back to the machine using the `init=/bin/sh` trick:

. When booting the system, intercept the GRUB menu and edit the entry to append `init=/bin/sh` to the kernel argument list, then press Ctrl-X to resume booting.

This comment has been minimized.

@jamescassell

jamescassell Feb 20, 2020

By holding the left shift key or sequentially pressing the up and down arrows to interrupt the grub timeout, then press e to edit the selected entry, entering the grub user (usually root) and password if necessary. (Do we support grub passwords?)

This comment has been minimized.

@jlebon

jlebon Feb 21, 2020
Author Member

Maybe let's keep further tweaks as follow-ups and just get this one in? It does more good as is on the docs site, than not-quite-perfect sitting here. :)

Copy link
Member

@bgilbert bgilbert left a comment

Yup, let's get this in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants