CEPH | VPN : Systemd Boot order dependencies

Kernels & Hardware, configuring network, installing services

CEPH | VPN : Systemd Boot order dependencies

Postby santosha » 2020-05-11 19:57

Hello everyone,

I have a question regarding the correct usage of systemd in my case. My requirements:

- first start the network stack (network-online.target)
- then start a vpn (vpn.service)
- then mount a ceph distributed filesystem (ceph.mount, generated from fstab)
- then start services that use that filesystem

At the moment, the vpn is started too late, and the machine can't mount the ceph volume. It fails to the
emergency console.

I tried:

systemctl edit vpn.service
Wants=network-online.target
Requires=network-online.target

systemctl edit ceph.mount
Wants=vpn.service
Requires=vpn.service

.... and so on down the dependencies

But it does not work. systemd create override files in /etc/systemd/system but they don't seem to work.

If I do a systemd-analyse dot it doesn't show the changes, and the system still boots into the emergency console.

It would be quite easy to now say bad things about systemd because sure I would know how to fix this in Sysvinit, but maybe someone can enlighten me what the proper procedure with systemd is?

I can't figure it out.

By the way, the same problem is on shutdown. It tries to unmount the ceph volume before all services that keep files open there are shutdown. It takes about 5 minutes and a hard kill to finally shutdown.

Would appreciate pointers how to solve this problem the proper way.

System: Debian 10 Buster all updates amd64

thanks,

Santosha
santosha
 
Posts: 7
Joined: 2020-05-11 19:47

Re: CEPH | VPN : Systemd Boot order dependencies

Postby Head_on_a_Stick » 2020-05-12 17:32

santosha wrote:I tried:

systemctl edit vpn.service
Wants=network-online.target
Requires=network-online.target

systemctl edit ceph.mount
Wants=vpn.service
Requires=vpn.service

.... and so on down the dependencies

You need to clear the pre-existing statements and also declare the section in the override file, like this for ceph.mount:
Code: Select all
[Unit]
Requires=
Requires=vpn.service # add other services here as well
After=
After=vpn.service # add other services here as well

Note that Wants= is just a weaker version of Requires= so there's no need for both. See systemd.unit(5) for more on this.

I don't actually have any experience of remote filesystems or VPNs but it might be worth experimenting with the x-systemd fstab options, see systemd.mount(5) for a full explanation of the various types.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12744
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: CEPH | VPN : Systemd Boot order dependencies

Postby santosha » 2020-05-19 23:40

Head_on_a_Stick wrote:You need to clear the pre-existing statements and also declare the section in the override file, like this for ceph.mount:
Code: Select all
[Unit]
Requires=
Requires=vpn.service # add other services here as well
After=
After=vpn.service # add other services here as well

Note that Wants= is just a weaker version of Requires= so there's no need for both. See systemd.unit(5) for more on this.

I don't actually have any experience of remote filesystems or VPNs but it might be worth experimenting with the x-systemd fstab options, see systemd.mount(5) for a full explanation of the various types.

Thank you very much. The correct way to go was the x-systemd.requires=vpn.service mount option in fstab. That made systemd setup correct boot and shutdown dependencies.

I have one problem remaining. The various ceph services don't start at bootup automatically, although I have set them up to do so:

systemctl enable ceph-mds@mds-localhost

After reboot the service does not come up:

Code: Select all
# systemctl status ceph-mds@mds-localhost
* ceph-mds@mds-localhost.service - Ceph metadata server daemon
     Loaded: loaded (/usr/lib/systemd/system/ceph-mds@.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/ceph-mds@mds-localhost.service.d
             `-override.conf
     Active: inactive (dead)

The override:
[Unit]
Requires=vpn.service
After=vpn.service

It uses a systemd slice since there can be multiple instances of the service on the same host.

Do you have an idea what could go wrong here? In the journal there is no mentioning of the service at all at bootup. Something is not working right there.
santosha
 
Posts: 7
Joined: 2020-05-11 19:47


Return to System configuration

Who is online

Users browsing this forum: No registered users and 18 guests

fashionable