Jump to content

Emby Server can't access cifs mount after reboot (Docker)


ebrithiljonas

Recommended Posts

ebrithiljonas

Hello,

 

My problem is, that the Emby Server can't access the cifs mount of my NAS after a server reboot. I always need to wait a bit and then restart the emby server.

I have the server installed via docker, and the cifs mount is managed in the /etc/fstab

Is there a way to delay the start of the Emby Server or docker in general until my cifs mount is complete?

 

I already added this

After=media-nas-multimedia_nas.mount

to the docker systemd service, but this doesn't help at all.

 

Thanks for the help

 

Jonas

Link to comment
Share on other sites

Soggybottoms

Hi,

 

Have you tried creating a systemd path unit to monitor your mount point, and once mounted will start the required service?

 

Example:

Filename docker.path (if systemd service is docker.service)

[Unit]Description=Example - Monitor mount point for docker.serviceAfter=example-waitfor.service[Path]PathExists=/path/to/mount/point[Install]WantedBy=example.target

 

Then enable docker.path, instead of docker.service. If all works well it should automatically start the docker service once the mount point exists..

 

More info here - https://www.freedesktop.org/software/systemd/man/systemd.path.html

 

Good luck

Edited by Soggybottoms
Link to comment
Share on other sites

ebrithiljonas

Ok I tried your solution, but now the problem is, that the "docker.path" service isn't starting at all, and yes i enabled it ;)

Here are my 3 service files:

 

docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service
Wants=network-online.target
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

docker.socket

[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target

docker.path

[Unit]
Description=Monitor mount point for docker.service

[Path]
PathExists=/media/nas/multimedia_nas/Videos

[Install]
WantedBy=docker.service

Enabled is only docker.path since it should start docker.service. But now, nothing is starting at all. If I start docker.path manually, everything is workign correct, but I want it to autostart.

 

Thanks for the help so far.

Link to comment
Share on other sites

Soggybottoms

What does the output show for systemctl list-unit-files --type=path? Have you tried adding After=network-online.target under the [unit] configuration in the docker.path file to see if maybe it's an order thing?

 

As an example this is what mine looks like:

 

 

[unit]
Description=Monitor mount point for docker.service
After=network-online.target nfs-client.target

[Path]
PathExists=/content/1

[install]
WantedBy=multi-user.target

 

 

Offtopic from original suggestion..

In regards to your original post where you tried to add the systemd mount unit to your docker service, did you also try adding that same mount unit in 'Requires='?

 

Thanks

Link to comment
Share on other sites

ebrithiljonas

The output show this:

UNIT FILE                          STATE
acpid.path                         enabled
apport-autoreport.path             enabled
docker.path                        enabled
systemd-ask-password-console.path  static
systemd-ask-password-plymouth.path static
systemd-ask-password-wall.path     static

6 unit files listed.

I've added now the "After" part to the docker.path but it still doesn't autostart.

And yes I've tried adding the "Requires=" with the cifs mount to the docker.service, but then the service wouldn't start at all.

Link to comment
Share on other sites

Soggybottoms

ok strange.. the systemctl output looks good..

 

One last thing you can try.. scrap the path method and try a systemd timer unit file with the following info:

 

create a file called docker.timer:

 

[unit]
Description=Start docker service 1 min after boot

[Timer]
OnBootSec=1min

[install]
WantedBy=timers.target

 

You can verify it's enabled by checking: systemctl list-unit-files --type=timer

 

More info here - https://www.freedesktop.org/software/systemd/man/systemd.timer.html

Edited by Soggybottoms
Link to comment
Share on other sites

ebrithiljonas

Hmm, I tried that but my systemd, for whatever reason, doesn't even start the docker.timer service and I don't know why. Do these files need some special permissions to work or anything? I reate them with "sudo nano /etc/systemd/system/docker.timer" and then enable them with "sudo systemctl enable docker.timer" and then I do a reboot. Is there a step that I maybe miss?

Edited by ebrithiljonas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...