在最近从 Ubuntu 13.10 (saucy) 升级到 14.04.1 LTS (trusty) 时,该过程一直挂起,prerm
并且postrm
删除脚本单核细胞增多症包。问题的症状是输出中出现如下消息dpkg
(/var/log/dist-upgrade/apt-term.log
如果使用ubuntu-release-upgrader
):
$ egrep -B1 'Removing.+ from Mono' /var/log/dist-upgrade/apt-term.log
Preparing to unpack .../libdbus1.0-cil_0.7.0-5ubuntu1_all.deb ...
Removing libdbus1.0-cil from Mono
--
Preparing to unpack .../libdbus-glib1.0-cil_0.5.0-4ubuntu1_all.deb ...
Removing libdbus-glib1.0-cil from Mono
--
Preparing to unpack .../libgdata2.1-cil_2.2.0.0-2_all.deb ...
Removing libgdata2.1-cil from Mono
--
Preparing to unpack .../libmono-addins0.2-cil_1.0+git20130406.adcd75b-3_all.deb ...
Removing libmono-addins0.2-cil from Mono
--
Preparing to unpack .../libnotify0.4-cil_0.4.0~r3032-7_all.deb ...
Removing libnotify0.4-cil from Mono
--
Preparing to unpack .../libtaglib2.1-cil_2.1.0.0-3_all.deb ...
Removing libtaglib2.1-cil from Mono
--
Preparing to unpack .../libmono-addins-gui0.2-cil_1.0+git20130406.adcd75b-3_all.deb ...
Removing libmono-addins-gui0.2-cil from Mono
答案1
该过程挂在以下软件包的prerm
和脚本上:postrm
Preparing to unpack .../libdbus1.0-cil_0.7.0-5ubuntu1_all.deb ...
Removing libdbus1.0-cil from Mono
--
Preparing to unpack .../libdbus-glib1.0-cil_0.5.0-4ubuntu1_all.deb ...
Removing libdbus-glib1.0-cil from Mono
--
Preparing to unpack .../libgdata2.1-cil_2.2.0.0-2_all.deb ...
Removing libgdata2.1-cil from Mono
--
Preparing to unpack .../libmono-addins0.2-cil_1.0+git20130406.adcd75b-3_all.deb ...
Removing libmono-addins0.2-cil from Mono
--
Preparing to unpack .../libnotify0.4-cil_0.4.0~r3032-7_all.deb ...
Removing libnotify0.4-cil from Mono
--
Preparing to unpack .../libtaglib2.1-cil_2.1.0.0-3_all.deb ...
Removing libtaglib2.1-cil from Mono
--
Preparing to unpack .../libmono-addins-gui0.2-cil_1.0+git20130406.adcd75b-3_all.deb ...
Removing libmono-addins-gui0.2-cil from Mono
--
Preparing to unpack .../libappindicator0.1-cil_12.10.1+13.10.20130920-0ubuntu4_all.deb ...
Removing libappindicator0.1-cil from Mono
--
Preparing to unpack .../libgmime2.6-cil_2.6.20-0ubuntu1_all.deb ...
Removing libgmime2.6-cil from Mono
--
Setting up mono-gac (3.2.8+dfsg-4ubuntu1) ...
* Installing 3 assemblies from libappindicator0.1-cil into Mono
为了强制删除软件包,我确定了挂起的prerm
和postrm
脚本,手动运行它们,然后终止挂起的进程。在发布升级期间,我不得不多次执行此操作:
修理
- 找到挂起的
prerm
脚本postrm
并手动运行它:对于挂起的包,eval "sudo $(ps xa -o cmd | grep 'postrm\|prerm' | grep -v grep)"
您应该会看到类似以下内容的输出:Removing libmono-addins-gui0.2-cil from Mono
- 杀死挂起的
prerm
脚本postrm
:ps -ef | grep 'prerm\|postrm' | grep -v grep | awk '{ print $2 }' | xargs sudo kill -9
- 对下一个挂起的包裹重复以下信息:
Removing ___ from Mono
如果遇到错误:
在升级过程中,我遇到了postinst
mono 包之一的脚本故障(mono-gac
... 更像mono-gack!!
)。我按照上面的初始步骤操作,但脚本除外postinst
。然而,这导致我升级失败,升级实用程序处于损坏状态。
我的升级日志中的错误是(为简洁起见,已编辑...请参阅完整日志在这里):
Errors were encountered while processing:
mono-gac
mono-runtime-common
mono-runtime-sgen
mono-runtime
libmono-corlib4.5-cil
[...SNIP...]
libmono-csharp4.0c-cil
gbrainy
libdbus1.0-cil
libdbus-glib1.0-cil
libgdata2.1-cil
libmono-addins0.2-cil
libdbus2.0-cil
libdbus-glib2.0-cil
libnotify0.4-cil
libtaglib2.1-cil
banshee
banshee-extension-soundmenu
libmono-addins-gui0.2-cil
libmono-simd4.0-cil
Processing was halted because there were too many errors.
Log ended: 2014-09-29 14:27:33
那么你的升级过程肯定失败了。你需要强制退出升级程序,将系统重置为之前的版本,然后重新开始升级:
- 如果您正在使用 GTK 版本升级程序:按 Ctrl-C 并询问
Yes
您是否确实要退出。
如果仍然没有退出... 使用以下命令强制退出:ps -ef | grep do-release-upgrade | grep -v grep | awk '{ print $2 }' | xargs kill -9
- 重置您的发布(例如,我重置回
saucy
发布trusty
):sudo sed -i -e 's/trusty/saucy/' /etc/apt/sources.list
sudo sed -i -e 's/trusty/saucy/g; s/14\.04\.1/13.10/g; s/LTS//; /etc/lsb-release
例如,您的文件应如下所示:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.10 DISTRIB_CODENAME=saucy DISTRIB_DESCRIPTION="Ubuntu 13.10"
- 使用以下命令重新运行升级:
sudo do-release-upgrade
答案2
前面的答案有一个拼写错误,它说要运行,
sudo sed -i -e 's/trusty/saucy/g; s/14.04.1/13.10/g; s/LTS//;'
但没有说要将该编辑应用到哪个文件。
我的猜测是他们的意思是 /etc/lsb-release 并且编辑该文件(以及所示的 /etc/apt/sources.list)对我有用。
PS:该网站说我没有足够的业力或其他任何东西来发布“评论”,所以发布这个“答案”(实际上是评论)是唯一的选择......
此外,这里有一个脚本,可以自动执行上一个答案中描述的重复的 ps/run-by-hand/kill 过程(根据需要多次运行脚本以解决挂起问题)
#!/bin/sh
set -e -u
unset GREP_OPTIONS GREP_COLOR GREP_COLORS
line=$(ps xa -o pid,cmd | grep 'postrm\|prerm' | grep -v grep)
[ -n "$line" ] || { echo "No postrm/prerm cmd is running now." >&2; exit 1; }
pid=$( echo "$line" | sed -ne 's/^ *\([0-9][0-9]*\) .*/\1/p' )
cmd=$( echo "$line" | sed -ne 's/^ *[0-9][0-9]* *//p' )
eval "sudo $cmd"
echo -n "Kill pid $pid ? "
read reply
case "$reply" in
[yY]*) (set -x; sudo kill $pid)
&& sleep 1 \
&& sudo kill $pid >/dev/null \
&& (set -x; sudo kill -9 $pid)
;;
esac