Home > Software design >  Unable to kill the port 6379 used by redis installed with snap
Unable to kill the port 6379 used by redis installed with snap

Time:11-17

im confuse with redis instalation. I've already tried uninstall redis with any tutorials, also trying uninstall manually. But, redis still used 6379 port.

dna@dna:~$ sudo netstat -tulnp | grep 6379
[sudo] password for dna:    
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      22141/redis-server  
tcp6       0      0 :::6379                 :::*                    LISTEN      22141/redis-server  
dna@dna:~$ apt-get autopurge redis-server
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
dna@dna:~$ sudo apt-get autopurge redis-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'redis-server' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
dna@dna:~$ sudo apt-get autopurge redis*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package redis-stable
E: Unable to locate package redis-stable.tar.gz
E: Couldn't find any package by glob 'redis-stable.tar.gz'
E: Couldn't find any package by regex 'redis-stable.tar.gz'
dna@dna:~$ redis-cli

my docker apps used redis already stopped, also the redis image already removed too.
Here's my os:

dna@dna:~$ hostnamectl
 Static hostname: dna
       Icon name: computer-laptop
         Chassis: laptop
      Machine ID: -------
         Boot ID: -------
Operating System: Linux Mint 21                   
          Kernel: Linux 5.15.0-41-generic
    Architecture: x86-64
 Hardware Vendor: Lenovo
  Hardware Model: -------

[UPDATED1]
thank you for answer me. Currently the problem still exist. By this update, here i give you my cmd input and output.

dna@dna:~$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
dna@dna:~$ sudo apt-get autopurge redis*
[sudo] password for dna:    
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package redis-stable
E: Unable to locate package redis-stable.tar.gz
E: Couldn't find any package by glob 'redis-stable.tar.gz'
E: Couldn't find any package by regex 'redis-stable.tar.gz'
dna@dna:~$ redis-cli
Command 'redis-cli' not found, but can be installed with:
sudo apt install redis-tools
dna@dna:~$ redis-cli ping
Command 'redis-cli' not found, but can be installed with:
sudo apt install redis-tools
dna@dna:~$ sudo netstat -tulnp | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      961/redis-server *: 
tcp6       0      0 :::6379                 :::*                    LISTEN      961/redis-server *: 
dna@dna:~$ fuser -n tcp 6379
dna@dna:~$ sudo netstat -tulnp | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      961/redis-server *: 
tcp6       0      0 :::6379                 :::*                    LISTEN      961/redis-server *: 
dna@dna:~$ kill -9 961
bash: kill: (961) - Operation not permitted
dna@dna:~$ sudo kill -9 961
dna@dna:~$ sudo netstat -tulnp | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      36248/redis-server  
tcp6       0      0 :::6379                 :::*                    LISTEN      36248/redis-server  
dna@dna:~$ ps -auxf | grep -i redis
dna        36284  0.0  0.0   9080  2396 pts/0    S    13:02   0:00          \_ grep --color=auto -i redis
root       36248  0.2  0.1  53760  8212 ?        Ssl  13:01   0:00 /snap/redis/525/usr/bin/redis-server *:6379
dna@dna:~$ apt list installed | grep -i redis

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dna@dna:~$ systemctl | grep -i redis
  run-snapd-ns-redis.mnt.mount                                                                                                                                       loaded active mounted   /run/snapd/ns/redis.mnt
  snap-redis-525.mount                                                                                                                                               loaded active mounted   Mount unit for redis, revision 525
  snap.redis.server.service                                                                                                                                          loaded active running   Service for snap application redis.server
dna@dna:~$ 

[UPDATED2]
trying to uninstall redis with snap

dna@dna:~$ sudo snap remove redis.server
[sudo] password for dna:    
snap "redis.server" is not installed
dna@dna:~$ sudo snap remove redis-525
snap "redis-525" is not installed
dna@dna:~$ sudo netstat -tulnp | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      36248/redis-server  
tcp6       0      0 :::6379                 :::*                    LISTEN      36248/redis-server  
dna@dna:~$ sudo snap remove redis.server ; sudo snap remove redis-525
snap "redis.server" is not installed
snap "redis-525" is not installed
dna@dna:~$ systemctl | grep -i redis
  run-snapd-ns-redis.mnt.mount                                                                                                                                       loaded active mounted   /run/snapd/ns/redis.mnt
  snap-redis-525.mount                                                                                                                                               loaded active mounted   Mount unit for redis, revision 525
  snap.redis.server.service                                                                                                                                          loaded active running   Service for snap application redis.server
dna@dna:~$ pkill -9 36248
dna@dna:~$ systemctl | grep -i redis
  run-snapd-ns-redis.mnt.mount                                                                                                                                       loaded active mounted   /run/snapd/ns/redis.mnt
  snap-redis-525.mount                                                                                                                                               loaded active mounted   Mount unit for redis, revision 525
  snap.redis.server.service                                                                                                                                          loaded active running   Service for snap application redis.server
dna@dna:~$ sudo netstat -tulnp | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      36248/redis-server  
tcp6       0      0 :::6379                 :::*                    LISTEN      36248/redis-server  
dna@dna:~$ 

CodePudding user response:

Well, there is your answer! redis is still installed, via snap. This should do the trick:

sudo snap remove redis

What’s the output of ps -auxf | grep -i redis?

Perhaps another redis application is installed, what is the output of apt list installed | grep -i redis?

Also, what is the output of systemctl | grep -i redis

If all that doesn't bring any valueable hints, try to install mlocate w apt install mlocate -y ; updatedb.

Then perform a search for every redis file on disk:

locate -i redis

CodePudding user response:

You can find the PID that is listening on port 6379 with the following command: fuser -n tcp 6379

An example:

[root@server ~]# fuser -n tcp 22
22/tcp:               4837 34711
[root@server ~]# 

If you cannot stop the service, you can kill it: kill -9 <pid>

CodePudding user response:

u can try to login in as root,then unistall redis-server.Because the account dna is not access to read the file /var/lib/dpkg/lock-frontend

  • Related