re-entering chroot correctly

Albert albertwagner at cox.net
Thu Oct 6 09:20:57 PDT 2005


Sorry to bother everyone with this again, but I am on my third host and 
have lost a lot of email in the process.  Could someone please verify 
that the commands below are the correct way to re-enter chroot, chptr 6, 
  after rebooting host:

export LFS=/mnt/hda6.lfs61

# 6.2. Mounting Virtual Kernel File Systems
mount -t proc proc $LFS/proc
mount -t sysfs sysfs $LFS/sys

# 6.3. Entering the Chroot Environment
chroot "$LFS" /tools/bin/env -i \
     HOME=/root TERM="$TERM" PS1='\[\033[1;33m\]# \w\n\r# \[\033[0m\]' \
     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
     /tools/bin/bash --login +h

# 6.8.1. Creating Initial Device Nodes
mknod -m 600 /dev/console c 5 1
mknod -m 666 /dev/null c 1 3

# 6.8.2. Mounting tmpfs and Populating /dev
mount -n -t tmpfs none /dev
mknod -m 622 /dev/console c 5 1
mknod -m 666 /dev/null c 1 3
mknod -m 666 /dev/zero c 1 5
mknod -m 666 /dev/ptmx c 5 2
mknod -m 666 /dev/tty c 5 0
mknod -m 444 /dev/random c 1 8
mknod -m 444 /dev/urandom c 1 9
chown root:tty /dev/{console,ptmx,tty}

ln -s /proc/self/fd /dev/fd
ln -s /proc/self/fd/0 /dev/stdin
ln -s /proc/self/fd/1 /dev/stdout
ln -s /proc/self/fd/2 /dev/stderr
ln -s /proc/kcore /dev/core
mkdir /dev/pts
mkdir /dev/shm

mount -t devpts -o gid=4,mode=620 none /dev/pts
mount -t tmpfs none /dev/shm



More information about the lfs-support mailing list