Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 835068 - sys-apps/systemd-250.3[hostnamed-fallback]: set hostname errors
Summary: sys-apps/systemd-250.3[hostnamed-fallback]: set hostname errors
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-03-13 10:09 UTC by Karlson2k
Modified: 2022-04-08 23:18 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge --info.txt,5.55 KB, text/plain)
2022-03-13 10:28 UTC, Karlson2k
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karlson2k 2022-03-13 10:09:33 UTC
Hello.

systemd with hostnamed-fallback always fail to set hostname. The fallback is nice, but it's not working properly.

I have minimal gentoo installation with systemd. Of course, I don't want to bloat it with polkit-spidermonkey-llvm-rust, so I added "hostnamed-fallback" use flag and rebuilt systemd and dependencies (by emerge -vuDU @world).

Unfortunately I'm getting errors in log like:
-------------------------------------
Mar 12 14:22:24 dbus-daemon[254]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.1' (uid=192 pid=211 comm="/lib/systemd/systemd-networkd ")
Mar 12 14:22:24 systemd-timesyncd[248]: Network configuration changed, trying to establish connection.
Mar 12 14:22:24 systemd[1]: Starting Hostname Service...
Mar 12 14:22:49 dbus-daemon[254]: [system] Failed to activate service 'org.freedesktop.hostname1': timed out (service_start_timeout=25000ms)
Mar 12 14:22:49 systemd-networkd[211]: Could not set hostname: Method call timed out
Mar 12 14:22:54 systemd-hostnamed[265]: Failed to run event loop: Transport endpoint is not connected
Mar 12 14:22:54 systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=1/FAILURE
Mar 12 14:22:54 systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.
Mar 12 14:22:54 systemd[1]: Failed to start Hostname Service.
-------------------------------------
Comment 1 Karlson2k 2022-03-13 10:25:42 UTC
Debug log doesn't help a lot:
----------------------------
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state UNSET → OPENING
Mar 12 18:57:39 systemd-hostnamed[267]: sd-bus: starting bus by connecting to /run/dbus/system_bus_socket...
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state OPENING → AUTHENTICATING
Mar 12 18:57:39 systemd-hostnamed[267]: Registering bus object implementation for path=/org/freedesktop/hostname1 iface=org.freedesktop.hostname1
Mar 12 18:57:39 systemd-hostnamed[267]: Registering bus object implementation for path=/org/freedesktop/LogControl1 iface=org.freedesktop.LogControl1
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state AUTHENTICATING → HELLO
Mar 12 18:57:39 systemd-hostnamed[267]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error->
Mar 12 18:57:39 systemd-hostnamed[267]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su e>
Mar 12 18:57:39 systemd-hostnamed[267]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.5 path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state HELLO → RUNNING
Mar 12 18:57:39 systemd-hostnamed[267]: Got message type=signal sender=org.freedesktop.DBus destination=:1.5 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=2 reply_cookie=0 signature=s error->
Mar 12 18:57:39 systemd-hostnamed[267]: Got message type=error sender=org.freedesktop.DBus destination=:1.5 path=n/a interface=n/a member=n/a cookie=3 reply_cookie=2 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied >
Mar 12 18:57:39 systemd-hostnamed[267]: Unable to request name, failing connection: Connection ":1.5" is not allowed to own the service "org.freedesktop.hostname1" due to security policies in the configuration file
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state RUNNING → CLOSING
Mar 12 18:57:39 systemd-hostnamed[267]: Bus n/a: changing state CLOSING → CLOSED
Mar 12 18:58:09 systemd-hostnamed[267]: Failed to run event loop: Transport endpoint is not connected
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Got notification message from PID 267 (STOPPING=1)
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Got notification message from PID 267 (ERRNO=107)
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Child 267 belongs to systemd-hostnamed.service.
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=1/FAILURE
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Service will not restart (restart setting)
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Changed start -> failed
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Job 108 systemd-hostnamed.service/start finished, result=failed
Mar 12 18:58:09 systemd[1]: Failed to start Hostname Service.
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Unit entered failed state.
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Consumed 62ms CPU time.
Mar 12 18:58:09 systemd[1]: systemd-hostnamed.service: Control group is empty.
Mar 12 19:22:59 systemd[1]: systemd-hostnamed.service: Watching D-Bus name 'org.freedesktop.hostname1'.
Mar 12 19:22:59 systemd[1]: systemd-hostnamed.service: Changed dead -> failed
Mar 12 19:22:59 systemd[1]: systemd-hostnamed.service: D-Bus name org.freedesktop.hostname1 now not owned by anyone.
----------------------------
Comment 2 Karlson2k 2022-03-13 10:26:35 UTC
# emerge -1pv systemd

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ~] sys-apps/systemd-250.3:0/2::gentoo  USE="acl dns-over-tls gcrypt gnuefi hostnamed-fallback kmod lz4 lzma openssl pam pcre resolvconf seccomp (split-usr) sysv-utils zstd -apparmor -audit -build -cgroup-hybrid -cryptsetup -curl -elfutils -fido2 -gnutls -homed -http -idn -importd -nat -pkcs11 -policykit -pwquality -qrcode (-selinux) -test -tpm -vanilla -xkb" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
Comment 3 Karlson2k 2022-03-13 10:28:36 UTC
Created attachment 766975 [details]
emerge --info
Comment 4 Karlson2k 2022-03-13 13:12:00 UTC
hostnamed-fallback workaround works only if dbus-broker is used instead of standard dbus implementation.

By default, when dbus-broker is installed, it is not activated, so standard dbus implementation works perfectly as designed, but hostname doesn't work.
Looking at the log entries and documentation it's hard to find what's wrong.

In my PR https://github.com/gentoo/gentoo/pull/24514 I added check at postinstall stage. If hostnamed-fallback is used, but dbus-broker is not activated, emerge will print warning message with instruction how to fix it. I think this should help users to avoid the same problems as I have had.
Comment 5 Larry the Git Cow gentoo-dev 2022-04-08 23:18:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa6a892c022128dfe993ac2b0e0ef23600304a8b

commit aa6a892c022128dfe993ac2b0e0ef23600304a8b
Author:     Karlson2k (Evgeny Grin) <k2k@narod.ru>
AuthorDate: 2022-03-12 17:36:37 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2022-04-08 23:17:15 +0000

    sys-apps/systemd: warn when dbus-broker is needed.
    
    Warn if hostnamed-fallback workaround is used, but dbus-broker.service
    is not enabled. This should give users a strong hint of what needs to be
    done.
    
    Closes: https://bugs.gentoo.org/835068
    Closes: https://github.com/gentoo/gentoo/pull/24514
    Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/systemd/systemd-250.4-r1.ebuild | 8 ++++++++
 sys-apps/systemd/systemd-9999.ebuild     | 8 ++++++++
 2 files changed, 16 insertions(+)