[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: init, pivot_root, chroot, etc ...



On Tue, 2003-12-16 at 11:22, e-bone wrote:

> I've tried:
> 1
> calling cryptcat in the linuxrc script. this works, but then i can't
> enter passwords at the tty ! apparently signals (ctrl-c) cannot be caught in
> the linuxrc script either ? i tried a script that catches this signal
> then asked for the passwords from the tty.

ctrl-c probably doesn't work due to the terminal not being set up (wild
guess). Maybe you could make it work with "stty intr ^C"

Other than that, I'd suggest:
     1. linuxrc creates a FIFO
     2. linuxrc spawns the network login process using "&" to put it in
        the background
     3. linuxrc attempts to read a password from stdin
     4. if SIGINT is received, read the password from the fifo
     5. (by now, we have the password). kill the netlogin process
     6. mount to new root, pivot_root, exec init

     1. netlogin opens the FIFO
     2. netlogin attempts to read a password from the network
     3. if a password is read, then netlogin does "kill -INT 1"
     4. if a password is read, then netlogin writes it to the FIFO

That should work.

> init doesn't like this cause it is not PID 1.
> it can't talk to this pipe /dev/initctl in the chroot environment i
> guess. Could I make a symbolic link from the chroot'ed /dev/initctl
> file to the original /dev/initctl you think ?

No, because the init in the chroot'ed environment won't see the correct
scripts.

> 3
> Interestingly, if i boot into single user mode, and then execute the
> change_to_encrypted_root script, init is not bothered.
> this is no doubt because of the "wait" in the inittab (i think).
> ~~:S:wait:/sbin/sulogin

init must run as pid 1 to be init. Otherwise, it acts like initctl.


> Is there any reason not to use minit as a sort of "sub" process root ?
> I noticed a lsof shows init still "rooted" to the old root (now at
> /mnt/hda6/sbin/init). Is there anything amatter with this ?

Yes. It will look in <CHROOT>/etc/rc.X to find symlinks, for example. It
will start daemons in its chroot.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: