Skip to content

docker-storage-setup.service not found #261

@LongLiveCHIEF

Description

@LongLiveCHIEF

I'm getting issues with the docker service after reboot, (specifically a cannot take ownership of /vart/lib/docker error in journalctl). After doing some digging, it appears to be some systemd configurations don't quite point to each other correctly.

The primary issue seems to be that there is nothing telling the docker service to wait for css, or no value in a css unit file with the correct values to take ownership of container runtime directory in order to let docker start correctly.

I'm running container-storage-setup using the following template:

# /etc/sysconfig/docker-storage-setup
STORAGE_DRIVER=devicemapper
DEVS="/dev/sdb"
CONTAINER_THINPOOL=thinpool
VG=docker
ROOT_SIZE=10G
DATA_SIZE=40%FREE
MIN_DATA_SIZE=2G
POOL_META_SIZE=16M
CHUNK_SIZE=512K
AUTO_EXTEND_POOL=yes
POOL_AUTOEXTEND_THRESHOLD=60
POOL_AUTOEXTEND_PERCENT=20
WIPE_SIGNATURES=true
DEVICE_WAIT_TIMEOUT=60
CONTAINER_ROOT_LV_NAME=data
CONTAINER_ROOT_LV_MOUNT_PATH=/var/lib/docker
CONTAINER_ROOT_LV_SIZE=40%FREE

Which creates the following EnvironmentFile (loaded by docker.service):

# /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS="--storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true --storage-opt dm.use_deferred_deletion=true "

My systemd files look like this (truncated):

drwx------.  2 root root   35 Oct 27 13:37 docker.service.d
drwxr-xr-x.  2 root root   33 Oct 27 14:15 docker-storage-setup.service.wants (symlink to var-lib-docker.mount)
-rw-------.  1 root root  347 Oct 30 10:09 var-lib-docker.mount

$ sudo ls -al /etc/systemd/system/docker-storage-setup.service.wants
total 4
drwxr-xr-x.  2 root root   33 Oct 27 14:15 .
drwxr-xr-x. 13 root root 4096 Oct 30 10:16 ..
lrwxrwxrwx.  1 root root   40 Oct 27 14:15 var-lib-docker.mount -> /etc/systemd/system/var-lib-docker.mount

Contents of var-lib-docker.mount:

[Unit]
Description=Mount data on /var/lib/docker directory.
Before=docker-storage-setup.service

[Mount]
What=/dev/docker/data
Where=/var/lib/docker
Type=xfs
Options=defaults

[Install]
WantedBy=docker-storage-setup.service

So in this setup:

  1. There is no docker-storage-setup.service as referenced in the var-lib-docker-mount
  2. There's nothing referencing the docker.service, thus allowing the docker.service to start before container-storage-setup has properly mounted the container root lv.

I was able to resolve this issue by changing two values in the var-lib-docker.mount. New content as follows:

   [Unit]
   Description=Mount data on /var/lib/docker directory.
- Before=docker-storage-setup.service
+ Before=docker.service

    [Install]
 - WantedBy=docker.storage-setup.service
 + WantedBy=docker.service

I'm guessing this isn't totally correct, but it does allow docker to start back up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions