59
root@gcomputer:~# systemctl status x11-common
● x11-common.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)

I tried systemctl unmask x11-common and systemctl unmask x11-common.service but that did not change anything.

How do I unmask it?

1
  • In my case the file had been overwritten and was empty.
    – chovy
    Commented Aug 6, 2022 at 3:26

4 Answers 4

66

The commands you are using are both correct. See also the manual.

It seems the unmask command fails when there is no existing unit file in the system other than the symlink to /dev/null. If you mask a service, then that creates a new symlink to /dev/null in /etc/systemd/system where systemd looks for unit files to load at boot. In this case, there is no real unit file.

Others seem to have similar issues

x11-common.service was also masked on my system. You can fix it like this:

First check that the unit file is a symlink to /dev/null

file /lib/systemd/system/x11-common.service

it should return:

/lib/systemd/system/x11-common.service: symbolic link to /dev/null

in which case, delete it

sudo rm /lib/systemd/system/x11-common.service

Since you changed a unit file, you need to run this:

sudo systemctl daemon-reload

now check the status:

systemctl status x11-common

if it doesn't say loaded and running (if the circle is still red), reinstall the package:

sudo apt-get install --reinstall x11-common

and reload the daemon again

sudo systemctl daemon-reload

and check status once more

systemctl status x11-common

Now it's green and running :) The service has no systemd unit file, but systemd happily uses the script for it in /etc/init.d instead.

7
  • Ok, follow-up question: If it was even masked on your system, what is this service for? It seems as it is not really needed if it is masked for both of us.
    – Albert
    Commented Jul 31, 2016 at 11:20
  • @Albert [See here.]( askubuntu.com/questions/712276/…) seems the service works without the systemd unit file (it has a file in /etc/init/...). You might want to ask a new question. What I did made no apparent difference, only the service shows as loaded, enabled, stopped (it's active on startup) (green) instead of loaded masked dead (red). I should read my logs...
    – Zanna
    Commented Jul 31, 2016 at 12:49
  • if an update for systemd comes by, the unit file is reinstalled, so this isn't really a structural solution
    – hbogert
    Commented Jul 17, 2017 at 20:52
  • @hbogert does that happen even if there was no unit file apart from the symlink to /dev/null? You are right about my answer though. I would call this solution a workaround for a... confusing behaviour... of systemd
    – Zanna
    Commented Jul 17, 2017 at 20:57
  • Could you describe your first sentence in terms of exact files which matter in this case (because I don't really understand the scenario your describing)?
    – hbogert
    Commented Jul 17, 2017 at 21:02
4

Here I show how I remove the mask using systemctl

$ sudo systemctl status bluetooth.service
● bluetooth.service
     Loaded: masked (Reason: Unit bluetooth.service is masked.)
     Active: inactive (dead)

$ sudo systemctl unmask bluetooth.service
Removed /etc/systemd/system/bluetooth.service.

$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: e>
     Active: inactive (dead)
       Docs: man:bluetoothd(8)

$ sudo systemctl start bluetooth.service

$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: e>
     Active: active (running) since Sat 2022-07-30 08:50:04 +06; 2s ago
       Docs: man:bluetoothd(8)
   Main PID: 23191 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 9135)
     Memory: 1.6M
     CGroup: /system.slice/bluetooth.service
             └─23191 /usr/lib/bluetooth/bluetoothd
3

Follow the steps below:

  1. systemctl edit systemd-hostnamed

    Add the 2 lines below then exit the editor (don't forget to save when prompted):

    [Service]
    PrivateNetwork=no
    
  2. This will create an override.conf file with the above 2 lines in the directory:

    /etc/systemd/system/systemd-hostnamed.service.d/
    
  3. The update systemd:

    systemctl daemon-reload
    
  4. Then restart the service:

    systemctl restart systemd-hostnamed
    

You should now be able to run hostnamectl without it hanging.

2

It could be your service has an empty override file, like this:

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; masked; vendor preset: enabled)
  Drop-In: /etc/systemd/system/redis-server.service.d
           └─limit.conf

Check if limit.conf is an empty file. If it is, please remove it. Then the service should be unmasked.

1
  • i have added my actions to orig question. Also after masking networkd. and reboot system intfc did not come up. So it is clear that networkd is managing the interface. How can I ensure that it is done by NetworkManager and not networkd ?
    – rajeev
    Commented Feb 3, 2023 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .