in initrd "exec sh /dev/console 2>&1" does not respond to keyboard

David Mathog mathog at caltech.edu
Wed Feb 27 22:01:30 UTC 2019


On 27-Feb-2019 12:01, David Mathog wrote:
> This:
> 
>   https://busybox.net/FAQ.html#job_control
> 
> suggests this might work with /dev/console (what tty shows)
> 
>   setsid cttyhack sh
> 
> Unfortunately that does not work either.  Same result, There is a
> prompt but input
> is ignored.

Reduced /init in the initrd.img to just:

#!/bin/busybox sh
mount -t devtmpfs none /dev
mount -t proc none /proc
mkdir -p /sys
mount -t sysfs none /sys
echo 0 > /proc/sys/kernel/printk
echo "tty, sleep 5"
tty
sleep 5
setsid /bin/cttyhack /bin/sh

And it emits

tty, sleep 5
/dev/console
/ #

and then ignores all keyboard input.  This was through a KVM, but it 
does the same thing with the USB keyboard plugged straight into it.

The only active programs on this system are busybox, mount, and the 
kernel.  Not sure what starts "init" but it is probably the kernel 
itself.  So there is no place before init to use something other than 
/dev/console, and /dev/console
will not accept input after any of these:

exec /binsh
exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
setsid /bin/cttyhack /bin/sh

This is really frustrating!  Perhaps there is some kernel parameter for 
3.10.108 kernels which needs to be set (or unset)???  These are built 
into the kernel, seems like they should be enough

CONFIG_HID=y
CONFIG_HID_GENERIC=y
CONFIG_USB_HID=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB=y


Thanks,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech


More information about the busybox mailing list