Bug 1411299

Summary: After unit installation, upgrade or removal systemctl daemon-reload is invoked even for system without systemd running
Product: [Fedora] Fedora Reporter: Pavol Babinčák <pbabinca>
Component: systemdAssignee: systemd-maint
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: johannbg, lnykryn, msekleta, muadda, ssahani, s, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-232-11.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:09:50 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:
Attachments:
Description Flags
patch none

Description Pavol Babinčák 2017-01-09 11:58:56 UTC
Description of problem:
I'm running Fedora in docker container and as a such it doesn't run systemd nor bus. If I try to install/upgrade/remove package which has systemd unit rpm trigger is invoked and runs systemctl daemon-reload. This isn't successful and prints "Failed to connect to bus: No such file or directory".

Version-Release number of selected component (if applicable):
systemd-231-3.fc26.x86_64

How reproducible:
Always

Steps to Reproduce:
1. docker run -ti fedora:rawhide bash
2. dnf upgrade --downloadonly -y dnf
3. cd /var/cache/dnf/rawhide-*/packages
4. rpm -Uvh *.rpm

Actual results:
In the output after dnf and libcomps I see:

Cleaning up / removing...
  26:dnf-yum-1.1.9-6.fc26             ################################# [ 58%]
  27:dnf-1.1.9-6.fc26                 ################################# [ 60%]
Failed to connect to bus: No such file or directory
  28:python3-dnf-1.1.9-6.fc26         ################################# [ 62%]
...
  44:librepo-1.7.18-4.fc26            ################################# [ 98%]
  45:libcomps-0.1.7-6.fc26            ################################# [100%]
Failed to connect to bus: No such file or directory

Expected results:
No messages: Failed to connect to bus: No such file or directory

Additional info:
My rawhide Image has sha256:3bcdeb6ee43bf3dfffd130c5fe6b81d47b04aed315638a85fbf26760962d733e. I'm not sure how to pull it by this id though.

I'm testing this in docker but I guess this can happen in mock, anaconda or other common environments where systemd is not running.

File triggers.systemd (http://pkgs.fedoraproject.org/cgit/rpms/systemd.git/tree/triggers.systemd, upstream: https://github.com/systemd/systemd/blob/master/src/core/triggers.systemd.in) seems to be the code which fails here. I guess it could check if /var/run/dbus/system_bus_socket exists and reload it only if it does.

Comment 1 Zbigniew Jędrzejewski-Szmek 2017-01-10 06:00:59 UTC
You're right, we should wrap this in a check that systemd is running.

A better check would be that described in https://www.freedesktop.org/software/systemd/man/sd_booted.html, "test -e /run/systemd/system".

Comment 2 Zbigniew Jędrzejewski-Szmek 2017-01-10 06:21:53 UTC
Created attachment 1238983 [details]
patch

I'll submit a proper pull request tomorrow ;)

Comment 3 Zbigniew Jędrzejewski-Szmek 2017-01-28 07:38:21 UTC
https://github.com/systemd/systemd/commit/f0c03de85a

Comment 4 Pavol Babinčák 2017-01-30 09:52:57 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #3)
> https://github.com/systemd/systemd/commit/f0c03de85a

I believe you have meant this one: https://github.com/systemd/systemd/commit/13749f547357f8e9ec398680548f818dea3aba1c

Comment 5 Zbigniew Jędrzejewski-Szmek 2017-01-30 14:30:53 UTC
Indeed.

Fixed in rawhide with systemd-232-11.fc26, reassigning to 25 which also needs the fix.

Comment 6 Fedora End Of Life 2017-12-12 10:09:50 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.