Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

systemctl will not start Redis because the unit is masked

ErrorFailed to start redis-server.service: Unit redis-server.service is masked.

Short answer

A masked unit is linked to /dev/null, so systemd refuses to start it by any route. Someone or some tool ran systemctl mask. Confirm with is-enabled, run systemctl unmask redis-server, reload systemd, then enable and start the service. If a different Redis unit is the one you want, start that one.

  • Applies to systemd 255, Ubuntu 24.04, Redis 7.4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask systemd how it sees the unit. The word masked in the output confirms the cause.

    systemctl is-enabled redis-server
    ls -l /etc/systemd/system/redis-server.service
  2. 2Match what you see, then jump to its fix

    1. 1is-enabled prints masked and the unit file in /etc/systemd/system points to /dev/nullThe unit was masked on purpose or by a scriptFix
    2. 2systemctl start works but Redis is gone after a rebootAfter unmasking, the service is still not enabled for bootFix

What does the error look like?

  • Failed to start redis-server.service: Unit redis-server.service is masked.
  • Unit redis-server.service is masked

Cause 1 of 2

The unit was masked on purpose or by a script

1Check

mask links the unit file to /dev/null, which makes it impossible to start.

systemctl is-enabled redis-server

2Fix

Undo it with unmask, reload the manager configuration, then start the service.

sudo systemctl unmask redis-server
sudo systemctl daemon-reload
sudo systemctl start redis-server

3Verify

The service is active.

systemctl status redis-server --no-pager

Confirmed by freedesktop.org

Did this fix it?

Cause 2 of 2

After unmasking, the service is still not enabled for boot

1Check

The Redis apt package should start Redis at install and at boot. If it does not, the documented fix is to enable and start the service, so check whether the unit is enabled.

systemctl is-enabled redis-server

2Fix

Enable it and start it in one pass.

sudo systemctl enable --now redis-server

3Verify

is-enabled prints enabled and the server answers.

systemctl is-enabled redis-server
redis-cli PING

Confirmed by redis.io

Did this fix it?

How do I stop it coming back?

  • Before masking a service in an image or script, write down why, and unmask it in the step that needs it.
  • After a package install in a container or image build, check systemctl is-enabled for the services you expect.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.