chroot command used with screen utility

Fbsd8 fbsd8 at
Tue Jun 24 16:26:47 UTC 2014

Fbsd8 wrote:
> Hello list
> I have three directory tree filesystems that I want chrooted.
> When I issue the chroot path command the host console turns into
> the console prompt for the chroot. To have 3 individual chrooted 
> filesystems I alt/F2 and chroot filesystem #1 ,
> then I alt/F2 and chroot filesystem #2 and so on.
> So I end up having F1 for the host console,
>                    F2 for the filesystem #1
>                    F3 for the filesystem #2
>                    F4 for the filesystem #3
> The goal is to have a primary start up script which will start the 
> chroot filesystems from the host console without the chroot consuming 
> the host's console. The "man chroot" command has very little info about 
> usage. I can only think what I want done can not be done with the chroot 
> command syntax.
> I am now testing with the screen command. I get a daisy-string effect of
> shells within shells.
> If there is some other method to do this I am interested.
> But help with using screen is desired.
> Thanks

For the archives.

Never received a reply. But I continued to work on scripting screen
to run multiple chroot filesystems.

Finally this created a screen in detached mode that was running a 
chrooted filesystem.

     screen -S $name -d -m chroot /usr/chroot/$name

This was only half of the problem, still needed to script some way to 
stop the chroot running in a screen. Tried these different commands

      screen -S $name -X exit
      screen -p $name -X exit
      screen -S $name -X shutdown now
They did not work.
Finally went the kill task method

      screen_pid=`screen -ls | grep $name | cut -f 1 -d .`
      /bin/kill ${screen_pid}

More information about the freebsd-questions mailing list