shredman
Posts: 6
Joined: Fri Apr 26, 2019 6:06 am

systemd-hostnamed.service: Failed with result 'resources' ?

Fri Aug 23, 2019 8:01 am

Hi,

the hostname service is not running anymore on my raspberrypi 3B+

$ cat /etc/issue: Raspbian GNU/Linux 9 \n \l
$ uname -a: Linux raspberrypi 4.19.58-v7+ #1245 SMP Fri Jul 12 17:25:51 BST 2019 armv7l GNU/Linux

$ sudo systemctl restart systemd-hostnamed
Job for systemd-hostnamed.service failed because of unavailable resources or another system error.
See "systemctl status systemd-hostnamed.service" and "journalctl -xe" for details.

$ systemctl status systemd-hostnamed.service

Aug 23 09:38:40 raspberrypi systemd[1]: systemd-hostnamed.service: Failed with result 'resources'.
Aug 23 09:54:29 raspberrypi systemd[1]: systemd-hostnamed.service: Failed to run 'start' task: No such file or directory
Aug 23 09:54:29 raspberrypi systemd[1]: Failed to start Hostname Service.
Aug 23 09:54:29 raspberrypi systemd[1]: systemd-hostnamed.service: Failed with result 'resources'.
Aug 23 09:54:40 raspberrypi systemd[1]: systemd-hostnamed.service: Failed to run 'start' task: No such file or directory
Aug 23 09:54:40 raspberrypi systemd[1]: Failed to start Hostname Service.
Aug 23 09:54:40 raspberrypi systemd[1]: systemd-hostnamed.service: Failed with result 'resources'.
Aug 23 09:57:05 raspberrypi systemd[1]: systemd-hostnamed.service: Failed to run 'start' task: No such file or directory
Aug 23 09:57:05 raspberrypi systemd[1]: Failed to start Hostname Service.
Aug 23 09:57:05 raspberrypi systemd[1]: systemd-hostnamed.service: Failed with result 'resources'.

$ cat /lib/systemd/system/systemd-hostnamed.service

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

[Unit]
Description=Hostname Service
Documentation=man:systemd-hostnamed.service(8) man:hostname(5) man:machine-info(5)
Documentation=http://www.freedesktop.org/wiki/Softwar ... /hostnamed

[Service]
ExecStart=/lib/systemd/systemd-hostnamed
BusName=org.freedesktop.hostname1
WatchdogSec=3min
CapabilityBoundingSet=CAP_SYS_ADMIN
PrivateTmp=yes
PrivateDevices=yes
PrivateNetwork=yes
ProtectSystem=yes
ProtectHome=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_UNIX

what can I do to recover from the "Failed with result 'resources'." error ?

regards,
Frank

shredman
Posts: 6
Joined: Fri Apr 26, 2019 6:06 am

Re: systemd-hostnamed.service: Failed with result 'resources' ?

Fri Aug 23, 2019 10:34 am

I searched the internet alot and found an answer.

"Maybe this is a problem with service 'tmp' directory. I has a similar error with systemd-resolved.service, and reason was missing '/var/tmp'
directory after system migration. Check what temp directory the service is using and create it if necessary"

the /var/tmp directory on my pi was indeed missing . I just created /var/tmp directory with permission 777. Then a sudo systemctl restart systemd-hostnamed.service runs without a problem.

I restored an rsync backup before I got the systemd-hostname issue and this directory was excluded and not created from the backup.

User avatar
DougieLawson
Posts: 42177
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: systemd-hostnamed.service: Failed with result 'resources' ?

Fri Aug 23, 2019 10:50 am

The /tmp directory should have the sticky bit set, so that anyone can write there, but you can only access your own file (unless you're root).

sudo chmod +t /tmp
sudo chmod +t /var/tmp
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Return to “Troubleshooting”