Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemctl: do not shutdown immediately on scheduled shutdown #18010

Closed
wants to merge 1 commit into from

Conversation

joalif
Copy link

@joalif joalif commented Dec 17, 2020

When, for whatever reason, a scheduled shutdown fails to be set, system
will proceed with immediate shutdown without allowing the user to react.
This is counterintuitive because when a scheduled shutdown is issued,
it means the user wants to shutdown at a specified time in the future,
not immediately. This patch prevents the immediate shutdown and informs
the user that no action will be taken.

Fixes: #17575

When, for whatever reason, a scheduled shutdown fails to be set, system
will proceed with immediate shutdown without allowing the user to react.
This is counterintuitive because when a scheduled shutdown is issued,
it means the user wants to shutdown at a specified time in the future,
not immediately. This patch prevents the immediate shutdown and informs
the user that no action will be taken.

Fixes: systemd#17575
@poettering
Copy link
Member

Did you follow the discussion on the issue? Why not just do what our documentation says and install D-Bus?

@guilhermepiccoli
Copy link

Did you follow the discussion on the issue? Why not just do what our documentation says and install D-Bus?

What if d-bus is installed, but for some reason, the daemon is broken (like segfault)? Then users schedule a shutdown, and end-up having the machine rebooting immediately, this seems not the proper approach.
And as far as I understand from the discussion on the issue, everybody (except you) seems to agree that the current behavior is sub-optimal.

@poettering
Copy link
Member

What if d-bus is installed, but for some reason, the daemon is broken (like segfault)? Then users schedule a shutdown, and end-up having the machine rebooting immediately, this seems not the proper approach.

Uh. Seriously. If D-Bus doesn't work, then scheduled shutdowns are the least of your concerns.

And as far as I understand from the discussion on the issue, everybody (except you) seems to agree that the current behavior is sub-optimal.

Yeah, but your change is suboptimal too, hence no benefit. And in contrast I have to deal with the fallout from this patch, i.e. that next person will come and complain that they asked for a shutdown and it didn't happen.

@bluca
Copy link
Member

bluca commented Dec 18, 2020

And as far as I understand from the discussion on the issue, everybody (except you) seems to agree that the current behavior is sub-optimal.

Well not really, I also think the current behaviour is the best compromise as well you can make in an highly unusual and abnormal situation. Shutdown means shutdown. Also, changing behaviour would be a compatibility breakage in the systemctl interface, since it's pretty much always been that way AFAIK. And we are not too keen on those - tend to make users quite upset for some reason :-)

@joalif
Copy link
Author

joalif commented Dec 18, 2020

@poettering stopping D-Bus is just the easiest way to reproduce the issue, not the real issue here.
As it's mentioned in the issue (and in the sources comments), this happens when logind fails.
I understand both point of views on whether to shutdown or not. The only reason I'm in favour of not
shutting down immediately is in case the user is running something important that should not be interrupted,
hence the patch.

@mcv21
Copy link

mcv21 commented Jan 11, 2021

Did you follow the discussion on the issue? Why not just do what our documentation says and install D-Bus?

Can I refer you to my comment on the issue @poettering explaining how this problem was causing us problems in a real-world deployment (nothing to do with not installing D-Bus)?

@poettering
Copy link
Member

Well, that's an isolated anecdotal incident. I am pretty sure that other people would have preferred if the machine rebooted at all, to get it back into an operational state at all. i.e. reboot is an effective form of recovery in a failed state, and hence we should do it, if people ask for it, as good as we can.

Anyway, sure, I see you disagree with this, and that's fine. Thing is, to change behaviour like this I think we need a good reason to plus a clear understanding that the changed behaviour would be sufficiently better than the status quo ante. I don't see that here at all. Sure, there are scenarios where not rebooting is better than rebooting immediately, but I doubt it's the clearly dominant scenario. And if it's this vague I am pretty sure we shouldn't change behaviour on this.

I hope this is a viewpoint one can understand, even if one might disagree with it.

Hence closing.

@poettering poettering closed this Jan 11, 2021
@mp15
Copy link

