* /etc/runit/3 not executing correctly... @ 2004-07-26 16:10 John Nielsen 2004-07-26 16:18 ` Laurent Bercot 0 siblings, 1 reply; 10+ messages in thread From: John Nielsen @ 2004-07-26 16:10 UTC (permalink / raw) Hi all, Im trying to set up runit on my system and has hit a wall. Every time the 3 script executes svwaitdown, it exits the script without finishing. The script looks like this. I have put in echo lines so i can see exactly when the script stops. #!/bin/sh echo 1 exec 2>&1 echo 2 PATH=/sbin:/bin:/usr/sbin:/usr/bin echo 3 LAST=0 echo 4 test -x /etc/runit/reboot && LAST=6 echo 5 echo 'Waiting for getties to stop...' echo 6 svwaitdown -xk -t10 /var/service/getty-* echo 7 echo 'Waiting for services to stop...' echo 8 svwaitdown -xk -t30 /var/service/* echo 9 With this script the last number being printet is "6". After that, it just gives me the normal "Unmounting any remaining file systems. Now you can turn off the power", so it exits somewhere while executing the first svwaitdown command. The other scripts are working fine. Has anyone run into this problem before? At this point I would even welcome RTFM pointers. :-) Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-26 16:10 /etc/runit/3 not executing correctly John Nielsen @ 2004-07-26 16:18 ` Laurent Bercot 2004-07-26 18:06 ` John Nielsen 0 siblings, 1 reply; 10+ messages in thread From: Laurent Bercot @ 2004-07-26 16:18 UTC (permalink / raw) Just a silly idea : > echo 'Waiting for getties to stop...' > echo 6 > svwaitdown -xk -t10 /var/service/getty-* What if you insert "exec > /dev/console 2>/dev/console" here ? > With this script the last number being printet is "6". After that, it just > gives me the normal "Unmounting any remaining file systems. Now you can turn > off the power", so it exits somewhere while executing the first svwaitdown > command. If you can boot your system again without an fsck, it means that the other services have stopped properly - so your script finished correctly. I guess that it does finish, but the "echo" commands don't print anything on the screen because of some weird VC deallocation thing happening when the gettys die. -- Ska ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-26 16:18 ` Laurent Bercot @ 2004-07-26 18:06 ` John Nielsen 2004-07-27 10:43 ` Gerrit Pape 0 siblings, 1 reply; 10+ messages in thread From: John Nielsen @ 2004-07-26 18:06 UTC (permalink / raw) On Monday 26 July 2004 18:18, Laurent Bercot wrote: > Just a silly idea : > > echo 'Waiting for getties to stop...' > > echo 6 > > svwaitdown -xk -t10 /var/service/getty-* > > What if you insert "exec > /dev/console 2>/dev/console" here ? Sorry, that didnt change anything. > > With this script the last number being printet is "6". After that, it > > just gives me the normal "Unmounting any remaining file systems. Now you > > can turn off the power", so it exits somewhere while executing the first > > svwaitdown command. > > If you can boot your system again without an fsck, it means that the > other services have stopped properly - so your script finished correctly. > I guess that it does finish, but the "echo" commands don't print anything > on the screen because of some weird VC deallocation thing happening when > the gettys die. I use reiserfs, so fsck wouldnt run anyway. :-) But it doesnt replay the log when mounting which means it umounted properly. The last message i get from runit (not from the script) is "unmounting any remaining filesystems", so that would explain the clean mount. Allso, I tried to pipe all of the echo lines out to a file instead to see if it was just a strange screen problem, but the output still stopped at 6, so the execution of the scripts stops at the first svwaitdown line, but runit itself doesnt stop the shutdown. Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-26 18:06 ` John Nielsen @ 2004-07-27 10:43 ` Gerrit Pape 2004-07-27 16:23 ` John Nielsen 0 siblings, 1 reply; 10+ messages in thread From: Gerrit Pape @ 2004-07-27 10:43 UTC (permalink / raw) On Mon, Jul 26, 2004 at 08:06:49PM +0200, John Nielsen wrote: > On Monday 26 July 2004 18:18, Laurent Bercot wrote: > > > With this script the last number being printet is "6". After that, it > > > just gives me the normal "Unmounting any remaining file systems. Now you > > > can turn off the power", so it exits somewhere while executing the first > > > svwaitdown command. > > > > If you can boot your system again without an fsck, it means that the > > other services have stopped properly - so your script finished correctly. > > I guess that it does finish, but the "echo" commands don't print anything > > on the screen because of some weird VC deallocation thing happening when > > the gettys die. > > I use reiserfs, so fsck wouldnt run anyway. :-) But it doesnt replay the log > when mounting which means it umounted properly. The last message i get from > runit (not from the script) is "unmounting any remaining filesystems", so > that would explain the clean mount. That message is not from runit, did you post your complete stage 3 script, or only a top part of it? > Allso, I tried to pipe all of the echo lines out to a file instead to see if > it was just a strange screen problem, but the output still stopped at 6, so > the execution of the scripts stops at the first svwaitdown line, but runit > itself doesnt stop the shutdown. Hmm. If you have a getty service running on console 1, I suggest to disable this service, login on console 2, run `init 6`, then immediately logout from console 2, and switch to console 1. Does this change anything? If not, I would do the following: login on console 2 only, no other login. Take down all services but the getty-2 service manually, and make sure they're down. Then reboot by running `init 6`, logout from console 2 and switch to console 1. BTW, what operating system are you using? HTH, Gerrit. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-27 10:43 ` Gerrit Pape @ 2004-07-27 16:23 ` John Nielsen 2004-07-27 16:55 ` John Nielsen 0 siblings, 1 reply; 10+ messages in thread From: John Nielsen @ 2004-07-27 16:23 UTC (permalink / raw) On Tuesday 27 July 2004 12:43, Gerrit Pape wrote: > On Mon, Jul 26, 2004 at 08:06:49PM +0200, John Nielsen wrote: > > On Monday 26 July 2004 18:18, Laurent Bercot wrote: > > > > With this script the last number being printet is "6". After that, it > > > > just gives me the normal "Unmounting any remaining file systems. Now > > > > you can turn off the power", so it exits somewhere while executing > > > > the first svwaitdown command. > > > > > > If you can boot your system again without an fsck, it means that the > > > other services have stopped properly - so your script finished > > > correctly. I guess that it does finish, but the "echo" commands don't > > > print anything on the screen because of some weird VC deallocation > > > thing happening when the gettys die. > > > > I use reiserfs, so fsck wouldnt run anyway. :-) But it doesnt replay the > > log when mounting which means it umounted properly. The last message i > > get from runit (not from the script) is "unmounting any remaining > > filesystems", so that would explain the clean mount. > > That message is not from runit, did you post your complete stage 3 > script, or only a top part of it? Yes, I posted all of the script. I had cut it down as much as possible to troubleshoot. I really dont know where that message somes from then? That textstring "Unmounting any remaining filesystems" doesnt exist in any of the existing boot scripts. I just doublechecked, and it isnt there. Where else could it come from? The kernel itself? > > > Allso, I tried to pipe all of the echo lines out to a file instead to see > > if it was just a strange screen problem, but the output still stopped at > > 6, so the execution of the scripts stops at the first svwaitdown line, > > but runit itself doesnt stop the shutdown. > > Hmm. If you have a getty service running on console 1, I suggest to > disable this service, login on console 2, run `init 6`, then immediately > logout from console 2, and switch to console 1. Does this change > anything? Success!!! Why can i see it from an inactive console and not from a logged in console? How could that be blocked? When i shut down like this, all of the "echo * >> /test" lines i put into the 3 script are updating the /test file correctly, meaning the script finishes this time. Does this tell you anything? > If not, I would do the following: login on console 2 only, no other > login. Take down all services but the getty-2 service manually, and > make sure they're down. Then reboot by running `init 6`, logout from > console 2 and switch to console 1. > > BTW, what operating system are you using? It is a linux distro build from scratch. We have removed the sysvinit package completely, so the halt and shutdown commands are taken from the util-linux package instead. Might there be issues with this? Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-27 16:23 ` John Nielsen @ 2004-07-27 16:55 ` John Nielsen 2004-07-27 18:26 ` John Nielsen 0 siblings, 1 reply; 10+ messages in thread From: John Nielsen @ 2004-07-27 16:55 UTC (permalink / raw) > > That message is not from runit, did you post your complete stage 3 > > script, or only a top part of it? > > Yes, I posted all of the script. I had cut it down as much as possible to > troubleshoot. > > I really dont know where that message somes from then? That textstring > "Unmounting any remaining filesystems" doesnt exist in any of the existing > boot scripts. I just doublechecked, and it isnt there. Where else could it > come from? The kernel itself? I found out where the message comes from. It is generated by the util-linux version of shutdown I am using. Its last action before it halts the computer is to umount everything that is left. I then tried to reinstall the sysvinit version of shutdown and that worked a lot better. So all of this seems to be caused by util-linux shutdown not wanting to play nice with runit. I would really love to be abel to completely dump the sysvinit package. I guess my case is a special one since I am not using a standart distro. Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-27 16:55 ` John Nielsen @ 2004-07-27 18:26 ` John Nielsen 2004-07-27 18:42 ` Charlie Brady 2004-07-28 8:25 ` Gerrit Pape 0 siblings, 2 replies; 10+ messages in thread From: John Nielsen @ 2004-07-27 18:26 UTC (permalink / raw) On Tuesday 27 July 2004 18:55, John Nielsen wrote: > > > That message is not from runit, did you post your complete stage 3 > > > script, or only a top part of it? > > > > Yes, I posted all of the script. I had cut it down as much as possible to > > troubleshoot. > > > > I really dont know where that message somes from then? That textstring > > "Unmounting any remaining filesystems" doesnt exist in any of the > > existing boot scripts. I just doublechecked, and it isnt there. Where > > else could it come from? The kernel itself? > > I found out where the message comes from. It is generated by the util-linux > version of shutdown I am using. Its last action before it halts the > computer is to umount everything that is left. > > I then tried to reinstall the sysvinit version of shutdown and that worked > a lot better. > > So all of this seems to be caused by util-linux shutdown not wanting to > play nice with runit. > > I would really love to be abel to completely dump the sysvinit package. I > guess my case is a special one since I am not using a standart distro. I feel lonely like this, replying to myself all the time. :-) I solved the problem. Instead of trying to make the util-linux versions of the files work, I wrote my own damn files! Actueally they are shell scripts calling init with different paramenters. They appear to work like a charm. I allso got ctrl-alt-del to work as i want. This is definetely starting to look like something. I noticed a strange problem however. Every time i shut down, the getties dies except for the getties that are logged in. I have to start the shutdown script and then log out on that console. I know that I can specify a timeout on svwaitdown that kills the service when the timeout has been reached, only this doesnt seem like a very clean shutdown. Is it possible to shut down the session cleanly without killing it? Im talking about something along the lines of what sysvinit does. Im guessing something you would put in the /etc/runit/getty-*/finish script. Any ideas? Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-27 18:26 ` John Nielsen @ 2004-07-27 18:42 ` Charlie Brady 2004-07-28 8:25 ` Gerrit Pape 1 sibling, 0 replies; 10+ messages in thread From: Charlie Brady @ 2004-07-27 18:42 UTC (permalink / raw) Cc: supervision On Tue, 27 Jul 2004, John Nielsen wrote: > > I found out where the message comes from. It is generated by the util-linux > > version of shutdown I am using. Its last action before it halts the > > computer is to umount everything that is left. > > > > I then tried to reinstall the sysvinit version of shutdown and that worked > > a lot better. > > > > So all of this seems to be caused by util-linux shutdown not wanting to > > play nice with runit. So don't use util-linux's shutdown :-) > > I would really love to be abel to completely dump the sysvinit package. I > > guess my case is a special one since I am not using a standart distro. > > I feel lonely like this, replying to myself all the time. :-) > > I solved the problem. Instead of trying to make the util-linux versions of the > files work, I wrote my own damn files! /etc/runit/stopit, /etc/runit/reboot and /etc/runit/3 should do all. > Actueally they are shell scripts calling init with different paramenters. They > appear to work like a charm. I allso got ctrl-alt-del to work as i want. This > is definetely starting to look like something. > > I noticed a strange problem however. Every time i shut down, the getties dies > except for the getties that are logged in. I have to start the shutdown > script and then log out on that console. I'd guess that is because getty is responding correctly to the TERM signal, but whatever you replace getty with (login, or a successor) does not. > I know that I can specify a timeout on svwaitdown that kills the service when > the timeout has been reached, only this doesnt seem like a very clean > shutdown. Is it possible to shut down the session cleanly without killing it? Yes and no. All you can do is give the session leader a HUP or TERM signal. You want it to respond appropriately to that signal, and tidy everything up and then exit. But it could just ignore the signal, in which case you need a bigger hammer (e.g. a QUIT signal, or -9). > Im talking about something along the lines of what sysvinit does. Im guessing > something you would put in the /etc/runit/getty-*/finish script. Those scripts won't necessarily be run when you want them to. Charlie ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-27 18:26 ` John Nielsen 2004-07-27 18:42 ` Charlie Brady @ 2004-07-28 8:25 ` Gerrit Pape 2004-07-28 17:03 ` John Nielsen 1 sibling, 1 reply; 10+ messages in thread From: Gerrit Pape @ 2004-07-28 8:25 UTC (permalink / raw) On Tue, Jul 27, 2004 at 08:26:35PM +0200, John Nielsen wrote: > On Tuesday 27 July 2004 18:55, John Nielsen wrote: > > > > That message is not from runit, did you post your complete stage > > > > 3 script, or only a top part of it? > > > > > > Yes, I posted all of the script. I had cut it down as much as > > > possible to troubleshoot. You should extend it. Stage 3 is meant to do all tasks necessary to prepare the system for shutdown, this includes stopping services and unmounting (mounting read-only) filesystems. After stage 3 has finished, runit tells the kernel to shutdown or reboot (depending on the permissions of /etc/runit/reboot). > > > I really dont know where that message somes from then? That > > > textstring "Unmounting any remaining filesystems" doesnt exist in > > > any of the existing boot scripts. I just doublechecked, and it > > > isnt there. Where else could it come from? The kernel itself? > > I found out where the message comes from. It is generated by the > > util-linux version of shutdown I am using. Its last action before it > > halts the computer is to umount everything that is left. > > So all of this seems to be caused by util-linux shutdown not wanting > > to play nice with runit. Yes, util-linux's shutdown does things stage 3 actually should do, from the man page: When the shutdown time arrives, shutdown notifies all users, tells init(8) not to spawn more getty(8)'s, writes the shutdown time into the /var/log/wtmp file, kills all other processes on the system, sync(2)'s, unmounts all the disks, sync(2)'s again, waits for a second, and then either terminates or reboots the system. Additionally it seems to work with some fixed timeout. The shutdown program killed your stage 3 script and rebooted the system while runit still was preparing the shutdown. > > I would really love to be abel to completely dump the sysvinit > > package. I guess my case is a special one since I am not using a > > standart distro. As Charlie already said, simply don't use a shutdown program, extend stage 3, and use `init 0` and `init 6` instead. > I noticed a strange problem however. Every time i shut down, the > getties dies except for the getties that are logged in. I have to > start the shutdown script and then log out on that console. That's normal, see Charlie's answer on this. > I know that I can specify a timeout on svwaitdown that kills the > service when the timeout has been reached, only this doesnt seem like > a very clean shutdown. Is it possible to shut down the session cleanly > without killing it? Im talking about something along the lines of > what sysvinit does. What's sysvinit doing? AFAICS it kills -9 your shell, but doesn't tell you about that. Regards, Gerrit. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /etc/runit/3 not executing correctly... 2004-07-28 8:25 ` Gerrit Pape @ 2004-07-28 17:03 ` John Nielsen 0 siblings, 0 replies; 10+ messages in thread From: John Nielsen @ 2004-07-28 17:03 UTC (permalink / raw) On Wednesday 28 July 2004 10:25, Gerrit Pape wrote: > On Tue, Jul 27, 2004 at 08:26:35PM +0200, John Nielsen wrote: > > On Tuesday 27 July 2004 18:55, John Nielsen wrote: > > > > > That message is not from runit, did you post your complete stage > > > > > 3 script, or only a top part of it? > > > > > > > > Yes, I posted all of the script. I had cut it down as much as > > > > possible to troubleshoot. > > You should extend it. Stage 3 is meant to do all tasks necessary to > prepare the system for shutdown, this includes stopping services and > unmounting (mounting read-only) filesystems. Yes, I know. I used to have a lot more in it. I just cut it down in order to better troubleshoot it. I have allready cut and pasted most of my old script into stage 3. Im going to clean it up later. > After stage 3 has finished, runit tells the kernel to shutdown or reboot (depending on the > permissions of /etc/runit/reboot). Aah, so thats how it tells the different between a halt and a reboot. Thanks. > > > > I really dont know where that message somes from then? That > > > > textstring "Unmounting any remaining filesystems" doesnt exist in > > > > any of the existing boot scripts. I just doublechecked, and it > > > > isnt there. Where else could it come from? The kernel itself? > > > > > > I found out where the message comes from. It is generated by the > > > util-linux version of shutdown I am using. Its last action before it > > > halts the computer is to umount everything that is left. > > > > > > So all of this seems to be caused by util-linux shutdown not wanting > > > to play nice with runit. > > Yes, util-linux's shutdown does things stage 3 actually should do, from > the man page: > > When the shutdown time arrives, shutdown notifies all users, tells > init(8) not to spawn more getty(8)'s, writes the shutdown time into the > /var/log/wtmp file, kills all other processes on the system, sync(2)'s, > unmounts all the disks, sync(2)'s again, waits for a second, and then > either terminates or reboots the system. > Additionally it seems to work with some fixed timeout. The shutdown > program killed your stage 3 script and rebooted the system while runit > still was preparing the shutdown. So thats what happened. I definetely dont want shutdown to go around killing processes. I want that honor myself. :o) > > > > I would really love to be abel to completely dump the sysvinit > > > package. I guess my case is a special one since I am not using a > > > standart distro. > > As Charlie already said, simply don't use a shutdown program, extend > stage 3, and use `init 0` and `init 6` instead. > > > I noticed a strange problem however. Every time i shut down, the > > getties dies except for the getties that are logged in. I have to > > start the shutdown script and then log out on that console. > > That's normal, see Charlie's answer on this. > > > I know that I can specify a timeout on svwaitdown that kills the > > service when the timeout has been reached, only this doesnt seem like > > a very clean shutdown. Is it possible to shut down the session cleanly > > without killing it? Im talking about something along the lines of > > what sysvinit does. > > What's sysvinit doing? AFAICS it kills -9 your shell, but doesn't tell > you about that. I think i wasnt very clear in my description. Let me try and elaborate. Sysvinit first asks everyone nicely to shut down. After a few seconds it uses the chainsaw on everything left before it continues. This gives well behaving programs a chance to exit gracefully and it gives badly written programs what they deserver. This lets the getty exit cleanly as far as I understand. Runit on the other hand (I am new to this so please correct me if im wrong) asks all of the getties nicely to get out. This runs the finish script for each getty that shuts down cleanly and updates utmp. The getties that are logged in doesnt exit cleanly like this, gets seriously pummeled and doesnt get to run "finish" which doesnt update utmp. (right?) My question is basicly if it is possible to nuke the console while leaving getty intact. This would allow getty to exit cleanly. If the only getties that updates utmp are the ones that are not logged in, then whats the point? If im missing something obvious, please let me know. Regards, John ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-07-28 17:03 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-07-26 16:10 /etc/runit/3 not executing correctly John Nielsen 2004-07-26 16:18 ` Laurent Bercot 2004-07-26 18:06 ` John Nielsen 2004-07-27 10:43 ` Gerrit Pape 2004-07-27 16:23 ` John Nielsen 2004-07-27 16:55 ` John Nielsen 2004-07-27 18:26 ` John Nielsen 2004-07-27 18:42 ` Charlie Brady 2004-07-28 8:25 ` Gerrit Pape 2004-07-28 17:03 ` John Nielsen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).