systemctl will not start Redis because the unit is masked
Failed 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.
Fix it fast
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.service2Match what you see, then jump to its fix
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-server2Fix
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-server3Verify
The service is active.
systemctl status redis-server --no-pagerConfirmed by freedesktop.org
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-server2Fix
Enable it and start it in one pass.
sudo systemctl enable --now redis-server3Verify
is-enabled prints enabled and the server answers.
systemctl is-enabled redis-server
redis-cli PINGConfirmed by redis.io
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
systemd fails to start redis-server.service with status=1
redis-server.service: Control process exited, code=exited status=1
Status 1 only says Redis exited at startup.
2 causes, each with a fixServers
Redis warns that vm.overcommit_memory must be enabled
Background saving fails with a fork() error
This is a Linux kernel setting, vm.overcommit_memory, and a container shares the host's kernel.
3 causes, each with a fixServers
systemctl fails in WSL: system has not been booted with systemd
System has not been booted with systemd as init system (PID 1). Can't operate.
WSL starts a distribution without systemd unless you turn it on, so systemctl has no init system to talk to.
3 causes, each with a fixServers
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 fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fix