![如何完成从 16.04 到 18.04 的升级?](https://linux22.com/image/1067180/%E5%A6%82%E4%BD%95%E5%AE%8C%E6%88%90%E4%BB%8E%2016.04%20%E5%88%B0%2018.04%20%E7%9A%84%E5%8D%87%E7%BA%A7%EF%BC%9F.png)
我终于有时间将我的台式机从 16.04 升级到 18.04。
正如预期的那样,事情并没有那么顺利。我的电脑挂了,在我开始升级后我无法再解锁它(所以我把它放在那里大约 24 小时)。重启后,它在登录屏幕后就卡住了,切换到 shell 会给我:
$ sudo apt update;sudo apt -y upgrade
[sudo] password for ron:
...
...
E: Unmet dependencies. Try using -f.
ron@ronDesktopHome:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
alembic calligraflow-data calligrawords-common cgmanager dh-python dleyna-server elks-libc emacs24-bin-common emacs24-common emacs24-common-non-dfsg emacs24-el
evolution-data-server-online-accounts fonts-font-awesome fonts-roboto-unhinted fonts-texgyre gcc-5-base:i386 gcc-6-base:i386 gir1.2-notify-0.7 imagemagick-common
kde-style-qtcurve kwin-style-qtcurve libapache2-mod-wsgi-py3 libautodie-perl libblas-common libbotan-1.10-1 libcauchy0.0v5 libclang1-3.6 libcloog-isl4
libconfig-file-perl libdata-alias-perl libdleyna-connector-dbus-1.0-1 libdleyna-core-1.0-3 libedataserverui-1.2-1 libextutils-depends-perl
libextutils-pkgconfig-perl libgdbussyncevo0 libgeos-3.5.0 libgl2ps0 libgoocanvas-common libgoocanvas3 libgps22 libgrilo-0.2-1 libgupnp-av-1.0-2 libgupnp-dlna-2.0-3
libgweather-3-6 libidn11:i386 libieee1284-3:i386 libio-multiplex-perl libjasper-dev libjavascriptcoregtk-3.0-0 libkadm5clnt-mit9 libkdcraw-data libkdcraw23
libkf5activitiesexperimentalstats1 libkf5dbusaddons-bin libkf5iconthemes-bin libkf5prison1 libkf5xmlrpcclient-data libkf5xmlrpcclient5 libkqoauth0 libkvkontakte1
liblivemedia50 libllvm3.6v5 libllvm6.0:i386 libm2mml0.0v5 libmediawiki1 libnet-cidr-perl libnet-server-perl libopencv-calib3d2.4v5 libopencv-contrib2.4v5
libopencv-features2d2.4v5 libopencv-flann2.4v5 libopencv-gpu2.4v5 libopencv-legacy2.4v5 libopencv-ml2.4v5 libopencv-ocl2.4v5 libopencv-photo2.4v5
libopencv-stitching2.4v5 libopencv-superres2.4v5 libopencv-ts2.4v5 libopencv-videostab2.4v5 libopencv2.4-jni libparams-validate-perl libphononexperimental4
libprocps4 libpst4 libqbscore1 libqbsqtprofilesetup1 libqt5clucene5 libqtgstreamer-1.0-0 libqtgstreamerutils-1.0-0 librpm3 librpmbuild3 librpmio3 librpmsign3
libsasl2-modules:i386 libsyncevo-dbus0 libustr-1.0-1 libvoikko1 libvpx3:i386 libwacom-bin libwebkitgtk-3.0-0 libwebpdemux1 libxapian-1.3-5 pgadmin4-doc
python-alembic python-babel-localedata python-gi-dev python-mako python-markupsafe python-sqlalchemy python-sqlalchemy-ext python3-alembic python3-babel
python3-blinker python3-crypto python3-dbus.mainloop.qt python3-ecdsa python3-flask python3-flask-babelex python3-flask-gravatar python3-flask-htmlmin
python3-flask-login python3-flask-mail python3-flask-migrate python3-flask-paranoid python3-flask-principal python3-flask-script python3-flask-security
python3-flask-sqlalchemy python3-flaskext.wtf python3-htmlmin python3-itsdangerous python3-jinja2 python3-paramiko python3-passlib python3-pyasn1 python3-pyinotify
python3-simplejson python3-sqlalchemy python3-sqlparse python3-sshtunnel python3-werkzeug python3-wtforms qml-module-org-kde-runnermodel qml-modules-org-kde-purpose
rename sonnet-plugins system-config-printer-gnome
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
apt apt-transport-https apt-utils aptitude aptitude-common cups-common emacs25 emacs25-bin-common emacs25-common gir1.2-gconf-2.0 gir1.2-glib-2.0
gobject-introspection imagemagick imagemagick-6.q16 libaribb24-0 libbasicusageenvironment1 libboost-filesystem1.65.1 libboost-iostreams1.65.1 libcupsfilters-dev
libcupsimage2-dev libdevmapper1.02.1 libebml4v5 libgirepository-1.0-1 libgroupsock8 libgutenprint2 liblirc-client0 liblircclient0 liblivemedia62
libmagickcore-6.q16-3-extra libmatroska6v5 libmicrodns0 libnfs11 libopenmpt-modplug1 libplacebo4 libpng-dev libpng-tools libprotobuf-lite10 libpython3.6-minimal
libsidplay2 libusageenvironment3 libva-wayland2 libvlc-bin libvlc-dev libvlc5 libvlccore-dev libvlccore9 obex-data-server openmpi-bin openmpi-common
python3.6-minimal vlc-bin vlc-data vlc-plugin-base vlc-plugin-notify vlc-plugin-qt vlc-plugin-samba vlc-plugin-video-output
Suggested packages:
apt-doc aptitude-doc-en | aptitude-doc debtags emacs25-common-non-dfsg imagemagick-doc autotrace curl enscript gnuplot grads hp2xx html2ps povray radiance
ufraw-batch gutenprint-locales lirc libjxr-tools libdvdcss2
Recommended packages:
emacs25-el dmsetup
The following packages will be REMOVED:
emacs emacs24 libpng12-dev libreoffice libsidplay2v5 libvlccore8 pgadmin4 systemd-shim update-manager-kde vlc-nox
The following NEW packages will be installed:
emacs25 emacs25-bin-common emacs25-common libaribb24-0 libboost-filesystem1.65.1 libboost-iostreams1.65.1 libcupsfilters-dev libcupsimage2-dev liblirc-client0
liblivemedia62 libmagickcore-6.q16-3-extra libmicrodns0 libnfs11 libopenmpt-modplug1 libplacebo4 libpng-dev libpng-tools libprotobuf-lite10 libsidplay2
libva-wayland2 libvlc-bin libvlccore9 vlc-bin vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output
The following packages will be upgraded:
apt apt-transport-https apt-utils aptitude aptitude-common cups-common gir1.2-gconf-2.0 gir1.2-glib-2.0 gobject-introspection imagemagick imagemagick-6.q16
libbasicusageenvironment1 libdevmapper1.02.1 libebml4v5 libgirepository-1.0-1 libgroupsock8 libgutenprint2 liblircclient0 libmatroska6v5 libpython3.6-minimal
libusageenvironment3 libvlc-dev libvlc5 libvlccore-dev obex-data-server openmpi-bin openmpi-common python3.6-minimal vlc-data vlc-plugin-notify vlc-plugin-samba
31 upgraded, 26 newly installed, 10 to remove and 2514 not upgraded.
1326 not fully installed or removed.
Need to get 0 B/31.8 MB of archives.
After this operation, 46.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Extracting templates from packages: 100%
(Reading database ... 703286 files and directories currently installed.)
Removing systemd-shim (9-1bzr4ubuntu1) ...
Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd
by systemd-shim'
dpkg-divert: error: rename involves overwriting '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service' with
different file '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd', not allowed
dpkg: error processing package systemd-shim (--remove):
installed systemd-shim package post-removal script subprocess returned error exit status 2
Errors were encountered while processing:
systemd-shim
E: Sub-process /usr/bin/dpkg returned an error code (1)
ron@ronDesktopHome:~$ :25 2019
.1) but 2:25: command not found
ron@ronDesktopHome:~$
答案1
您需要开始阅读错误消息:
error: rename involves overwriting
'/usr/share/dbus-1/system-services org.freedesktop.systemd1.service'
with different file
'/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd'
not allowed.
某些应该写入的文件已存在,并且“不允许”覆盖。
要修复此问题,请将原始文件移动到新的文件名(例如将其重命名为{}.bak
):
sudo mv /usr/share/dbus-1/system-services org.freedesktop.systemd1.service{,.bak}