Skip to content

Docker bails on systems with btrfs + SELinux w/o regard for SELinux status #7952

Closed
@dfarrell07

Description

@dfarrell07

I'm seeing "Permission denied" errors from shared library code on a Fedora 20 systems using btrfs.

I've replicated this on two bare metal up-to-date Fedora 20 systems running btrfs, including one that was totally fresh. As a control, everything works fine on an up-to-date Fedora 20 system where Docker uses the devicemapper storage driver (running on an OpenStack deployment, also a very fresh install).

Steps to reproduce:

sudo yum update -y
sudo yum install docker-io -y
sudo systemctl start docker
sudo docker pull fedora
sudo docker run fedora <some command>

The exact result on btrfs storage driver systems varies with the command I attempt to run, but generally some shared lib fails to load with a permission denied error.

Echo (sudo docker run fedora echo "hello world") causes:

echo: error while loading shared libraries: libc.so.6: cannot open shared object file: Permission denied

A Bash shell (sudo docker run fedora /bin/bash) causes:

/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: Permission denied

Results on devicemapper storage driver system are as expected.

The output of the three systems is identical for docker version:

[~]$ sudo docker version
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.2.2
Git commit (client): d84a070/1.1.2
Server version: 1.1.2
Server API version: 1.13
Go version (server): go1.2.2
Git commit (server): d84a070/1.1.2

Output of docker info for the (failing) fresh btrfs system:

[~]$ sudo docker info
Containers: 4
Images: 3
Storage Driver: btrfs
Execution Driver: native-0.2
Kernel Version: 3.11.10-301.fc20.x86_64

Output of docker info for the (working) nearly-fresh devicemapper system:

[~]$ sudo docker info
Containers: 3
Images: 5
Storage Driver: devicemapper
 Pool Name: docker-252:1-131261-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 975.2 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 1.3 Mb
 Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.11.10-301.fc20.x86_64

The (working) devicemapper install and the (failing) totally fresh btrfs install have the same kernel:

# Fresh (failing) btrfs F20 install
[~]$ uname -a
Linux localhost.localdomain 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
# Nearly-fresh (working) devicemapper F20 install
[~]$ uname -a
Linux dfarrell-odl-docker 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

The (failing) not-fresh btrfs install has a newer kernel:

# Not-fresh (failing) btrfs F20 install
[~]$ uname -a
Linux localhost.localdomain 3.15.10-201.fc20.x86_64 #1 SMP Wed Aug 27 21:10:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Note that I can prevent this error, even on the btrfs systems, by either putting SELinux in Permissive mode (sudo setenforce 0, as described by the OP here) or passing the --privileged flag (sudo docker run --privileged fedora echo "hello world", as described here).

# Example of proper behavior on fresh btrfs system when SELinux is in Permissive mode
[~]$ getenforce
Enforcing
[~]$ sudo setenforce 0
[~]$ getenforce
Permissive
[~]$ sudo docker run fedora echo "hello world"
hello world
[~]$ sudo setenforce 1
[~]$ sudo docker run fedora echo "hello world"
echo: error while loading shared libraries: libc.so.6: cannot open shared object file: Permission denied
# Example of proper behavior on not-fresh btrfs system when --privileged flag passed
[~]$ sudo getenforce
Enforcing
[~]$ sudo docker run --privileged fedora echo "hello world"
hello world

My libselinux version is the same on all three systems:

[~]$ sudo yum info libselinux
Installed Packages
Name        : libselinux
Arch        : x86_64
Version     : 2.2.1
Release     : 6.fc20
<snip>

This Docker GitHub Issue comment mentioned switching from aufs to devicemapper as a fix for a seemingly similar issue. That may support the theory that this is a btrfs-related issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions