# systemd-logind can't start because /run/dbus does not exist

## tinloaf

Hi.

My system has trouble booting. It can all be traced back to systemd-logind (and some other services) not starting, because they can't find a dbus socket under /run/dbus:

```

Mar 30 13:44:37 janeway systemd[1]: Reached target Basic System.

Mar 30 13:44:37 janeway systemd[1]: System is tainted: var-run-bad

Mar 30 13:44:37 janeway systemd[1]: Started D-Bus System Message Bus.

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Starting Profile-sync-daemon...

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Starting Network Manager...

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Starting Run SSD related scripts...

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Starting Login Service...

Mar 30 13:44:37 janeway systemd[1]: Reached target Timers.

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to API bus: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd-logind[709]: Failed to connect to system bus: No such file or directory

Mar 30 13:44:37 janeway systemd-logind[709]: Failed to fully start up daemon: No such file or directory

Mar 30 13:44:37 janeway systemd[1]: systemd-logind.service: Main process exited, code=exited, status=1/FAILURE

Mar 30 13:44:37 janeway systemd[1]: systemd-logind.service: Failed with result 'exit-code'.

Mar 30 13:44:37 janeway systemd[1]: Failed to start Login Service.

```

Looking at my system, the dbus socket is correctly created under /var/run/dbus - just not symlinked (or whatever) to /run/dbus. As soon as I create the symlink myself (i.e., "link -s /var/run/dbus /run/dbus"), everything starts and works.

I think this might be related to the "System is tainted: var-run-bad" message in the log above, but I really can't figure out what that means or how to fix it. This bug ( https://github.com/systemd/systemd/issues/7683 ) suggests it is caused by something being mounted to /var, but that is not the case on my system:

```

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,size=5983480k,nr_inodes=1495870,mode=755)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,noexec)

tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,mode=755)

/dev/mapper/luks-cb679acf-8ae1-4fca-a1e1-9e5f940ee459 on / type ext4 (rw,noatime,data=ordered)

tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)

cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime)

cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)

cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)

systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12058)

debugfs on /sys/kernel/debug type debugfs (rw,relatime)

mqueue on /dev/mqueue type mqueue (rw,relatime)

tmpfs on /tmp type tmpfs (rw,relatime)

tmpfs on /var/tmp type tmpfs (rw,relatime)

configfs on /sys/kernel/config type configfs (rw,relatime)

/dev/mapper/data-crypt on /mnt/data type ext4 (rw,noatime,stripe=32748,data=ordered)

/dev/mapper/data-crypt on /mnt/daten type ext4 (rw,noatime,stripe=32748,data=ordered)

tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1198044k,mode=700,uid=1000,gid=1000)

```

Does anybody see the problem?

In case that it's useful…

* here is a full journalctl -b output: https://privatebin.net/?f72e4ea8100ca156#pvhykzoW4Vw5nJdjMAcUF78l5kqPnUMoU7+7KhrZsgQ=

* here is a full dmesg output: https://privatebin.net/?bff5503ec099c7f3#oiZ5erAqyMQeJ1Ae9wMEJ9uEHGNtUchzF3JjghVZZ+U=

Thanks for any help!

----------

## eccerr0r

How do you have /var/run set up?

/run should be tmpfs set up by systemd startup scripts (which looks to be the case).

/var/run should be a symlink to /run -- at least it's this way on my working box.

----------

## tinloaf

Thanks, making /var/run a symlink to /run worked like a charm!

I wonder how this got messed up, though. Which portage package should create this symlink? baselayout? I wonder if there are other directories that are not set up correctly…

----------

## Ant P.

OpenRC has had code to automatically solve this situation for a while - the news item isn't in `eselect news list` any more, so I'd guess since about 10 years ago. Systemd is defective if it doesn't do the same.

----------

## BuzzAlderaan

 *tinloaf wrote:*   

> 
> 
> I wonder how this got messed up, though. Which portage package should create this symlink? baselayout? I wonder if there are other directories that are not set up correctly…

 

Were you ever able to figure this out? I am experiencing the same issue and creating the symlink worked, but I'm afraid that will only be temporary until the next time I have to reboot.

----------

## cjmayo

It won't be temporary.

On the systemd point, if no /var/run exists systemd can also create it as a result of /usr/lib/tmpfiles.d/var.conf.

----------

## Yamakuzure

If somewhere in the past you (or something you did) caused an 'mkdir /var/run', then nothing but yourself can fix that for you.

In other words: Neither systemd, openrc nor opentmpfiles can create a symlink where a directory already exists.  :Wink: 

(I would be very mad at any dev who released a software that goes 'rm -rf' on my directories!)

----------

## Hu

Long ago, /var/run was a directory on which a tmpfs was mounted during early boot to provide writable storage.  At some point, someone decided it was inconvenient requiring that /var be mounted before this could be done, so they created /run and began using that.  A compatibility symlink was supposed to be created so that programs not adapted to the new standard would still play along.

----------

