Failed to connect to bus: No such file or directory Error in autostarting a Rootless container

Latest response

Hello Community,

I’ve this issue while configuring rootless container.
I can check the autogenerated service file content. But, when I run the command (systemctl —user daemon-reload) to update for new service,
I got this error (failed to connect to bus: no such file or directory error).

[conusr1@server20 ~]$ mkdir ~/.config/systemd/user -p
[conusr1@server20 ~]$ podman run -dt —name rootless-container ubi8
[conusr1@server20 ~]$ podman ps
df25…..…… /bin/bash 10 seconds ago Up 10 seconds ago rootless-container
[conusr1@server20 ~]$ podman generate systems —new —name rootless-container > ~/.config/systemd/user/rootless-container.service
[conusr1@server20 ~]$ cat ~/.config/systemd/user/rootless-container.service
ExecStartPre=/bin/rm -f %t/ %t/container-rootless-….

[conusr1@server20 ~]$ podman stop rootless-container
[conusr1@server20 ~]$ podman rm rootless-container
[conusr1@server20 ~]$ podman ps -a
[conusr1@server20 ~]$ systemctl —user daemon-reload
Failed to connect to bus: No such file or directory
[conusr1@server20 ~]$ systemctl enable —now rootless-container.service
Failed to enable unit: Unit file rootless-container.service does not exist.

Thank you in advance.



Make sure that you aren't working in a 'sudo' or 'su' session. The command only works when ssh-ing into your system or logging in to console.

Thanks for your kind support. :D Yes, I tested it without ssh. I just login with su cmd.

Now, my issue was solved by these ways.

loginctl enable-linger USER 
export XDG_RUNTIME_DIR=/run/user/$(id -u)

nice work

It works nice for me. Thank you Mahlare

Thanks, it worked for me as well. I logged in using root and then I su to user installing crc so it was failing. Now I directly logged in and it worked.

Hey there, I do have the same problem. After Generating the unit file in .config/systemd/user/ to overcome the error during the systemctl --user daemon-reload

export XDG_RUNTIME_DIR=/run/user/$(id -u) # This worked.

But when I start the container. # systemctl --user start container_name.service

It doesn't works..... It gives me error. I also tried directly from console its not working.

same issue

sudo systemctl enable --user --now container-httpd-user1.service Failed to connect to bus: No such file or directory

[user1@server user]$ systemctl status container-httpd-user1.service Unit container-httpd-user1.service could not be found. [user1@server user]$

I cannot find any document which resolves this issue.

I ended up using this solution

Worked for me too. Ensure to use $USER:

loginctl enable-linger $USER
export XDG_RUNTIME_DIR=/run/user/$(id -u)