After playing with con:port, and its use in a chroot, I wonder if
those with versions of UML documentation which refer to con:port would
find the following two pieces of information useful:
---

*** Avoiding the hang during boot for telnet :port consoles ***

Some sites suggest that :port will work well so long as the console in
question is not the "main console". Other sites suggest that "If you
attach the main console to a portal, then the UML boot will appear to
hang. In reality, it's waiting for a telnet to connect, at which point
the boot will proceed." It turns out that this deserves more
explanation.

One example to making use of :port could be something like:
 con=none con0=null,fd:1 con1=fd:0,fd:2 con2=port:5000
In this example we use normal stdin/stdout/stderr to give us output
from con0, and direct console access on con1 from the current session.
console2 is only accessible using
  telnet localhost 5000
A suitable /etc/inittab for this could be:
  1:2345:respawn:/sbin/mingetty tty1
  2:2345:respawn:/sbin/mingetty tty2
  #3:2345:respawn:/sbin/mingetty tty3
  #4:2345:respawn:/sbin/mingetty tty4
  #5:2345:respawn:/sbin/mingetty tty5
  #6:2345:respawn:/sbin/mingetty tty6

This example would possibly hang until the telnet command was
executed. It seems that UML blocks if the telnet has not connected AND
there is an attempt to write to that console. For tty1 a write is hard
to avoid during boot (so dont use :port for tty1/console1), but for
tty2 and beyond the solution is simple... avoid the write.

In Fedora 2, tty2 and beyond are only written to in one place, from
within the /etc/rc.sysinit file. Do something like:
  grep inittab /etc/rc.sysinit
This produces
  for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty'
/etc/inittab | sed 's/^.*
  tty\([0-9][0-9]*\).*/\1/g'`; do
Now, just replace [0-9] with [0-1] and you are finished. No more
hangs. Note that Fedora 7 does not seem to have this line, and so the
hang should not happen long as tty1 is not a telnet-based :port
console.

*** Using this in a chroot ***

A chroot UML which uses :port seems to need the following to be
available in the chroot
$JAIL/usr/sbin/in.telnetd
$JAIL/usr/lib/uml/port-helper
mknod $JAIL/dev/ptmx c 5 2
mkdir $JAIL/dev/pts
mount --bind /dev/pts $JAIL/dev/pts

If in.telnetd and port-helper are dynamically compiled, you need their
libraries to (you can use ldd to find this out). For me, this was
mkdir $JAIL/lib
cp -p /lib/libutil.so.1 $JAIL/lib
cp -p /lib/libc.so.6 $JAIL/lib
cp -p /lib/ld-linux.so.2 $JAIL/lib

Your UML process does not need to be root for this to work.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to