Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Shutdowns and restarts need persuading
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Thu Jan 05, 2023 2:32 am    Post subject: [SOLVED] Shutdowns and restarts need persuading Reply with quote

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
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 494

PostPosted: Thu Jan 05, 2023 3:55 pm    Post subject: Re: Shutdowns and restarts need persuading Reply with quote

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
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Sat Jan 07, 2023 4:28 am    Post subject: Reply with quote

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
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Sat Jan 07, 2023 4:42 am    Post subject: Reply with quote

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" :D
Back to top
View user's profile Send private message
C5ace
Guru
Guru


Joined: 23 Dec 2013
Posts: 472
Location: Brisbane, Australia

PostPosted: Sat Jan 07, 2023 6:50 am    Post subject: Reply with quote

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
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Sun Jan 08, 2023 9:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum