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

Failed to start systemd-hostnamed.service [ System ] #1949

Closed
1 task done
gkeishin opened this issue Jul 12, 2017 · 9 comments
Closed
1 task done

Failed to start systemd-hostnamed.service [ System ] #1949

gkeishin opened this issue Jul 12, 2017 · 9 comments
Assignees
Labels

Comments

@gkeishin
Copy link
Task lists! Give feedback
Contributor

@gkeishin gkeishin commented Jul 12, 2017

Driver info:

root@witherspoon:~# cat /etc/os-release
ID="openbmc-phosphor"
NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)"
VERSION="v1.99.8-2"
VERSION_ID="v1.99.8-2-g73a56d5"
PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) v1.99.8-2"
BUILD_ID="v1.99.8"
root@witherspoon:~# uname -a
Linux witherspoon 4.10.17-7858cdff46b6d8aa4a4f88884a0623ff50fb78c9 #1 Wed Jul 12 15:28:52 UTC 2017 armv6l GNU/Linux
root@witherspoon:~#
root@witherspoon:~# systemctl status systemd-hostnamed.service | cat
● systemd-hostnamed.service - Hostname Service
   Loaded: loaded (/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2017-04-20 17:29:47 UTC; 7min ago
     Docs: man:systemd-hostnamed.service(8)
           man:hostname(5)
           man:machine-info(5)
           http://www.freedesktop.org/wiki/Software/systemd/hostnamed
  Process: 937 ExecStart=/lib/systemd/systemd-hostnamed (code=exited, status=225/NETWORK)
 Main PID: 937 (code=exited, status=225/NETWORK)

Apr 20 17:29:45 witherspoon systemd[1]: Starting Hostname Service...
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=225/NETWORK
Apr 20 17:29:47 witherspoon systemd[1]: Failed to start Hostname Service.
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Unit entered failed state.
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.
root@witherspoon:~#

Journald snippet:

Apr 20 17:29:57 witherspoon systemd[1]: Started Phosphor Network Manager.
Apr 20 17:30:03 witherspoon phosphor-network-manager[905]: Failed to get hostname
Apr 20 17:30:03 witherspoon phosphor-network-manager[905]: The operation failed internally.
Apr 20 17:30:03 witherspoon phosphor-network-manager[905]: Error in mapper call

Apr 20 17:29:45 witherspoon systemd[937]: systemd-hostnamed.service: Failed at step NETWORK spawning /lib/systemd/systemd-hostnamed: Invalid argument
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=225/NETWORK
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Unit entered failed state.
Apr 20 17:29:47 witherspoon systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.
@ratagupt
Copy link
Contributor

@ratagupt ratagupt commented Jul 13, 2017

As the kernel is not configured with namespace support,and systemd looks for network namespace..I missed that patch.
I will add it.

@gkeishin
Copy link
Contributor Author

@gkeishin gkeishin commented Jul 13, 2017

Thanks @ratagupt

@ratagupt
Copy link
Contributor

@ratagupt ratagupt commented Jul 13, 2017

workaround is:-

  1. to comment the following line in the "/lib/systemd/system/systemd-hostnamed.service"
Description=Hostname Service
Documentation=man:systemd-hostnamed.service(8) man:hostname(5) man:machine-info(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/hostnamed

[Service]
ExecStart=/lib/systemd/systemd-hostnamed
BusName=org.freedesktop.hostname1
WatchdogSec=3min
CapabilityBoundingSet=CAP_SYS_ADMIN
PrivateTmp=yes
PrivateDevices=yes
#PrivateNetwork=yes >>>>>>>>>>>>>>>>comment this line.
ProtectSystem=yes
ProtectHome=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_UNIX
SystemCallFilter=~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io
  1. systemctl daemon-reload
  2. systemctl restart xyz.openbmc_project.Network.service.

@prkatti1
Copy link

@prkatti1 prkatti1 commented Jul 13, 2017

@sivassrr @gkeishin Even our xyz network test cases failing because of this.
But works on workaround patch given by @ratagupt

@rfrandse
Copy link

@rfrandse rfrandse commented Jul 20, 2017

https://gerrit.openbmc-project.xyz/5398 Don't return the error if unable to create the network namespace
Resolves #1949 Failed to start systemd-hostnamed.service [ Witherspoon ]

@rfrandse rfrandse added this to the openBMC v2.0 Backlog milestone Jul 20, 2017
@ratagupt
Copy link
Contributor

@ratagupt ratagupt commented Jul 21, 2017

STATUS

7/20 Peer review pending
7/21 Peer review pending

@gkeishin
Copy link
Contributor Author

@gkeishin gkeishin commented Jul 27, 2017

Verified working on latest build

@rfrandse rfrandse changed the title Failed to start systemd-hostnamed.service [ Witherspoon ] Failed to start systemd-hostnamed.service [ System ] Nov 21, 2017
bradbishop pushed a commit to openbmc/meta-phosphor that referenced this issue Jan 13, 2018
On systems where kernel is not configured with namespace support
then don't return error during setting up network namespace.

Rationale to not enable the kernel with namespace support
as it brings lot of unnecessary code.

Resolves openbmc/openbmc#1949

Change-Id: I3b52a8c61b9bd3e3fff02cfab998c3746b8b72c6
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
@hossein-b
Copy link

@hossein-b hossein-b commented Jun 12, 2018

For those that need this, follow the steps below:

  1. systemctl edit systemd-hostnamed

    Add the 2 lines below then exit the editor (don't forget to save when prompted):

    [Service]
    PrivateNetwork=no

  2. This will create an override.conf file with the above 2 lines in the directory:

    /etc/systemd/system/systemd-hostnamed.service.d/

  3. The update systemd:

    systemctl daemon-reload

  4. Then restart the service:

    systemctl restart systemd-hostnamed

You should now be able to run hostnamectl without it hanging.

@asgh
Copy link

@asgh asgh commented Aug 15, 2018

The above suggestions do work, but don't do that!

Instead enable CONFIG_NET_NS - if you don't you will have other strange errors, for example pulseaudio won't work (will freeze on startup), and errors like rtkit-daemon.service: Failed at step NETWORK spawning /usr/lib/rtkit/rtkit-daemon: Invalid argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants