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

50,493

Solution 1

I found the solution. I think it will help for others | systemctl unmask servicename

$ sudo systemctl unmask  redis-server.service

Solution 2

if redis.service file is missed in directory path /etc/systemd/system/redis.service so we have to create file into this directory using command like:

sudo nano /etc/systemd/system/redis.service and write following things

[Unit]
Description=Redis In-Memory Data Store 
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

Here

  • Unit is description and defining the network behavior,
  • Service is to specify the service's behavior and
  • Install define the systemd target that the service should attach to if enabled.

Then create redis user group and directories using

sudo adduser --system --group --no-create-home redis
  1. sudo mkdir /var/lib/redis (Create directory)
  2. sudo chown redis:redis /var/lib/redis (Change owner permission)
  3. sudo chmod 770 /var/lib/redis

run the service sudo systemctl start redis It will be work fine and check the status using

sudo systemctl status redis

Solution 3

1.sudo systemctl unmask redis-server.service

if redis.service file is missed in directory path

/etc/systemd/system/redis.service ,so we have to create file into this directory using command like:

sudo nano /etc/systemd/system/redis.service and write following things

[Unit]
Description=Redis In-Memory Data Store 
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

Then create redis user group and directories using

sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis (Create directory)
sudo chown redis:redis /var/lib/redis (Change owner permission)
sudo chmod 770 /var/lib/redis

run the service sudo systemctl start redis It will be work fine and check the status using

sudo systemctl status redis
Share:
50,493
Raza Rafaideen
Author by

Raza Rafaideen

Updated on October 27, 2021

Comments

  • Raza Rafaideen
    Raza Rafaideen over 2 years

    I Installed Redis Server on ubuntu 16.04. but when I try to start the redis service using

    $ sudo systemctl start redis
    

    I receive message:

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

    I don't have any idea about this error.