Bug 1026545 - dockerinit fails with "libdevmapper.so.1.02: cannot open shared object file"
dockerinit fails with "libdevmapper.so.1.02: cannot open shared object file"
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: docker-io (Show other bugs)
19
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Vincent Batts
Fedora Extras Quality Assurance
: Reopened
: 1028670 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-04 17:52 EST by Seth Jennings
Modified: 2013-12-13 21:47 EST (History)
19 users (show)

See Also:
Fixed In Version: docker-io-0.7.0-14.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-25 12:48:02 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
dockerinit build process fix (1.29 KB, patch)
2013-11-24 20:52 EST, dan-fedora
no flags Details | Diff

  None (edit)
Description Seth Jennings 2013-11-04 17:52:17 EST
Description of problem:
dockerinit fails with "libdevmapper.so.1.02: cannot open shared object file"

Version-Release number of selected component (if applicable):
docker-io-0.7-0.12.dm.fc19.x86_64.rpm

How reproducible:
Every time

Steps to Reproduce:
1. Install docker-io-0.7-0.12.dm.fc19.x86_64.rpm on F19
2. Download official ubuntu image
3. docker run ubuntu echo "hello world"

Actual results:
/.dockerinit: error while loading shared libraries: libdevmapper.so.1.02: cannot open shared object file: No such file or directory

Expected results:
Get "hello world" output from ubuntu container
Comment 1 Seth Jennings 2013-11-04 17:54:22 EST
Got the RPM from http://lsm5.fedorapeople.org/rpmbuild/RPMS/x86_64/docker-io-0.7-0.12.dm.fc19.x86_64.rpm

Also ldd on /usr/bin/docker-init:

# ldd /usr/bin/docker-init 
	linux-vdso.so.1 =>  (0x00007ffff97fe000)
	libdevmapper.so.1.02 => /lib64/libdevmapper.so.1.02 (0x0000003597e00000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003597200000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003596a00000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003598200000)
	libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003599a00000)
	libudev.so.1 => /lib64/libudev.so.1 (0x000000359ae00000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003596600000)
	libdl.so.2 => /lib64/libdl.so.2 (0x0000003596e00000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x0000003597a00000)
	librt.so.1 => /lib64/librt.so.1 (0x0000003598a00000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003598600000)
