Skip to content

Instantly share code, notes, and snippets.

@ApOgEE
Last active December 24, 2024 14:15
Show Gist options
  • Save ApOgEE/3152683b95bb030a5b2fdfa58f07fde8 to your computer and use it in GitHub Desktop.
Save ApOgEE/3152683b95bb030a5b2fdfa58f07fde8 to your computer and use it in GitHub Desktop.
failed to enable unit: Unit file /lib/systemd/system/nfs-common.service is masked

This happens in ubuntu 22.04.4 LTS server where nfs-common service failed to enable and reported is masked. Here is how to fix it.

$ 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.

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

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

$ sudo systemctl daemon-reload

$ 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)
     Active: inactive (dead)
       Docs: man:systemd-sysv-generator(8)
       

$ 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)
     Active: active (running) since Tue 2024-12-24 20:59:35 +08; 6s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1762669 ExecStart=/etc/init.d/nfs-common start (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 38308)
     Memory: 4.7M
        CPU: 187ms
     CGroup: /system.slice/nfs-common.service
             ├─1762678 /sbin/rpc.statd
             └─1762693 /usr/sbin/rpc.idmapd

Dis 24 20:59:35 apps07-cron systemd[1]: Starting LSB: NFS support files common to client and server...
Dis 24 20:59:35 apps07-cron nfs-common[1762669]:  * Starting NFS common utilities
Dis 24 20:59:35 apps07-cron rpc.statd[1762678]: Version 2.6.1 starting
Dis 24 20:59:35 apps07-cron sm-notify[1762679]: Version 2.6.1 starting
Dis 24 20:59:35 apps07-cron sm-notify[1762679]: Already notifying clients; Exiting!
Dis 24 20:59:35 apps07-cron rpc.idmapd[1762693]: Setting log level to 0
Dis 24 20:59:35 apps07-cron nfs-common[1762669]:    ...done.
Dis 24 20:59:35 apps07-cron systemd[1]: Started LSB: NFS support files common to client and server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment