On Thu, Jun 14, 2007 at 11:04:51PM +0200, Blaisorblade wrote:
> On martedì 12 giugno 2007, Sylvain Beucler wrote:
> > On Mon, Jun 11, 2007 at 09:26:12PM +0000, Paolo Giarrusso wrote:
> > > If you run the open or openvt command, it will run bash on
> > > /dev/ttyXXX and there, you'll see that Ctrl-C works.
> >
> > Alas that doesn't seem to work from rootfstype:
> > # openvt /dev/tty0
> > Couldnt get a file descriptor referring to the console
> > Could not get a file descriptor referring to the console
> 
> That may mean that /dev/console couldn't be opened, which is actually 
> reasonable (on my system it's owned by root with perms 0600).

I replaced /dev with tmpfs + MAKEDEV console, but that doesn't help.

Well, actually I tried the command in a normal UML with a disk image
and it doesn't work either :)


> I suggested openvt for this - this area is related to session and process 
> group management, and involves things like setsid(1) (and setsid(2)) and 
> management of the controlling tty (I don't know the tiny details).

A more verbose output (with kernel trace) gives:
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
Couldnt get a file descriptor referring to the console
Could not get a file descriptor referring to the console

In a deboostrap:
# openvt 
Couldnt get a file descriptor referring to the console
/var/log/syslog:
Jun 15 16:28:56 sylvain kernel: line_ioctl: tty3: ioctl KDGKBTYPE called
Jun 15 16:28:56 sylvain kernel: line_ioctl: tty0: ioctl KDGKBTYPE called
Jun 15 16:28:56 sylvain kernel: line_ioctl: tty3: ioctl KDGKBTYPE called
Jun 15 16:28:56 sylvain last message repeated 2 times
Jun 15 16:29:18 sylvain kernel: line_write_room: tty3: no room left in buffer

(Btw, I also see this kind of output when starting UML:
Setting console screen modes and fonts.
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
line_ioctl: tty0: ioctl KDGKBTYPE called
INIT: Entering runlevel: 2)

With strace and rootfstype=hostfs:
...
brk(0)                                  = 0x804b000
brk(0x806c000)                          = 0x806c000
open("/dev/tty", O_RDWR)                = 3
ioctl(3, KDGKBTYPE, 0xbf63d9e3)         = -1 EINVAL (Invalid argument)
close(3)                                = 0
open("/dev/tty0", O_RDWR)               = 3
ioctl(3, KDGKBTYPE, 0xbf63d9e3)         = -1 EINVAL (Invalid argument)
close(3)                                = 0
open("/dev/console", O_RDWR)            = 3
ioctl(3, KDGKBTYPE, 0xbf63d9e3)         = -1 EINVAL (Invalid argument)
close(3)                                = 0
ioctl(0, KDGKBTYPE, 0xbf63da03)         = -1 EINVAL (Invalid argument)
ioctl(1, KDGKBTYPE, 0xbf63da03)         = -1 EINVAL (Invalid argument)
ioctl(2, KDGKBTYPE, 0xbf63da03)         = -1 EINVAL (Invalid argument)
write(2, "Couldnt get a file descriptor re"..., 55Couldnt get a file descriptor 
referring to the console
) = 55
write(2, "Could not get a file descriptor "..., 57Could not get a file 
descriptor referring to the console
) = 57
exit_group(2)                           = ?

With strace and a disk image:
munmap(0x40019000, 8504)                = 0
open("/dev/tty", O_RDONLY)              = 3
ioctl(3, KDGKBTYPE, 0xbfa31f37)         = -1 EINVAL (Invalid argument)
open("/dev/console", O_RDONLY)          = 4
ioctl(4, KDGKBTYPE, 0xbfa31f37)         = -1 EINVAL (Invalid argument)
ioctl(0, KDGKBTYPE, 0xbfa31f57)         = -1 EINVAL (Invalid argument)
ioctl(1, KDGKBTYPE, 0xbfa31f57)         = -1 EINVAL (Invalid argument)
ioctl(2, KDGKBTYPE, 0xbfa31f57)         = -1 EINVAL (Invalid argument)
write(2, "Couldnt get a file descriptor re"..., 55Couldnt get a file descriptor 
referring to the console
) = 55
exit_group(2)                           = ?
Process 1030 detached

So apparently this is not related to running rootfstype=hostfs.

I guess we can stick with a manual setsid(1) for now :)

-- 
Sylvain

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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