存档

文章标签 ‘nginx’

apt无法卸载nginx的问题

2009年4月29日 没有评论

今天小试了一把nginx,用apt装上后开始配置,可对着中文wiki上的文档配置时总是超出预期,出现各种问题,突然想起查看一下版本,竟然是0.4,官方已经0.7了,faint

于是用apt卸掉,结果aptfaint了。。。:

$ sudo apt-get –purge remove nginx
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
nginx*
0 upgraded, 0 newly installed, 1 to remove and 116 not upgraded.
1 not fully installed or removed.
Need to get 0B of archives.
After unpacking 528kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database … 242827 files and directories currently installed.)
Removing nginx …
Stopping nginx: invoke-rc.d: initscript nginx, action “stop” failed.
dpkg: error processing nginx (–purge):
subprocess pre-removal script returned error exit status 1
Starting nginx: invoke-rc.d: initscript nginx, action “start” failed.
dpkg: error while cleaning up:
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
nginx

E: Sub-process /usr/bin/dpkg returned an error code (1)
上网搜了一把,好多都是说直接把相关文件删了,最后看到这个方法:“How to uninstall nginx with apt(
http://www.peterbe.com/plog/how-to-uninstall-nginx-with-apt)”,也就是在/etc/init.d/nginx 脚本的最前面加上exit 0,这样就强制return 0,解决了这个问题:E: “Sub-process /usr/bin/dpkg returned an error code (1)”

然后再apt-get –purge remove nginx,done

最后手动清了/var/lib/nginx/var/log/nginx