9

After last update there is become a problem: systemd-tmpfiles not starts (so there is no temp dirs and some services can't be started).

root@myserver:/# journalctl -b 0 -u systemd-tmpfiles-setup.service
-- Logs begin at Ср 2018-11-21 01:00:51 MSK, end at Ср 2018-11-21 11:45:01 MSK. --
ноя 21 01:01:04 myserver systemd[1]: Starting Create Volatile Files and Directories...
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/sendsigs.omit.d, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lock/subsys, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lock/lvm, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lvm, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/cache, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/cache/man, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/php, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind/rpcbind.xdr, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind/portmap.xdr, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/samba, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/screen, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sshd, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sudo, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sudo/ts, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/nologin, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/user, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/utmp, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/ask-password, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/seats, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/sessions, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/users, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/machines, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/shutdown, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif/links, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif/leases, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/log, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib/systemd, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib/systemd/coredump, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log/wtmp, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log/btmp, refusing.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Main process exited, code=exited, status=1/FAILURE
ноя 21 01:01:04 myserver systemd[1]: Failed to start Create Volatile Files and Directories.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Unit entered failed state.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Failed with result 'exit-code'.

I was trying to run separate config files

root@myserver:/# systemd-tmpfiles --create /usr/lib/tmpfiles.d/sshd.conf
Unsafe symlinks encountered in /var/run/sshd, refusing.

/var/run/sshd is empty. There is no symlinks at all.

I've no idea what its means and how to fix it. Any advice are welcome.

root@myserver:/# uname -a
Linux myserver 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

5 Answers 5

26

I had exactly the same problem today on my workstation - ubuntu 18.04.1. Finally (searching systemd source code) I have figured, that somehow my root folder = / ownership had been changed to me - the only user. Simple chown root.root / solved the problem :) ... after some 2 hours of searching.

7
  • 2
    Wow! Amazing! I didn't even think to dig in this direction.
    – Loki
    Nov 21, 2018 at 12:47
  • Really troublesome that something would change ownership of the root directory... And that this would happen to more than one of you. Did you end up figuring out what changed those permissions in this way???
    – filbranden
    Nov 22, 2018 at 19:05
  • No, I did not. Actually I do nothing special on that machine as root = ubuntu upgrades. Very rarely something else. So I suspect some package update. In apt history there is only one package installed previous day (no updates): synology-note-station:amd64. But I did the same on another (practically the same) machine - no problems :(
    – ivop
    Nov 24, 2018 at 6:28
  • Thanks for this. Noob question: Is there any side-effect to running the chown command? Do I need to clean anything up or revert any ownership afterwards? In case it helps someone, this happened to me during an upgrade from 17.10 to 18.04, where it said that systemd wasn't configured. It said I needed to run dpkg --configure -a to fix, which returned Setting up systemd (237-3ubuntu10.9) ... Unsafe symlinks encountered in /var/log/journal, refusing then cascaded failures after that. This fixed that and I was successfully able to re-run the dpkg command to complete the upgrade
    – ardila
    Nov 26, 2018 at 13:42
  • This happened to me to! Something must be doing this cause I can't imagine doing it myself (though of course it is possible)? Dec 25, 2019 at 5:57
2

Encountered this problem as well.

To add to the answer above, you need to make sure that the whole path belongs to root, not just /. Somehow my /var folder got the owner of mysql (good job, mysql), and sshd was trying to create /var/run/sshd, which failed.

2

$ cd /

$ ll (here if you see that ./ has any name other than root, then do)

$ sudo chown root.root /

you should see a normal prompt without a message. Now if you did:

$ sudo apt remove (the package in question) - then do

$ sudo apt install (that same package or tool above).

That error should go away and everything should be fine now.

1
  • This fixed it for me. Would never have considered that the problem was root ownership had somehow changed.
    – Eborbob
    Feb 1, 2020 at 10:43
1

It seems it is a bug: systemd-tmpfiles-setup.service fails on btrfs

-1

this is a workaround. I solved by manually creating /run/sshd path

sudo mkdir /run/ssh
sudo chown root:root /run/ssh

Ciao

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.