Error unable to connect to system d bus

I am running Ubuntu Server 10.04.01. When I try to start the MySQL service with sudo start mysql, I get this error: start: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directoryWhat could I do to fix it?
  1. unable to connect to system bus

    I am running Ubuntu Server 10.04.01. When I try to start the MySQL service with , I get this error:

    Code:

    start: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

    What could I do to fix it?

    Last edited by tomtetlaw; October 8th, 2010 at 09:35 AM.


  2. Re: unable to connect to system bus

    I just ran into that same error as well.

    I read somewhere else that people where getting this same error, but when running a different command. They used the following to solve this problem:

    Code:

    dhclient
    apt-get update
    apt-get install upstart


  3. Re: unable to connect to system bus


  4. Re: unable to connect to system bus

    I’m having this same error, but I don’t use (or have installed) mysql. is this more generally related to dbus? Any hints as to where to start would be great. I’m getting no hints from the syslog or the boot.log.

    Thanks


  5. Re: unable to connect to system bus

    I have the same error when trying to shutdown with natty. In oneric it seems to be a bug: https://bugs.launchpad.net/ubuntu/+s…us/+bug/811441 . But is it the same in natty?


  6. Re: unable to connect to system bus

    Quote Originally Posted by tomtetlaw
    View Post

    I am running Ubuntu Server 10.04.01. When I try to start the MySQL service with

    , I get this error:

    Code:

    start: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

    What could I do to fix it?

    Hi. I have the same error, and now after upgrading from 11.4 to 11.10, the upgrade went fine and then i shut down. Now it won’t boot into the gnome. I get the same error and it says waiting to connect to network, cannot connect to system bus.

    People say I should just remove dbus directory. I tried and it didn’t work, it says directory is read only and is not empty. I tried deleting the file «pid system_bus_socket». It wouldn’t let me delete it.

    I’m new to Ubuntu, so I have no idea how to migrate the files of /var/run to /run, via the command line.

    However, I did try «sudo rm -r /run/*» which I saw as a solution on another site. That command completed correctly, but still problem is not fixed.

    It’s finals this week and i downloaded files last night I don’t want to loose. I encrypted my main hard drive, so reinstalling Ubuntu is not a preferred option. Please help me so I can boot into the gnome.

    This bug was also reported here: Unable to connect to the system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: Connection refused (oneiric) https://bugs.launchpad.net/ubuntu/+s…us/+bug/811441

    I’ve made additional, but not duplicate posts there.

    Last edited by daemonrebel; October 14th, 2011 at 08:19 AM.


  7. Re: unable to connect to system bus

    Hey buddy,

    Same problem here, removing pid & system_bus_socket worked for me. To migrate/move those files use «sudo mv /var/run/dbus/pid /». This will copy it to your root folder, or you can replace / with whatever you want /user/Desktop, etc.


  8. Re: unable to connect to system bus

    Quote Originally Posted by Doduren
    View Post

    Hey buddy,

    Same problem here, removing pid & system_bus_socket worked for me. To migrate/move those files use «sudo mv /var/run/dbus/pid /». This will copy it to your root folder, or you can replace / with whatever you want /user/Desktop, etc.

    It wouldn’t let me deleted anything related to removing this bug, only copy and make links. I eventually scrapped the install and reverted to 11.4 installation. I consider 11.4 a stable installation and I never have any problems with it, but it’s incredibly difficult to run pc games in it.

    Eventually, I decided that it’s more performance efficient to run ubuntu inside of windows 7, instead of windows xp instead of ubuntu. Ubuntu just can’t keep up with directx 11, it just runs games at an alarming speed. >


  9. Re: unable to connect to system bus

    I have deleted the entire contents of /var/run/sbus and I returned to work.


Comments

@daviddavis

I searched Issues and while I found other bugs that seemed similar, I couldn’t tell if they were exactly the same as this so I apologize if this is a repeat.

After following the steps on this blog to setup docker on Fedora, when you run systemctl you get an error about failing to connect to dbus.

bash-4.2# systemctl list-units
Failed to get D-Bus connection: No connection to service manager.

Docker version: docker-io-0.6.3-3.devicemapper.fc19.x86_64
OS: Fedora 19 (Schrödinger’s Cat)

unclechu, agurinov, junmakii, sshnaidm, sohamm17, shivam6294, ORESoftware, superproxy, vmanikes, zfields, and 2 more reacted with thumbs up emoji

@jpetazzo

How did you start the container exactly?
It looks like you started an «application container», as opposed to a «machine container».
An «application container» just runs a specific process (or group of processes); essentially it just runs what you need.
A «machine container» will run a full init, possibly with ssh, syslog, etc.
If you start an application container, it doesn’t have a real init process, and since systemctl talks to the init process… you get the idea :-)

@daviddavis



Copy link


Contributor

Author

I tried docker run -i -t 366ff524eea0 /bin/bash and I also tried:

docker ps -a # find the container
docker start 9e5f23150755
docker attach 9e5f23150755

@daviddavis



Copy link


Contributor

Author

I’m guessing both of those are app containers. How do I get/start a machine container?

@jpetazzo

The idea is to «docker run -t -i /sbin/init».

However:

  • when running Ubuntu images, a number of shortcomings in Upstart will get in the way; efforts to work around them are documented on Ubuntu/Upstart issues as a container/full machine #2276
  • I don’t know if peple have tried to run Fedora machine containers

This is an area which we want to support, but not so many people are working on it right now; so if you want to investigate and report your findings, that will be very helpful.

@daviddavis



Copy link


Contributor

Author

So I ran docker run -t -i -d f19 /sbin/init and then attach but the attach just hung. I will look into it more later.

@chenyf

@daviddavis



Copy link


Contributor

Author

@chenyf I haven’t had time to look into this. I’m fine with closing this out.

@kiorky

@creack

Closing in favor of #2276.

@daviddavis Please feel free to reopen the issue if/when needed.

@xyproto

This error also happens here when attempting to start sshd with systemctl start sshd on an Arch Linux container. Running /sbin/init first only hangs.

Edit: This is my very first Dockerfile and I’m new to Docker, so it is fully possible that there is a command I should or should not have run: http://ix.io/d2l

@michaelneale

@xyproto the RUN statements only happen in the building container — not the image that results — you need to have them in ENTRYPOINT or CMD. BTW what arch image did you use with this?

@xyproto

Thank you, michaelneale. I’ll try using CMD instead. (Seems like other tutorials for setting up ssh on distros that use systemd often involve running sshd directly, btw).

@michaelneale

@xyproto yes I am trying with arch myself (michaelneale/archbase)- that I bootstrapped. With systemd you need to have it setup to launch the services so you get in — and the one process docker bootstraps is init (and blocks) — to get in the container you will need ssh (or perhaps nsenter could work).

@etworker

I met the same problem when running systemctl in centos docker.
Official centos7 image has no systemctl, so i download and build it, everything seems ok.

here is the error result:

[root@85287f97016e systemd-216]# systemctl —version
systemd 216
-PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP -BLKID -ELFUTILS -KMOD -IDN
[root@85287f97016e systemd-216]# systemctl
Failed to get D-Bus connection: Unknown error -1
[root@85287f97016e systemd-216]# systemctl list-units
Failed to get D-Bus connection: Unknown error -1

here is the kernel version.
[root@85287f97016e systemd-216]# uname -a
Linux 85287f97016e 3.10.0-123.13.2.el7.x86_64 #1 SMP Thu Dec 18 14:09:13 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

So the systemctl can not run inside docker, right? thanks!

@jpetazzo

It should. Check if systemd is running in your container?

@irfancode

@rmahajan2420

I m also getting the same issue. Systemctl does not work and failed with D-Bus connection. Operation not permitted

@lucaspottersky

Same issue.

$ docker run debian:jessie bash
root@c724e59bf246:/# systemctl list-units
Failed to get D-Bus connection: Unknown error -1
$ docker version
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:59:07 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:59:07 2016
 OS/Arch:      linux/amd64

@maxivak

try running container with —privileged=true

docker run -d --privileged-true --name=contname image-name 

@NavinF

@maxivak No, you should not use «—privileged=true» here. The container does not need access to the host’s systemd.

@thaJeztah

systemd needs SYS_ADMIN, and if seccomp filtering is available, this needs to be disabled, or overridden with a custom profile. Try;

docker run -it 
  --security-opt seccomp=unconfined 
  --cap-add=SYS_ADMIN 
  -e "container=docker" 
  -v /sys/fs/cgroup:/sys/fs/cgroup 
  centos:7 /usr/sbin/init

edit: current versions of docker should not longer need to have seccomp disabled, so the example below should work;

docker run -it 
  --cap-add=SYS_ADMIN 
  -e "container=docker" 
  -v /sys/fs/cgroup:/sys/fs/cgroup 
  centos:7 /usr/sbin/init
pblottiere, sgykfjsm, ZigFisher, IOOOTAlan, vonneucode, SuperSandro2000, dazzling-sky, badrelmers, enniosousa, and izharskiy reacted with thumbs up emoji
mradcliffe, carbolymer, and CMGS reacted with thumbs down emoji
badrelmers reacted with heart emoji

@durgaswaroop

What is the final working solution to this issue? None of the above suggestions worked for me.

@justincormack

@durgaswaroop

I am trying to get ssh localhost to work and so I need to start the sshd service.
When I run service sshd start I get the Failed to get D-Bus connection error.
I tried it with --privileged and also @thaJeztah’s suggestion above, but I am still getting the error.

@justincormack

@durgaswaroop

I am using oracle linux 7.2 as the base image and I am trying to setup a hadoop cluster with multiple docker containers. And so I am trying to do ssh localhost from with in the container which needs sshd running. To start sshd I am doing service sshd start and that is giving me this error. That is all I did.

@durgaswaroop

When I try /sbin/init with docker run it will show me a login screen asking for username and password. Is it possible to bypass this by providing arguments directly while running the command?

@kheshav

@durgaswaroop Try with docker exec command to bypass the username and password prompt:

eg:
#Run a container
docker run -it -e "container=docker" --privileged=true -d --security-opt seccomp:unconfined --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro local_redis bash -c "/usr/sbin/init"

#Exec bash to get shell
docker exec -it [ContainerID] /bin/bash

Please checkout for more info: https://github.com/kheshav/dockerSystemctl

@durgaswaroop

@kheshav , That’s what I am doing right now. I just want to know if there is a way to login directly while using sbin/init when the -d option is not given.

@mashinarius

@ghost

Hello All,
I am new in Linux and Docker and facing the same systemctl issue .
I had ran below command to run the container :
docker run —privileged -dit -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup —name dhcp1 —hostname dhcp1 dhcp1 /usr/sbin/init
and after creating of container whenever i try to attach it , its get hung.

Please help me .

@desavera

Hey Salman,

how are you trying to attach to it ? the init seems to be a daemon like
process so it hangs in deed…

Mário.

2017-05-26 10:09 GMT-03:00 Salman4462 <notifications@github.com>:

Hello All,
I am new in Linux and Docker and facing the same systemctl issue .
I had ran below command to run the container :
docker run —privileged -dit -e container=docker -v
/sys/fs/cgroup:/sys/fs/cgroup —name dhcp1 —hostname dhcp1 dhcp1
/usr/sbin/init
and after creating of container whenever i try to attach it , its get hung.

Please help me .


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2296 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHlGMIPnhWfO5Dlp06U_KJq2A0JHAAk1ks5r9s8dgaJpZM4BHQl7>
.

@ghost

Below is the command ,

docker attach dhcp1

@desavera

@ghost

Thanks desavera 😊 It work for me ..

@desavera

@ghost

I want to configure dhcp server on container … but I don’t know the exact steps .. can you help me here ..

@thaJeztah

@desavera

@ghost

@dmfay

@alanwilter

Hi, same problem here, I am running Docker Version 17.09.0-ce-mac35 (19611) and I am doing this:

docker run -it chemdocker/ambertools-17.3 bash
git clone https://github.com/alanwilter/acpype.git
apt-get install rabbitmq-server
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
>  Failed to get D-Bus connection: Unknown error -1

Sure I read all the steps above but didn’t manage to get that to work. In the end, this is just the very first step of a container that is supposed to run a web service based on Django 2.0.

I hope anyone can help me here… or go back to VirtualBox.

TIA

@thaJeztah

@alanwilter containers are not VM’s; generally a container should have a single responsibility (and have a single main process). Think of containers as a mechanism to sandbox a process; each process gets its own sandbox («container»), and you combine those sandboxes to build up your application.

The instructions you’re trying to follow assume that rabbitmq is installed on a full machine / VM where multiple processes are in the same sandbox («the host»), in which case you need an init system to handle those processes.

If you install in a container, and don’t install multiple things in that container, there’s no need to have an init-system (in some exceptional cases you may need a minimal init to «reap» stray child processes; this can be handled by docker through the --init option on docker run or by configuring it on the daemon).

For rabbitmq; you may want to consider using the official rabbitmq image from Docker Hub, which is configured according to best practices for running in a container. If you want to build your own image, you can still use it as a reference/example; https://github.com/docker-library/rabbitmq/blob/f57f88450660d1daaf195e30d05d746279faab40/3.7/debian/Dockerfile

If you do have to install multiple things in a container (think twice, as you’d be doing away with a lot of the advantages and security that containers provide), and if you want to use systemd as an init system (in many cases a more lightweight init may be sufficient, because systemd does a lot), systemd must be the container’s main process («PID1»), not bash

@alanwilter

@thaJeztah Many thanks for your wise words. I am just testing things for the moment and I am learning a good deal of Docker. If I will use Docker, I don’t know yet. I essentially want to put a web service that will need Django 2.0, Celery, rabbitmq (to talk with Celery).

I like the idea of Docker so I can test several things like it was «a linux box», where, in the end, the service will run, and since I am on a Mac, I definitely need to test things as if I were in a e.g. ubuntu box.

I do have VirtualBox and like it a lot, but it takes longer to do things there rather than with Docker, which is, BTW, showing me a great new possibilities. I will the link you sent and so far I am managing some interesting things with link from @dmfay.

Thanks!

@dmfay

@alanwilter look into using Docker Compose long term. If you’re just trying to get something off the ground, you can do it with that image, but like @thaJeztah said, containers aren’t meant to be used in quite the same way that a plain VM is. Each container should do one thing, and you build your system by pulling those together with an orchestration framework like Compose or Kubernetes.

@t2d
t2d

mentioned this issue

Jan 25, 2018

@roipoussiere

Same problem, and after hours of troubles (all docker run options suggested above didn’t work :/), the simple solution was to replace in my dockerfile:

by:

CMD /sbin/apachectl -D FOREGROUND

@gdraheim

Instead of running the underyling apachectl commands directly, one could also use a tool to read the *.service where that line is present anyway. That’s what the initial implementation of my systemctl.py script did.

Later it was expanded to even cover the case for running as an /sbin/init replacement. So there is no need for --priviledge mode or cgroups mapping, all the systemctl commands work without access to a systemd daemon. Have a look at the docker-systemctl-replacement for more details.

@1702773

Hi everyone I`m a problem from container did you anyone solve this problem.

docker run -itd --name gomokutest62 --privileged=true -p 80:80 -p 2000:22 -v /sys/fs/cgroup:/sys/fs/cgroup -v /home/contestants/:/var/www/html/gomoku/gomoku_web -v /home/teacher/turninman/TurninMap/:/var/www/html/gomoku/gomoku_web/TurninMap cbb107039/server:gomoku_t6 /usr/sbin/init

run after in container

[root@gomoku ~]# docker exec -it gomokutest62 bash
[root@c0d137947bca /]# systemctl
Failed to get D-Bus connection: 此項操作並不被允許
[root@c0d137947bca /]#

if this area can’t post this problem I’m sorry , but on the internet I’m can’t find the solve way.

@izharskiy

I met the same problem when running systemctl in centos docker.
Official centos7 image has no systemctl, so i download and build it, everything seems ok.

[root@85287f97016e systemd-216]# systemctl
Failed to get D-Bus connection: Unknown error -1
So the systemctl can not run inside docker, right? thanks!

try to run your container as privileged
privileged: true in compose file

Problem migrating server to pure systemd. Unable to start stop or restart any of my enabled services.  Every command to systemctl except enable/disable results in:
«Failed to get D-Bus connection: No connection to service manager.»

I dunno why enable/disable would work but not status, etc…

Quick note on my environment:
Arch installed on my remote server hosted by linode.com
So, my only access is remote ssh.  This is purely a webserver/mailserver type box.

Here’s what I did so far:
1) installed systemd and depys according to this guide https://wiki.archlinux.org/index.php/Systemd
2) enabled all services from my rc.conf DAEMONS according to this guide: https://wiki.archlinux.org/index.php/Daemons_List

systemctl enable {foo}.service

3) removed initscripts with

and installed systemd-sysvcompat w/

pacman -S systemd-sysvcompat

4) rebooted
5) I can confirm that «cat /proc/1/comm» does in fact output «systemd»

Command » sudo ps aux | grep dbus » gives me:

dbus      1781  0.0  0.2   3076  1352 ?        Ss   12:33   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation

Command «netstat antp |grep dbus» give me:

unix  3      [ ]         STREAM     CONNECTED     4414     /run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     4403     /run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     4401     /run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     4370     /run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     4369     /run/dbus/system_bus_socket

I feel I’m almost there and must be missing something stupid…
Please help

Here’s a list of services from /etc/systemd/system/multi-user.target.wants

NetworkManager.service
clamd.service
dcron.service
dovecot.service
fail2ban.service
freshclamd.service
iptables.service
nginx.service                                                                                                                                                                                                  
ntpd.service
postfix.service
postgrey.service
remote-fs.target
spamassassin.service
spawn-fcgi-php.service
sshd.service
syslog-ng.service

DAEMONS is the only variable in my rc.conf.  Here it is:

DAEMONS=(syslog-ng iptables network netfs crond sshd ntpd fail2ban mysqld spamd postgrey dovecot postfix nginx spawn-fcgi-php clamav)

systemd man page that: «systemd uses control groups to effectively keep track of processes. Control group information is maintained in the kernel, and is accessible via the file system hierarchy (beneath /sys/fs/cgroup/systemd/)»  I ran the command «findmnt | grep /sys/fs/cgroup» but it returns an empty result…

Last edited by bx (2012-11-29 22:58:06)

Понравилась статья? Поделить с друзьями:
  • Error unable to build the nvidia kernel module
  • Error unable to bind to the ldap server as the root ldap user
  • Error unable to backup due to error in vmdk backup
  • Error unable to allocate memory for the dll 5
  • Error unable to acquire lms api