@joalif, one thing I noticed, that isn't important for this SRU, is that
the !ENABLE_LOGIND case still has a log message indicating shutdown will
happen immediately, i.e.:


int logind_schedule_shutdown(void) {                                            
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                              
#if ENABLE_LOGIND                                                               
                                                                                
                                                                                
                              
...stuff...
#else                                                                           
                                                                                
                                                                                
                              
        return log_error_errno(SYNTHETIC_ERRNO(ENOSYS),                         
                                                                                
                                                                                
                              
                               "Cannot schedule shutdown without logind 
support, proceeding with immediate shutdown.");                                 
                                                                                
                                      
#endif                                                                          
                                                                                
                                                                                
                              
}

however, since the caller has been changed to return error instead of
immediate reboot, maybe that message should be changed as well. I'd
actually suggest that both messages in this function, that state what
will happen next but rely on the caller to actually do what the log
states, are in the wrong place, and the *calling* function should log an
appropriate message about what it's doing next instead of this function.

Doesn't matter for this though since we do define ENABLE_LOGIND for our
builds, just a suggestion if you want to send a patch to debian :)

-- 
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1911187

Title:
  scheduled reboot reboots immediately if dbus or logind is not
  available

Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Bionic:
  In Progress
Status in systemd source package in Focal:
  In Progress
Status in systemd source package in Groovy:
  In Progress

Bug description:
  [IMPACT]

  When, for whatever reason, logind or dbus is not available scheduled reboot 
reboots the machine immediately.
  From the sources it seems that this is intended :
  
https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl-logind.c#L318
  However, I report this as a bug since this is against the logic of a 
scheduled reboot; if someone schedules a reboot they want the system to reboot 
at the specified time not immediately.

  There has been a discussion upstream ( 
https://github.com/systemd/systemd/issues/17575 ) and
  a PR ( https://github.com/systemd/systemd/pull/18010 ).

  Upstream community is not willing to accept the patch but debian is.
  I open this bug to to pull the patch into Ubuntu once it lands in debian.

  [TEST PLAN]

  The simpler reproducer is to disable dbus to imitate the real world
  case.

  # systemctl stop dbus.service
  # systemctl stop dbus.socket
  # shutdown +1140 -r "REBOOT!"
  Failed to set wall message, ignoring: Failed to activate service 
'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
  Failed to call ScheduleShutdown in logind, proceeding with immediate 
shutdown: Connection timed out
  Connection to groovy closed by remote host.
  Connection to groovy closed.

  [WHERE PROBLEM COULD OCCUR]

  This patch changes the behaviour of scheduled reboot in case logind or dbus 
has failed.
  Originally, if logind is not available (call to logind bus fails
  
https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl-logind.c#L319)
  it proceeds with immediate shutdown.
  This patch changes this behaviour and instead of shutting down it does 
nothing.
  The actual regression potential is a user asking for a reboot and not getting 
it.
  Other than that the changes in the code are very small and simple and 
unlikely to break anything.

  [OTHER]

  This is now fixed in H, currently affects B,G,F.

  Debian bug reports :
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931235
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960042

  Upstream issue : https://github.com/systemd/systemd/issues/17575
  PR : https://github.com/systemd/systemd/pull/18010

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1911187/+subscriptions

-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : sts-sponsors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to