mp15 commented Jan 11, 2021

Would not a more reasonable compromise would be to make this a configurable behaviour?

Even if it is an anecdotal incident, the fact remains it caused a dataloss event. With the config option set, systemd could happily reboot if you specified "now" but if you specified some time in the future it could refuse and suggest you use a stopwatch and do a reboot at the prescribed time. That way people who value the timing of the reboot set the option and get what they want, and people who value rebooting don't set the option and get an immediate reboot.

@mbiebl
Copy link
Contributor

mbiebl commented Jan 11, 2021

Thanks for the patch @joalif
I'll apply this downstream since the current behaviour is clearly not what users expect as evidenced by the many user reports over the years.

@poettering
Copy link
Member

Would not a more reasonable compromise would be to make this a configurable behaviour?

Every option comes at a price. If we make something configurable we need a very strong reason. I really don't see that here. It's a niche case, and one that has a perfect fix: just install dbus.

I have zero sympathies for the folks who go against our documented dependencies and don't install dbus and the are surprised if some stuff doesn't work as expected, and get fallback codepaths. There's a very simple option that makes the whole issue go away for the majority of the people reporting this issue: just install dbus, as per doc. If you do, things just work, you get no failure, and the exact behaviour you expect: a scheduled shutdown.

If you hate dbus that much that you'd rather want failures all over the place than just installing one tiny package that just makes everything works, then i am not sure I can help you. sorry.

@mp15
Copy link

mp15 commented Jan 11, 2021

Eh? What are you talking about? In the example given dbus was installed, it had just crashed, something that happens. Who said anything about hating dbus but you? Bit disingenuous?

@yuwata
Copy link
Member

yuwata commented Jan 11, 2021

Eh? What are you talking about? In the example given dbus was installed, it had just crashed, something that happens. Who said anything about hating dbus but you? Bit disingenuous?

In the original issue #17575.

In case dbus is not available the system reboots immediately.

Of cource, 'not available' may include a situation that dbus is installed but not running or crashed. But it is not a problem here. We explicitly request that dbus exists. If it does not for any reason, users should 'fix' the situation, that is, install, start, or restart dbus.

@mp15
Copy link

mp15 commented Jan 11, 2021

Whilst I do not think it is unreasonable for you to expect dbus to be installed, I am not sure it is reasonable for you to expect a system admin to have to separately check dbus is running every time they issue a timed shutdown command or risk a nasty surprise. I realise the timing of shutdowns may not be important to your own usecase, but I am suggesting there are enough people out there for whom a mistimed reboot is an SLA violation that it might be worth the price of a config option. Anyway that's it I'm done.

@poettering
Copy link
Member

@mp15 consider it a packaging bug then maybe. i.e. ask your distro to just add the right dep so that dbus is always there if systemd is... On Fedora for example:

# dnf repoquery --requires systemd | grep dbus
dbus >= 1.9.18

i.e. the systemd rpm pulls in dbus so that this all just works. I mean, this is usually what packaging systems are used for: make sure the right stuff is pulled in for things to work.

@mbiebl
Copy link
Contributor

mbiebl commented Jan 11, 2021

As said, I'll apply this downstream in Debian (and by that all derivatives including Ubuntu), which is certainly half of the Linux ecosystem. We will then see if people really don't like this (new) default behaviour.

@mbiebl
Copy link
Contributor

mbiebl commented Jan 11, 2021

Of cource, 'not available' may include a situation that dbus is installed but not running or crashed. But it is not a problem here. We explicitly request that dbus exists. If it does not for any reason, users should 'fix' the situation, that is, install, start, or restart dbus.

They can't because the system will have forcefully rebooted by then :-)

@guilhermepiccoli
Copy link

As said, I'll apply this downstream in Debian (and by that all derivatives including Ubuntu), which is certainly half of the Linux ecosystem. We will then see if people really don't like this (new) default behaviour.

Thanks a lot, much appreciated! I strongly agree with you that most people wouldn't like their system to just reboot if they say "please reboot i 15 minutes" due to some dbus issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Scheduled reboot reboots immediately if dbus is not available
8 participants