View previous topic :: View next topic |
Author |
Message |
psycho Guru
Joined: 22 Jun 2007 Posts: 534 Location: New Zealand
|
Posted: Thu Jan 05, 2023 2:32 am Post subject: [SOLVED] Shutdowns and restarts need persuading |
|
|
I'm posting this in "networking..." because I'm guessing it's related to the NFS shares on my NAS.
It's a very minor nuisance but I'm curious about what's causing it. On my first attempt at a restart or shutdown, the system takes a long time to respond... it doesn't hang or provide any error message, it just returns me to the cursor (so I can enter "shutdown -h now" ten times if I want, not that it helps) and eventually, after maybe 20 or 30 seconds, it finally shuts down or reboots.
On the other hand, all I have to do is switch to a new VT, or even just a new terminal window, and then the response to any shutdown or reboot command is consistently *immediate*. It's as though the response to the first instruction is "yeah yeah, when I'm ready..." but as soon as it comes from another terminal it's "oh, he's serious... OK then..." and whatever it apparently wasn't safe to do immediately before, suddenly it's fine.
What's going on there, and how can I persuade the system to do (in the first place) whatever it's doing when I tell it to shut down from another terminal while it's already dragging its heels in the first one? I know it's not clearing a cache or anything like that, partly because this happens even when I haven't been using the NFS shares, but mostly because (I assume) it would be a serious bug if it ignored some kind of actually-necessary tidying up process, because an instruction from a new terminal caught it off-guard.
Last edited by psycho on Sat Jan 07, 2023 4:43 am; edited 1 time in total |
|
Back to top |
|
|
Ralphred Guru
Joined: 31 Dec 2013 Posts: 494
|
Posted: Thu Jan 05, 2023 3:55 pm Post subject: Re: Shutdowns and restarts need persuading |
|
|
psycho wrote: | ... On my first attempt at a restart or shutdown ... |
What is issuing the command for the first attempt, and what command is it issuing?
Have you tried dropping /proc/sys/net/ipv4/tcp_syn_retries to 1 (one)? |
|
Back to top |
|
|
psycho Guru
Joined: 22 Jun 2007 Posts: 534 Location: New Zealand
|
Posted: Sat Jan 07, 2023 4:28 am Post subject: |
|
|
Thanks for the help Ralphred. It's funny how just having to explain the situation to someone else can expose oversights... I was half-way through typing "it makes no difference whether I shutdown -h now from the console or use the GUI shutdown tool in XFCE..." and then I remembered that I'd replaced that with my own little shutdown GUI (so I can e.g. "backup and shutdown" in addition to the normal options), which is just calling reboot or shutdown -h now itself... and sure enough, using the official xfce4-session-logout GUI *does* behave properly and immediately shut things down.
I'm guessing it will be that horrible *kit stuff... I probably need to change good old Code: | sudo shutdown -h now |
into something horrendous like Code: | dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop |
I'll give that a shot and will mark the issue solved if it works (as it probably will). Thanks again. |
|
Back to top |
|
|
psycho Guru
Joined: 22 Jun 2007 Posts: 534 Location: New Zealand
|
Posted: Sat Jan 07, 2023 4:42 am Post subject: |
|
|
LOL... it was much easier than that... turns out xfce4-session-logout has shell switches to do its stuff without the GUI, so it's just Code: | xfce4-session-logout --halt | to shut down immediately. Thanks again... problem solved. I think I'll alias "xfce4-session-logout --halt" as "die" |
|
Back to top |
|
|
C5ace Guru
Joined: 23 Dec 2013 Posts: 472 Location: Brisbane, Australia
|
Posted: Sat Jan 07, 2023 6:50 am Post subject: |
|
|
I use root terminal 'poweroff' or 'reboot'. Pull the power plug if nothing works anymore. Ext4 will fix any disk error on the next boot. _________________ Observation after 30 years working with computers:
All software has known and unknown bugs and vulnerabilities. Especially software written in complex, unstable and object oriented languages such as perl, python, C++, C#, Rust and the likes. |
|
Back to top |
|
|
psycho Guru
Joined: 22 Jun 2007 Posts: 534 Location: New Zealand
|
Posted: Sun Jan 08, 2023 9:14 pm Post subject: |
|
|
C5ace wrote: | I use root terminal 'poweroff' or 'reboot'. Pull the power plug if nothing works anymore. Ext4 will fix any disk error on the next boot. |
A root terminal "reboot" was one of the things that would hang for a long time. By contrast XFCE's xfce4-session-logout -r achieves the desired result instantly, as a normal user. Actually I see from the sysvinit documentation that "unlike older sysvinit releases, reboot and halt should never be called directly"... plus I see that the -h switch I've been sending shutdown for decades, to make sure write cache was flushed, has been redundant since I stopped using IDE drives, a long time ago... so basically I'm still in the stone age and need to get up to speed with whatever's been going on since folk invented iron tools. |
|
Back to top |
|
|
|