Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container cannot connect to Upstart #1024

Closed
FooBarWidget opened this issue Jun 25, 2013 · 14 comments
Closed

Container cannot connect to Upstart #1024

FooBarWidget opened this issue Jun 25, 2013 · 14 comments

Comments

@FooBarWidget
Copy link

Because Docker replaces the default /sbin/init with its own, there's no way to run the Upstart init inside a Docker container. However this causes some problems: some Debian packages try to communicate with Upstart, and will fail to install if this fails. For example the "at" package.

$ sudo apt-get install at
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  default-mta mail-transport-agent
The following NEW packages will be installed:
  at
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 37.4 kB of archives.
After this operation, 188 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ quantal/main at amd64 3.1.13-2ubuntu1 [37.4 kB]
Fetched 37.4 kB in 0s (75.2 kB/s)
Selecting previously unselected package at.
(Reading database ... 23544 files and directories currently installed.)
Unpacking at (from .../at_3.1.13-2ubuntu1_amd64.deb) ...
Processing triggers for ureadahead ...
Setting up at (3.1.13-2ubuntu1) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: initscript atd, action "start" failed.
dpkg: error processing at (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for ureadahead ...
Errors were encountered while processing:
 at
E: Sub-process /usr/bin/dpkg returned an error code (1)
@creack
Copy link
Contributor

creack commented Jun 26, 2013

You can workaround this by doing:

dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

@shykes
Copy link
Contributor

shykes commented Jun 26, 2013

These are actually 2 separate issues:

  1. You're right, 'docker run IMG /sbin/init' doesn't work right now, and it
    should. This will be fixed in pull request Inject dockerinit at /.dockerinit instead of overwriting /sbin/init #898.
  2. Regardless of that issue, you should not rely on upstart running in the
    background during your build - it won't, since docker only runs one process
    at a time. When apt-get is running, upstart is not. Some ubuntu packages
    expect upstart to be running, and fails if it isn't - this is an annoying
    behavior of the ubuntu packaging system, but it is what it is. This can be
    fixed with the workaround described by Guillaume above.

On Tue, Jun 25, 2013 at 5:18 PM, Guillaume J. Charmes <
notifications@github.com> wrote:

You can workaround this by doing:
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl


Reply to this email directly or view it on GitHubhttps://github.com//issues/1024#issuecomment-20018600
.

@FooBarWidget
Copy link
Author

Alright, using the trick given by @creack solved my problem.

@foxx
Copy link

foxx commented Dec 11, 2013

Same problem here, I can confirm that the workaround from @creack worked fine, though it feels a bit hacky

@kiorky
Copy link
Contributor

kiorky commented Dec 11, 2013

you may have a look to #2276.

sameersbn pushed a commit to sameersbn/docker-gitlab that referenced this issue Apr 1, 2014
sameersbn pushed a commit to sameersbn/docker-gitlab-ci-runner that referenced this issue Apr 2, 2014
sameersbn pushed a commit to sameersbn/docker-nginx that referenced this issue Apr 2, 2014
sameersbn pushed a commit to sameersbn/docker-redmine that referenced this issue Apr 2, 2014
sameersbn pushed a commit to sameersbn/docker-ubuntu that referenced this issue Apr 2, 2014
sameersbn pushed a commit to sameersbn/docker-gitlab-ci that referenced this issue Apr 11, 2014
sameersbn pushed a commit to sameersbn/docker-gitlab-ci-runner that referenced this issue Apr 11, 2014
sameersbn pushed a commit to sameersbn/docker-gitlab that referenced this issue Apr 11, 2014
sameersbn pushed a commit to sameersbn/docker-redmine that referenced this issue Apr 14, 2014
sameersbn pushed a commit to sameersbn/docker-bind that referenced this issue Apr 14, 2014
sameersbn pushed a commit to sameersbn/docker-openfire that referenced this issue May 20, 2014
@valerioplessi
Copy link

Hello, I'm having the same problem.

I am running an Ubuntu 14.04 Virtual Machine, and inside that I installed Docker. I hit the issue with the start command failing to connect to upstart. I tried the above workaround from Decker console but no luck, the second command is failing (also tried to force it with -sf or -sfn flag but even though no error on console, no real effect in solving the issue):

root@c396577f9f09:/# dpkg-divert --local --rename --add /sbin/initctl
Leaving 'local diversion of /sbin/initctl to /sbin/initctl.distrib'

root@c396577f9f09:/# ln -s /bin/true /sbin/initctl
ln: failed to create symbolic link '/sbin/initctl': File exists

Any hint?

Thansk!

@sameersbn
Copy link

@vplessi try ln -sf /bin/true /sbin/initctl

@valerioplessi
Copy link

@sameersbn I tried that -sf flag already, check my previous message! The command does not give an error on console, but still the issue with Upstart is there and my processes do not start.

@jeckhart
Copy link

@vplessi Are you sure you tried ln -sf ? According to your previous comment you only tried -s (the -f tells it to overwrite the target)

@Layke
Copy link

Layke commented Jun 20, 2015

So I was able on a Ubuntu distro to run the commands above as a work around, so now my machine will provision correctly the first time. However, now I can't login and see my desktop environment on the machine. Using VirtualBox as the provider and Ubuntu as the distro. Do I need to unlink the symbolic link after successfully loading or just restore the debian package to it's previous value (not sure how to do that also, so commands would be nice, please =D )?

@Layke
Copy link

Layke commented Jun 20, 2015

OK, actually spent an hour looking into it after all, and it seem like just reinstalling the upstart service fixes not being able to see my desktop environment anymore.

 sudo apt-get --reinstall install upstart

I had been trying this way to avoid reinstalling that package. Can anyone tell me what I"m doing wrong here?

 sudo dpkg-diver --local --remove /sbin/initctl
 sudo rm /sbin/initctl

@swatiswjain
Copy link

Is there an equivalent of this in RHEL. I am facing a similar issue when creating Chef Server docker image but I couldn't find dpkg-diver --local --remove /sbin/initctl equivalent for RHEL that works

@amaltson
Copy link

I've got the exact same problem as @swatiswjain with a Chef Server inside Docker.

@ArtificialTruth
Copy link

@Layke
Probably not useful now, but maybe it's

sudo dpkg-divert --local --remove /sbin/initctl

Instead?

EDIT: What I did which made by server boot:

sudo dpkg-divert --local --rename --remove /sbin/initctl

Not sure if the rename is needed.
Then I did:

sudo ln -s /sbin/initctl.distrib /sbin/initctl

Thanks to: https://www.nesono.com/node/368#comment-551780052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests