Bug 2081039

Summary: cockpit unable to cancel a scheduled reboot via dbus
Product: [Fedora] Fedora Reporter: Jelle van der Waa <jvanderwaa>
Component: cockpitAssignee: Martin Pitt <mpitt>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: dperpeet, fedoraproject, filbranden, flepied, lnykryn, mmarusak, mpitt, msekleta, patrick, pvolpe, ryncsn, ssahani, s, stefw, systemd-maint, yuwatana, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-13 12:27:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jelle van der Waa 2022-05-02 15:26:10 UTC
Description of problem:

Cockpit is unable to cancel a scheduled reboot via DBus with the following error:

Failed to cancel shutdown Interactive authentication required

Cockpit calls the following dbus command, but via it cockpit itself.

busctl call org.freedesktop.login1 /org/freedesktop/login1  org.freedesktop.login1.Manager CancelScheduledShutdown

Version-Release number of selected component (if applicable):

The last known good version is v250.3-6.fc37, the first v251 version breaks. 

How reproducible:

Always

Steps to Reproduce:
1. Schedule a reboot in cockpit as administrator (with adminstrative access). (Click reboot => shows a dialog schedule for X minutes)
2. Notice that the "Health card" has a cancel shutdown button
3. Click the cancel shutdown button

Actual results:

Failed to cancel shutdown Interactive authentication required

Expected results:

No error, reboot cancelled.

Additional info:

Monitoring with:

busctl monitor org.freedesktop.login1.Manager

Shows the following:

‣ Type=method_return  Endian=l  Flags=1  Version=1 Cookie=-1  ReplyCookie=2009  Timestamp="Mon 2022-05-02 13:37:13.555384 UTC"
  Sender=org.freedesktop.DBus  Destination=:1.46
  MESSAGE "u" {
          UINT32 1782;
  };

‣ Type=method_return  Endian=l  Flags=1  Version=1 Cookie=2010  ReplyCookie=360  Timestamp="Mon 2022-05-02 13:37:13.556330 UTC"
  Sender=:1.46  Destination=:1.4
  UniqueName=:1.46
  MESSAGE "(bba{ss})" {
          STRUCT "bba{ss}" {
                  BOOLEAN false;
                  BOOLEAN true;
                  ARRAY "{ss}" {
                          DICT_ENTRY "ss" {
                                  STRING "polkit.retains_authorization_after_challenge";
                                  STRING "1";
                          };
                  };
          };
  };

‣ Type=error  Endian=l  Flags=1  Version=1 Cookie=361  ReplyCookie=1339  Timestamp="Mon 2022-05-02 13:37:13.557643 UTC"
  Sender=:1.4  Destination=:1.41
  ErrorName=org.freedesktop.DBus.Error.InteractiveAuthorizationRequired  ErrorMessage="Interactive authentication required."
  UniqueName=:1.4
  MESSAGE "s" {
          STRING "Interactive authentication required.";
  };

Comment 1 Martin Pitt 2022-05-02 21:54:41 UTC
At first sight this is cockpit's bug. cancelShutdownAction() does not connect to the system bus as root, it's missing a { superuser: "try" }.

Comment 2 Martin Pitt 2022-05-02 22:04:19 UTC
Seems this was an intended, not an accidental change: https://github.com/systemd/systemd/commit/ec14fba91c94f38f3 (part of https://github.com/systemd/systemd/pull/21838)

Comment 3 Martin Pitt 2022-05-03 07:47:07 UTC
Fixing in https://github.com/cockpit-project/cockpit/pull/17302

Comment 4 Ben Cotton 2022-08-09 13:41:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 5 Martin Pitt 2023-01-13 12:27:59 UTC
This was fixed long ago in Cockpit 269.