You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法终止Snap安装的Redis占用的6379端口问题求助

Redis卸载后仍持续占用6379端口问题

我对Redis的安装感到困惑,已尝试按照各类教程及手动方式卸载Redis,但Redis仍持续占用6379端口。

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

我使用Redis的Docker应用已停止,Redis镜像也已删除。以下是我的操作系统信息:

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: -------

更新1

感谢回复,问题仍未解决。以下是我最新的命令输入及输出:

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:~$ 

更新2

尝试通过Snap卸载Redis:

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:~$ 

内容的提问来源于stack exchange,提问作者dhanyn10

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 19:35:17