Comment 2 Josh Poimboeuf 2013-11-04 18:01:15 EST
Also related: bug 1017186 (can't compile dockerinit statically with go 1.1)
Comment 3 Josh Poimboeuf 2013-11-04 18:02:46 EST
Alex, can you comment on why docker-init requires libdevmapper?  Is it for Docker-in-Docker?
Comment 4 Lokesh Mandvekar 2013-11-04 23:11:39 EST
just throwing it out there: this also occurs with centos and busybox containers
Comment 5 Alexander Larsson 2013-11-06 04:13:18 EST
docker-init should not need libdevmapper. I don't know what branch this is build from. but the fixes for docker-init was on a different branch than the dm work unfortunately which lead to this. In general, the DM work is not yet landed, and is being reworked (again) upstream, including changing the on-disk layout. Trying to support the pre 0.7.0 releases is not really a good idea, lets finish this upstream first.
Comment 6 Matthew Miller 2013-11-09 09:22:34 EST
*** Bug 1028670 has been marked as a duplicate of this bug. ***
Comment 7 Raphaël Davaillaud 2013-11-12 08:26:55 EST
This occurs with the official centos 6 image, but not with quagbrain/centos5.9 image.
Comment 8 Tianon Gravi 2013-11-13 10:05:15 EST
This is a direct result of how the "docker-init" binary was created (non-static), and is one of several reasons why docker is distributed as a static binary.  We do have a new build script that will build a separate static dockerinit however, and it is available by invoking "./hack/make.sh dynbinary" (designed specifically with packagers in mind).

So assuming you use a git revision that includes the "hack/make/dynbinary" file (which was commit 21161dbd515fb97cf9052a5980de6fc6180a89dc), you can replace the following build lines in your spec file:
---
# passing version information build flags BZ #1017186
export LDFLAGS="-X main.GITCOMMIT %{shortcommit}/%{release} -X main.VERSION %{version} -w"
go build -v -a -ldflags "$LDFLAGS" github.com/dotcloud/docker/docker
go build -v -a -ldflags "$LDFLAGS" github.com/dotcloud/docker/docker-init

popd
---

With:
---
popd

./hack/make.sh dynbinary
---

Then, the install lines:
---
install -p -m 755 _build/docker %{buildroot}%{_bindir}
install -p -m 755 _build/docker-init %{buildroot}%{_bindir}
---

With:
---
install -d %{buildroot}%{_libexecdir}/docker
install -p -m 755 bundles/$(cat VERSION)/dynbinary/docker-$(cat VERSION) %{buildroot}%{_bindir}/docker
install -p -m 755 bundles/$(cat VERSION)/dynbinary/dockerinit-$(cat VERSION) %{buildroot}%{_libexecdir}/docker/dockerinit
---

This method will allow for building dockerinit statically, even while using Go 1.1.2.
Comment 9 Lokesh Mandvekar 2013-11-19 16:25:27 EST
0.7-rc5 has been submitted to rawhide by vbatts
Comment 10 Dave Lawrence 2013-11-20 23:42:45 EST
The error still occurs for me running the new version:

[dkl@localhost ~]$ docker run -i -t centos bash
/.dockerinit: error while loading shared libraries: libdevmapper.so.1.02: cannot open shared object file: No such file or directory

RPM:
http://koji.fedoraproject.org/koji/buildinfo?buildID=479658
docker-io-0.7-0.16.rc6.fc20
Comment 11 Marek Goldmann 2013-11-21 02:38:41 EST
(In reply to Dave Lawrence from comment #10)
> The error still occurs for me running the new version:
> 
> [dkl@localhost ~]$ docker run -i -t centos bash
> /.dockerinit: error while loading shared libraries: libdevmapper.so.1.02:
> cannot open shared object file: No such file or directory

This is reported in bug 1032884.
Comment 12 Marek Goldmann 2013-11-21 02:40:08 EST
Ignore my previous comment :)
Comment 13 Marek Goldmann 2013-11-21 03:28:53 EST
I can confirm this issue. It seems it depends on the image we want to run. Fedora images work good, whereas centos image has issues:

Uploading context 10240 bytes
Step 1 : FROM centos
 ---> 539c0211cd76
Step 2 : RUN yum -y install openssh-server
 ---> Running in a7fde642db8a
/.dockerinit: error while loading shared libraries: libdevmapper.so.1.02: cannot open shared object file: No such file or directory
Error build: The command [/bin/sh -c yum -y install openssh-server] returned a non-zero code: 127

I'm not sure if this is a docker-io package issue or the image itself.
Comment 14 Marek Goldmann 2013-11-21 03:30:08 EST
Forgot to mention that I use docker-io-0.7-0.13.dm.fc20.x86_64.

P.S. Sorry for the spam.
Comment 15 Vincent Batts 2013-11-21 09:18:51 EST
Good to know. I was thinking it had something to do with the images.
The latest builds of docker-io have a statically linked dockerinit. Until it gets promoted, you could try the builds from koji http://koji.fedoraproject.org/koji/buildinfo?buildID=479658
Similarly for the centos image. Perhaps just mockbuild --rebuild the srpm for a centos machine, and install that rpm for the image.
Comment 16 Dave Lawrence 2013-11-21 10:11:24 EST
(In reply to Vincent Batts from comment #15)
> Until it gets promoted, you could try the builds from koji
> http://koji.fedoraproject.org/koji/buildinfo?buildID=479658

Are you saying the rpm at the above links includes the newer staticly linked dockerinit, as that package still exhibits the same error for me? Or is there a new build coming through the system?

dkl
Comment 17 Dave Lawrence 2013-11-21 10:16:41 EST
(In reply to Dave Lawrence from comment #16)
> (In reply to Vincent Batts from comment #15)
> > Until it gets promoted, you could try the builds from koji
> > http://koji.fedoraproject.org/koji/buildinfo?buildID=479658
> 
> Are you saying the rpm at the above links includes the newer staticly linked
> dockerinit, as that package still exhibits the same error for me? Or is
> there a new build coming through the system?
> 
> dkl

Or maybe I do not understand properly how this works. Is the dockerinit injected into the container root at the time the container is created, or does the image that is downloaded from the docker registry already contain the dockerinit? If the latter, then is it that the centos image will need to be updated for it to work?

dkl
Comment 18 Michael Young 2013-11-22 14:10:34 EST
I believe docker is running within the container or at least load libraries from it (with docker-io-0.7-0.16.rc6.fc19.x86_64). I get the error
/.dockerinit: error while loading shared libraries: libdevmapper.so.1.02: cannot open shared object file: No such file or directory
when trying
docker run mattdm/fedora-small /bin/echo hello world
I do get "hello world" if I manually add /usr/lib64/libdevmapper.so.1.02 to the mattdm/fedora-small image, and I get the corresponding "error while loading shared libraries" error if I manually move libsqlite3.so.0 out of the way, similarly for libpcre.so.1 .
Comment 19 dan-fedora 2013-11-24 20:52:05 EST
Created attachment 828465 [details]
dockerinit build process fix

The problem was that /usr/bin/docker was built with the flag utils.IAMSTATIC, which made it map itself on /.dockerinit in the LXC.  Attached is a patch to the spec file (applied to http://koji.fedoraproject.org/koji/buildinfo?buildID=480402) to not set IAMSTATIC on /usr/bin/docker, and also to set utils.INITSHA1 to the SHA1 of /usr/libexec/docker/dockerinit 

I've disabled __os_install_post's binary modification steps, as that interferes with docker's SHA1 check.

Which this patch, I can run a CentOS in docker on Fedora:
# cat /etc/redhat-release ; docker run -rm=true centos cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat)
CentOS release 6.4 (Final)
Comment 20 Dave Lawrence 2013-11-24 23:08:09 EST
(In reply to dan-fedora from comment #19)
> Created attachment 828465 [details]
> dockerinit build process fix

I can verify that the above patch fixes the issue for me.

dkl
Comment 21 Marek Goldmann 2013-11-25 07:47:07 EST
+1 This patch fixes the issue for me too.
Comment 22 Vincent Batts 2013-11-25 07:58:56 EST
cool. I'm working it through the dists, and will push it out shortly.
Comment 23 Fedora Update System 2013-11-25 08:41:01 EST
docker-io-0.7-0.20.rc7.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7-0.20.rc7.fc19
Comment 24 Viacheslav Dubrovskiy 2013-11-25 08:41:54 EST
+1 Yes it helped.
Comment 25 Fedora Update System 2013-11-25 08:42:11 EST
docker-io-0.7-0.20.rc7.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7-0.20.rc7.fc20
Comment 26 Fedora Update System 2013-11-25 08:43:25 EST
docker-io-0.7-0.20.rc7.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7-0.20.rc7.el6
Comment 27 Fedora Update System 2013-11-27 13:09:00 EST
docker-io-0.7.0-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-2.el6
Comment 28 Fedora Update System 2013-11-28 02:03:45 EST
docker-io-0.7.0-6.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-6.fc20
Comment 29 Fedora Update System 2013-11-28 02:14:04 EST
docker-io-0.7.0-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-6.fc19
Comment 30 Fedora Update System 2013-11-28 04:12:56 EST
docker-io-0.7.0-9.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-9.fc20
Comment 31 Fedora Update System 2013-11-28 04:24:09 EST
docker-io-0.7.0-9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-9.fc19
Comment 32 Fedora Update System 2013-11-28 04:42:31 EST
docker-io-0.7.0-9.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-9.el6
Comment 33 Fedora Update System 2013-11-28 13:28:33 EST
docker-io-0.7.0-10.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-10.fc20
Comment 34 Fedora Update System 2013-11-28 13:36:38 EST
docker-io-0.7.0-10.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-10.fc19
Comment 35 Fedora Update System 2013-11-28 13:44:26 EST
docker-io-0.7.0-10.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-10.el6
Comment 36 Fedora Update System 2013-12-01 14:33:40 EST
docker-io-0.7.0-12.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-12.fc20
Comment 37 Fedora Update System 2013-12-01 21:45:24 EST
docker-io-0.7.0-12.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-12.fc19
Comment 38 Fedora Update System 2013-12-01 23:59:14 EST
docker-io-0.7.0-12.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-12.el6
Comment 39 Fedora Update System 2013-12-02 11:00:54 EST
docker-io-0.7.0-14.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-14.fc20
Comment 40 Fedora Update System 2013-12-02 11:17:07 EST
docker-io-0.7.0-14.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-14.fc19
Comment 41 Fedora Update System 2013-12-02 11:28:32 EST
docker-io-0.7.0-14.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-io-0.7.0-14.el6
Comment 42 Fedora Update System 2013-12-02 20:20:25 EST
docker-io-0.7.0-14.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 43 Fedora Update System 2013-12-03 05:38:42 EST
docker-io-0.7.0-14.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 44 Fedora Update System 2013-12-13 21:47:30 EST
docker-io-0.7.0-14.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.