pam-login and shadow on Gentoo

I have a small partition on my work laptop on which I have installed Gentoo. Most of my work stuff requires the use of windows so it doesn't get used that often, but yesterday I decided it was high time I got everything up to date. I ran an 'emerge --sync' and then an 'emerge -uDp world' and saw that pam-login was blocking shadow. So I did an 'emerge -C pam-login' and then checked again and everything was fine so started the update process and left it to update. The problem was that, because I'd left it so long, there were 400 odd packages which needed updating, including some fairly hefty ones such as X and KDE, so by the time I was ready to go home it was only at about the 68th package. I cancelled the update and shut the laptop down so I could take it home and re-start the process the next day.

I arrived the next day and tried to set the laptop to updating again but I found it booted up and then hung at the point where I should be logging in. I thought at first I'd maybe left KDM in an untenable state, but none of the virtual consoles were available and I couldn't connect via SSH. I did a bit of research into pam-login and discovered that it contains the '/bin/login' executable, except that now, of course, that binary comes from shadow instead. Unfortunately shadow is the last package that gets installed as part of the update (at least it was on the more up to date Gentoo machine I compared it with), so stopping the process part way through meant I was missing this rather important component.

The solution is easy enough - I downloaded the latest minimal install ISO from the Gentoo website, booted up from that on the laptop and then used the chroot instructions from the Gentoo Handbook to get back into my system. A simple 'emerge -u shadow' solves the problem after that. Morals of the story are:

  1. When you remove a package for dependency issues, check what it does first
  2. Trying to upgrade over 400 packages in one go is probably not a sensible strategy, next time I'm going to break it down a bit into functional groups (though next time, I might not wait so long before updating...)