LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   what steps to follow when reentering chroot (https://www.linuxquestions.org/questions/linux-from-scratch-13/what-steps-to-follow-when-reentering-chroot-288786/)

iam whoiam 02-10-2005 11:34 PM

what steps to follow when reentering chroot
 
Ok, so I stopped halfway in chapter 6 and shutdown the system. What steps are necessary when reentering the chroot environment? I'm paranoid that if i make a wrong move i might have to do the whole thing again...... Thanks in advance!

slakmagik 02-11-2005 12:06 AM

Basically everything non-permanent you did to initialize it - the mount commands and chroot itself - should cover it.
Code:

mount -t proc proc $LFS/proc
mount -t sysfs sysfs $LFS/sys

mount -f -t ramfs ramfs $LFS/dev
mount -f -t tmpfs tmpfs $LFS/dev/shm
mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts

chroot "$LFS" /tools/bin/env -i \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    /tools/bin/bash --login +h

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

Or you could try searching for an LFS chroot script of sorts - seems like somebody made a couple of those. Not sure, though.

If you don't have or don't use $LFS, then adjust or reset as necessary.

iam whoiam 02-11-2005 05:22 AM

thought so too, just wondering whether there was something that i might have overlooked that was important. I did the mount commands and checked some of the symlinks to see whether they were still there. The /dev symlinks seem to be missing... so i redid them. Like i said i am paranoid...... Thanks!

jong357 02-13-2005 09:12 AM

Yea, that was close... :)

Code:

mount -t proc proc /mnt/lfs/proc
mount -t sysfs sysfs /mnt/lfs/sys
mount -f -t ramfs ramfs /mnt/lfs/dev
mount -f -t tmpfs tmpfs /mnt/lfs/dev/shm
mount -f -t devpts -o gid=4,mode=620 devpts /mnt/lfs/dev/pts

chroot /mnt/lfs /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h

mount -n -t ramfs none /dev
/tools/sbin/udevstart
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

I ditched the LFS ~/.bashrc and ~/.bash_profile files as soon as I could so I could get my host terminal back to normal. Thats why I switched to absolute paths....


All times are GMT -5. The time now is 05:34 AM.