I need to start a Bash script containing calls to dialog at Debian boot time. This is how I've been able to do it:

  • Unset default root password
  • Set --autologin option to tty1 in initrd (1:2345:respawn:/sbin/getty --autologin root tty1)
  • Write the full path of my script in /etc/rc.local

However, dialog has an unusual behaviour: the box appears, but then stdin seems to be overflowing stdout. When I press the arrow keys, no button is selected, but instead, corresponding ASCII chars are displayed on top of the dialog box, starting from the default choice position:

display bug in dialog

Note that if I then press enter, the keys are sent to dialog and corresponding option is selected as intended. The script has been testing working when executed normally.

I suppose something is missing in the shell initialization: if I put /bin/bash in rc.local, I get no job control in this shell message, and can't send signal to processes nor get pids (I get question marks instead of pids in top).

Why is this behaviour and how can I overcome it?


2 Answers 2


It seems that any interactive script launched from rc.local will have similar issues with stdin. I found a workaround on superuser:

Just launch your script using openvt -s -w /path/to/script.sh

(explanation at the original post)


The console is not connected to stdin of the whiptail process.

It looks like the same issue as seen in rc.local with read will not echo key strokes.

The suggested answer there is to add plymouth quit before attempting console input.

Alternatively, it may be possible to arrange for Plymouth itself to display your warning; something like

 plymouth pause-progress 
 plymouth message --text="Your system will be hosed.  Is that what you want?  What you really, really want? [yn]" 
 plymouth watch-keystroke --keys="YyNn " --command="tee /tmp/key_pressed"
 case $(cat /tmp/key_pressed) in
         poweroff;          # abort!
 plymouth message --text="Okay, you asked for this" 
 plymouth unpause-progress

Caveat: I'm not a Plymouth expert, and haven't tried the above.

  • It did not do the trick, plymouth is not installed on my system. However the link you provided helped me find a solution (which I'm going to post next ). Thanks!
    – pedroapero
    Commented Apr 30, 2015 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .