SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using slax-atma on an hp laptop (related to slax)
I have put an sh script which prompts user to enter input using read command, in rc.6 .
When I shutdown the laptop using the Turn off option in K menu (using mouse), everything works perfectly.It will prompt to input and do what is said in script.
But if I shutdown the laptop by pressing the power button. It prompts, but never take any input we type on keyboard.
What might be the problem? I could not find any reason..
Linux is a multi-user O/S. There could (theoretically for you, practically for other
people) be other users logged into your box. When you click something to take an
action, Linux knows where the input is coming from - ie which user. In that case
it would be the guy who just pushed the button on THAT keyboard/mouse combination.
But pushing the power button is something else - that's not on the keyboard.
Try thinking in terms of a headless server. Anyone with root permission can switch
the box off by running certain commands (eg poweroff, halt, etc) from a remote
ssh/telnet connection.
But anyone with physical access to the box (and maybe not root capable) can switch
the box off by merely pushing the power button, or even pulling the power cord.
It's possible to add more screens, keyboards and mouses (mice ?) to a low-end
PC (via usb and extra vga cards) and with some fancy xorg.conf footwork you can
make the physical machine handle 2 or 3 people concurrently. Then if someone
pushed the power button, where would the input that you desire be requested from ?
With some real fancy programming it may be possible to try and identify what the
current physical (if there is one) screen is and try to send some sort of message
to it - but you would probably be wasting your time.
Thanks for the reply. While booting up, it takes input from the keyboard perfectly well. Which I guess is because the booting is done in single user mode before going to the runlevel for multiuser. Am I right?
If it is so, wouldn't I be able to re-enter the single user mode while shuting down?
Thanking you,
Joe
Wow - interesting question. I can tell you that's there's very few Unix people
who spend more than a few seconds in single-user mode - what you might call a
fleeting moment. And with the quest for faster boot-ups, it's going to become
even more fleeting.
I'm really not sure if the machine does go into single-user mode whilst shutting
down - but that shouldn't be too hard to find out. I think it would be a matter
of putting some debug statements (appending details to a certain log file) into the
rc scripts.
I know that some of the other linux distro's use the rc levels, which make a big
distinction between shutting down and starting up. I don't believe that Slackware
does this. Pity. While the Slack way is simpler, it's almost certainly no longer the
standard way, and some element of features/control is lost.
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Rep:
Quote:
I know that some of the other linux distro's use the rc levels, which make a big
distinction between shutting down and starting up. I don't believe that Slackware
does this. Pity. While the Slack way is simpler, it's almost certainly no longer the
standard way, and some element of features/control is lost.
Sorry Mark - you are incorrect here. All Linuxes use runlevels to control the system via init and inittab - Slackware included. The difference is other Linuxes link to SystemV style init scripts from inittab to control the runlevels. Slackware has the "BSD" style init scripts which are different however hooks are in place to call SystemV scripts if so desired. The outcome is you may put SystemV scripts in place if you want - the best of both worlds. Slackware in no way looses any control by it's setup and , in my opinion, is far superior than the SystemV style with links all over the place for runlevels!
Quote:
I'm really not sure if the machine does go into single-user mode whilst shutting
down - but that shouldn't be too hard to find out
Slackware doesn't enter runlevel 1, (single user mode), on reboot.
Quote:
If it is so, wouldn't I be able to re-enter the single user mode while shutting down?
The point is you shouldn't really have to. The script /etc/rc.d/rc.local_shutdown is called from rc.6 in Slackware when going to runlevel 0 (halt) or 6 (reboot) and this is the normal place for shutdown scripts. Output from this is sent to the console and so remotely attached users (ssh/terminals/etc.) won't see this.
I take it from all this that your Linux is setup to shutdown when pressing the power button and this runs the shutdown scripts. I can't explain why your example isn't working - possibly the "power button" shutdown is calling some acpid script and missing a normal shutdown step ? Additionally I'm not sure how much slax-atma fudges Slackware to implement features. What seems apparent, (and perhaps obvious), is that, on your distro, the "power off button" shutdown is not acting the same as K menu or "poweroff/shutdown" commands.
Isn't it lovely to learn something new ! I've been using Slackware for well over
9 years and the "absence" of shutdown notification always bugged me. I'm used to
having the rc.0/6 capability on the Solaris boxes I work on.
But as for my personal machine running Slack - no such luck .. and maybe no such need !
And now for the first time I hear about rc.local_shutdown. I immediately looked for it,
and did not find it - ie it's not created on my machine. But sure enough, a quick grep
in the /etc/rc.d showed it to be called from rc.K.
Most likely you carry your rc.local across from previous installs but the comments in a vanilla one are as follows
Quote:
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.