卸载openssh-server后再次安装出错

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
maple412
帖子: 45
注册时间: 2017-11-25 22:36

卸载openssh-server后再次安装出错

#1

帖子 maple412 » 2018-09-18 11:44

通过apt-get autoremove openssh-server删除掉ssh软件
然后再重新装的时候,提示如下错误。
正在设置 openssh-server (1:7.5p1-10ubuntu0.1) ...
dpkg: 处理软件包 openssh-server (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 10
在处理时有错误发生:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

dpkg --configure -a 结果如下
正在设置 openssh-server (1:7.5p1-10ubuntu0.1) ...
dpkg: 处理软件包 openssh-server (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 10
在处理时有错误发生:
openssh-server

其他软件貌似也装不了,请问该如何解决
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 卸载openssh-server后再次安装出错

#2

帖子 astolia » 2018-09-18 12:06

先说一句题外话,autoremove后面是没有参数的。要卸载用remove或purge
你先彻底删除openssh-server

代码: 全选

sudo apt purge openssh-server
如果这样之后重装openssh-server还有问题,用

代码: 全选

sudo dpkg -D70777 --configure openssh-server
看看具体的错误在哪里
maple412
帖子: 45
注册时间: 2017-11-25 22:36

Re: 卸载openssh-server后再次安装出错

#3

帖子 maple412 » 2018-09-18 12:41

卸载后重新安装还是有错,执行命令结果如下
D000001: ensure_diversions: new, (re)loading
D000001: process queue pkg openssh-server:amd64 queue.len 0 progress 1, try 1
D000040: checking dependencies of openssh-server:amd64 (- <none>)
D000400: checking group ...
D000400: checking possibility -> adduser
D000400: checking non-provided pkg adduser:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> dpkg
D000400: checking non-provided pkg dpkg:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libpam-modules
D000400: checking non-provided pkg libpam-modules:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libpam-runtime
D000400: checking non-provided pkg libpam-runtime:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> lsb-base
D000400: checking non-provided pkg lsb-base:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> openssh-client
D000400: checking non-provided pkg openssh-client:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> openssh-sftp-server
D000400: checking non-provided pkg openssh-sftp-server:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> procps
D000400: checking non-provided pkg procps:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> ucf
D000400: checking non-provided pkg ucf:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> debconf
D000400: checking non-provided pkg debconf:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> init-system-helpers
D000400: checking non-provided pkg init-system-helpers:all
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libaudit1
D000400: checking non-provided pkg libaudit1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libc6
D000400: checking non-provided pkg libc6:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libcomerr2
D000400: checking non-provided pkg libcomerr2:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libgssapi-krb5-2
D000400: checking non-provided pkg libgssapi-krb5-2:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libkrb5-3
D000400: checking non-provided pkg libkrb5-3:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libpam0g
D000400: checking non-provided pkg libpam0g:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libselinux1
D000400: checking non-provided pkg libselinux1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libssl1.0.0
D000400: checking non-provided pkg libssl1.0.0:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libsystemd0
D000400: checking non-provided pkg libsystemd0:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libwrap0
D000400: checking non-provided pkg libwrap0:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> zlib1g
D000400: checking non-provided pkg zlib1g:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000040: ok 2 msgs >><<
D000040: checking Breaks
D000400: checking breaker openssh-sftp-server:amd64 virtbroken <none>
D000400: checking virtbroken ssh-server
正在设置 openssh-server (1:7.5p1-10ubuntu0.1) ...
D020000: trigproc_activate_packageprocessing pkg=openssh-server:amd64
D000002: fork/exec /var/lib/dpkg/info/openssh-server.postinst ( configure )
dpkg: 处理软件包 openssh-server (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 10
D020000: post_script_tasks - ensure_diversions
D000001: ensure_diversions: same, skipping
D020000: post_script_tasks - trig_incorporate
D010000: trigproc_run_deferred
在处理时有错误发生:
openssh-server
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 卸载openssh-server后再次安装出错

#4

帖子 astolia » 2018-09-18 13:05

执行这个试试

代码: 全选

export DPKG_MAINTSCRIPT_PACKAGE=openssh-server
export DPKG_MAINTSCRIPT_NAME=openssh-server.postinst
sudo -E bash -x /var/lib/dpkg/info/openssh-server.postinst configure
maple412
帖子: 45
注册时间: 2017-11-25 22:36

Re: 卸载openssh-server后再次安装出错

#5

帖子 maple412 » 2018-09-18 13:13

执行结果如下:
root@wuqi-Inspiron-7472:/home/wuqi/桌面# export DPKG_MAINTSCRIPT_PACKAGE=openssh-server
root@wuqi-Inspiron-7472:/home/wuqi/桌面# export DPKG_MAINTSCRIPT_NAME=openssh-server.postinst
root@wuqi-Inspiron-7472:/home/wuqi/桌面# sudo -E bash -x /var/lib/dpkg/info/openssh-server.postinst configure
bash: /var/lib/dpkg/info/openssh-server.postinst: 没有那个文件或目录
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 卸载openssh-server后再次安装出错

#6

帖子 astolia » 2018-09-18 13:29

这样,

代码: 全选

mkdir /tmp/test
cd /tmp/test
apt-get download openssh-server
sudo dpkg -D77777 -i openssh-server* 2>/tmp/a.log
把这些命令的输出贴上来,并把/tmp/a.log文件压缩一下作为附件上传
maple412
帖子: 45
注册时间: 2017-11-25 22:36

Re: 卸载openssh-server后再次安装出错

#7

帖子 maple412 » 2018-09-18 13:49

执行命令如下
root@wuqi-Inspiron-7472:/tmp/test# apt-get download openssh-server
获取:1 http://cn.archive.ubuntu.com/ubuntu artful-updates/main amd64 openssh-server amd64 1:7.5p1-10ubuntu0.1 [336 kB]
已下载 336 kB,耗时 5秒 (65.4 kB/s)
W: 由于文件'/tmp/test/openssh-server_1%3a7.5p1-10ubuntu0.1_amd64.deb'无法被用户'_apt'访问,已脱离沙盒并提权为根用户来进行下载。 - pkgAcquire::Run (13: 权限不够)

root@wuqi-Inspiron-7472:/tmp/test# sudo dpkg -D7777 -i openssh-server* 2>/tmp/test/a.log
(正在读取数据库 ... 系统当前共安装有 3417 个文件和目录。)
正准备解包 openssh-server_1%3a7.5p1-10ubuntu0.1_amd64.deb ...
正在将 openssh-server (1:7.5p1-10ubuntu0.1) 解包到 (1:7.5p1-10ubuntu0.1) 上 ...
正在设置 openssh-server (1:7.5p1-10ubuntu0.1) ...
正在处理用于 systemd (234-2ubuntu12.1) 的触发器 ...
正在处理用于 ureadahead (0.100.0-20) 的触发器 ...
正在处理用于 ufw (0.35-5) 的触发器 ...
正在处理用于 man-db (2.7.6.1-2) 的触发器 ...
附件
a.log.tar.gz
(23.93 KiB) 已下载 103 次
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: 卸载openssh-server后再次安装出错

#8

帖子 oneleaf » 2018-09-18 14:51

试试:

sudo apt-get remove openssh-server openssh-client --purge && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get update
sudo apt-get install openssh-server openssh-client
maple412
帖子: 45
注册时间: 2017-11-25 22:36

Re: 卸载openssh-server后再次安装出错

#9

帖子 maple412 » 2018-09-18 15:24

没有用,操作后还是同样的错误
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 卸载openssh-server后再次安装出错

#10

帖子 astolia » 2018-09-18 21:03

你的这个问题有点严重啊,很多软件包都出现了问题。
先把重要数据另外找个移动硬盘之类的备份。
再做下磁盘检查,看是不是文件系统错误引发的。扫描最好重启在grub菜单那里选advanced options for ubuntu,然后选从recovery mode恢复模式启动,如果恢复模式还能正常运作的话,应该能进一个recovery menu,选root那个
进入root shell后,用

代码: 全选

fsck -A -c -v -f
扫描。扫出问题修复时有可能会导致文件丢失甚至更严重的问题,所以一定要先备份以防万一。
扫描修复完了重启,如果还能正常进入系统的话,重装有问题的软件包,就是/tmp/a.log里提到“无法找到软件包 xxx”的那些,给你个命令直接从文件里把软件包名称提取出来

代码: 全选

sudo apt install --reinstall $(grep '无法找到软件包' /tmp/a.log  | sed 's/^.*软件包 //;s/ .*//')
maple412
帖子: 45
注册时间: 2017-11-25 22:36

Re: 卸载openssh-server后再次安装出错

#11

帖子 maple412 » 2018-09-20 19:36

重装了,还是同样的问题,只有重装系统了,这个问题产生的原因是什么呢
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 卸载openssh-server后再次安装出错

#12

帖子 astolia » 2018-09-21 9:59

这个问题直接原因是安装时有些文件应该被写到硬盘上却没有,而且整个写入过程还没有报错。
如果没有恶意软件干扰的话,一般是文件系统故障导致的,现在用固体盘的多了,也可能是固态盘出现坏块
回复