5

I'm using CentOS 6.4 and have a small problem with using read in /etc/rc.local file. It will allow keyboard entry but does not echo any of the key strokes during input. This is something that worked fine in CentOS 5.5.

Anyone know what's going on here?

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
echo -n "name? "
read name
echo "Name: $name"
touch /var/lock/subsys/local

produces (/var/log/boot.log):

name? Name: john

  • If this has all been directly placed in rc.local, try placing it in a separate bash script, and have a command to run that instead in rc.local – Wilf Dec 17 '13 at 23:36
2

I wonder if this is your issue?

I found this CentOS forum thread titled: [SOLVED] User input during rc.local?.

excerpt of problem

I'm attempting to mount an encrypted drive during the execution of the rc.local file. It prompts for a password, but upon the second keypress, it appears to be receiving a crlf (or whatever) and attempts to unlock the drive - failing, since I wasn't silly enough to encrypt it with a two character passcode.

To which the apparent answer is to disable plymouth first.

You cannot run interactive scripts from rc.local unless you first run 'plymouth quit'.

What's Plymouth?

excerpt from Freedesktop.org

Plymouth is an application that runs very early in the boot process (even before the root filesystem is mounted!) that provides a graphical boot animation while the boot process happens in the background.

It is designed to work on systems with DRM modesetting drivers. The idea is that early on in the boot process the native mode for the computer is set, plymouth uses that mode, and that mode stays throughout the entire boot process up to and after X starts. Ideally, the goal is to get rid of all flicker during startup.

Solving your issue

So I believe all you'd need to do is prior to running your read command is to make use you put in rc.local the command:

plymouth quit
  • That did the trick. Works perfectly now. Plymouth has caused me more pain in the last month with various startup issues.. – GoinOff Dec 18 '13 at 15:18
  • @GoinOff - the whole startup switch has been a pain in the butt to me as well. I've only just now moved to Fedora 19 from 14 for this exact reason. Am still learning how it all differs from before. Slowly adapting, but it's been painful! – slm Dec 18 '13 at 15:34
  • Hopefully, these posts will help others when they go down the same path looking for answers. Thx!!! – GoinOff Dec 18 '13 at 15:48
  • @GoinOff - yes, that's why I took the time to explain Plymouth etc. This will help to get it ranked higher in Google. Thanks for asking your Q BTW. – slm Dec 18 '13 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.