NSLU2-Linux
view · edit · print · history

Why

Occasionally, it may be desirable to login to a Slug without any external drives attached (such as for maintenance purposes). In order to do this, the root password stored (as a hash) on the internal flash is needed. However, if after using turnup to switch to an external drive, the root password is changed, then the root password (hash) stored on the internal flash may be different than the root password normally used. (The passwd file in the internal flash is no longer the same as the passwd (or shadow) file on the external drive.) In this scenario, the original root password may be forgotten through disuse.

How

To reset the root password hash stored on the internal flash, first boot the system normally with the external drive (the one with the root partition) attached. Then login to root normally.

The internal flash should already be mounted as /initrd, but it is mounted as read-only. Since you will need to make changes to /initrd/etc/passwd (the passwd file on the internal flash), remount it read-write:

 mount -o remount,rw /initrd

Then chroot into the internal flash so that your Slug thinks that /initrd is actually the /:

 chroot /initrd

Next change the root password by using the passwd command:

 passwd root

When you have finished that, the root password hash stored on the internal flash has been changed. You can leave the chroot jail by pressing [Ctrl]+[D].

You may want to set /initrd back to read-only to avoid accidentally corrupting it. This can be accomplished by rebooting your Slug:

 shutdown -r now

Or by explicitly remounting /initrd read-only:

 mount -o remount,ro /initrd
view · edit · print · history · Last edited by jchau.
Originally by jchau.
Page last modified on May 11, 2008, at 12:17 AM