Teminal issues in -dev
Bruce Dubbs
bruce.dubbs at gmail.com
Wed Oct 15 17:05:22 MDT 2008
Dan Nicholson wrote:
> On Wed, Oct 15, 2008 at 3:10 PM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
>> After jhalfs completed, I followed the instructions to chroot and set the root
>> passwd. I used:
>>
>> /usr/sbin/chroot "$LFS" /usr/bin/env -i \
>> HOME=/root TERM=linux PS1='\u:\w\$ ' \
>> PATH=/bin:/usr/bin:/sbin:/usr/sbin \
>> /bin/bash --login
>>
>> It's been a while and I don't remember -- The login is in / and not /root. IS
>> that normal?
>
> Yes. `/bin/bash --login' doesn't change the directory, and when it's
> run, the current directory is / (in the chroot). A session manager
> like login, ssh or a display manager specifically do this for you. Try
> looking at the cwd symlink in /proc/$pid for your session leader
> process.
Thanks Dan. I didn't think it through. I thought bash did it, but now that you
remind me, I remember the details of the login sequence.
>> I can't use less or passwd. less displays the file and immediately terminates.
>> passwd gives:
>>
>> # passwd
>> Changing password for root
>> Enter the new password (minimum of 5 characters)
>> Please use a combination of upper and lower case letters and numbers.
>> Bad password: too short.
>> Warning: weak password (enter it again to use it anyway).
>> Password changed.
>
> You need devices, specifically /dev/tty for passwd (see getpass(3)).
> jhalfs tears down the chroot when it's done, and the only way to get
> it back is to do it manually like in the book. This has come up a
> bunch of times in the past.
Yes. `mknod -m666 /dev/tty c 5 0` makes everything work correctly. Should we
add that to "6.2. Preparing Virtual Kernel File Systems" ?
-- Bruce
More information about the lfs-dev
mailing list