Desmascarar um serviço mascarado no Systemd







Eu estava ocupado configurando um docker-volume-netshareplug-in para usar o NFS Volumes for Docker, que depende do nfs-utils/nfs-commonpacote e, ao tentar iniciar o serviço, descobri que o nfs-commonserviço é masked:


1
2
$ sudo systemctl start docker-volume-netshare.service
Failed to start docker-volume-netshare.service: Unit nfs-common.service is masked.

Olhando para o nfs-commonserviço:

1
2
3
4
5
6
7
sudo systemctl is-enabled nfs-common
masked

$ sudo systemctl enable nfs-common
Synchronizing state of nfs-common.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nfs-common
Failed to enable unit: Unit file /lib/systemd/system/nfs-common.service is masked.

Parece que o arquivo da unidade possui um link simbólico para / dev / null:

1
2
$ file /lib/systemd/system/nfs-common.service
/lib/systemd/system/nfs-common.service: symbolic link to /dev/null

Consegui desmascarar o serviço removendo o arquivo:

1
$ sudo rm /lib/systemd/system/nfs-common.service

Em seguida, recarregue o daemon:

1
$ sudo systemctl daemon-reload

Como podemos ver, o nfs-commonserviço não está sendo executado:

1
2
3
4
5
$ sudo systemctl status nfs-common
● nfs-common.service - LSB: NFS support files common to client and server
   Loaded: loaded (/etc/init.d/nfs-common; generated; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

Vamos em frente e iniciar o serviço:

1
2
3
4
5
6
7
8
9
10
$ sudo systemctl start nfs-common
$ sudo systemctl status nfs-common
● nfs-common.service - LSB: NFS support files common to client and server
   Loaded: loaded (/etc/init.d/nfs-common; generated; vendor preset: enabled)
   Active: active (running) since Sat 2017-12-09 08:59:47 SAST; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 7382 ExecStart=/etc/init.d/nfs-common start (code=exited, status=0/SUCCESS)
      CPU: 162ms
   CGroup: /system.slice/nfs-common.service
           └─7403 /usr/sbin/rpc.idmapd

Agora podemos ver que o serviço é desmascarado e iniciado, lembre-se de ativar o serviço na inicialização:

1
2
3
4
5
6
$ sudo systemctl enable nfs-common
nfs-common.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nfs-common

$ sudo systemctl is-enabled nfs-common
enabled



Close Menu