我尝试安装 lynx 来向别人展示 lynx 的工作原理,但是当我运行时apt-get install lynx
,发生了以下情况。
sudo apt-get install lynx
Reading package lists... Done
Building dependency tree
Reading state information... Done
lynx is already the newest version (2.8.9dev8-4ubuntu1).
lynx set to manually installed.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libreoffice-core : Depends: libreoffice-common (> 1:5.1.4) but it is not going to be installed
libreoffice-java-common : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-breeze : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-elementary : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-galaxy : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-oxygen : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-tango : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
因此我自然而然地尝试了两者sudo apt-get -f install
,结果如下:
sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libreoffice-common
Suggested packages:
libreoffice-style-hicontrast libreoffice-style-human libreoffice-style-sifr
The following NEW packages will be installed:
libreoffice-common
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
21 not fully installed or removed.
Need to get 0 B/22.3 MB of archives.
After this operation, 84.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database ... 345619 files and directories currently installed.)
Preparing to unpack .../libreoffice-common_1%3a5.1.4-0ubuntu1_all.deb ...
Unpacking libreoffice-common (1:5.1.4-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.4-0ubuntu1_all.deb (--unpack):
trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.2-9782
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
/var/cache/apt/archives/libreoffice-common_1%3a5.1.4-0ubuntu1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
所以现在我陷入了困境。我不知道如何解决这个问题。谷歌搜索没有帮助,因为每个人建议的方法都不起作用。
人们建议运行sudo apt-get remove libreoffice* --purge
,但同样,没有apt-get
命令起作用,因为它挂在这个垃圾错误上,告诉我通过执行来修复它-f install
。
如果有人知道如何修复此问题,请告诉我。我真的不想格式化并重新开始。
当我尝试删除虚假的 OpenOffice.org 安装时:
$ sudo apt-get remove -f 'openoffice.*'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'openoffice.org-debian-menus' for glob 'openoffice.*'
[...snip...]
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libreoffice-core : Depends: libreoffice-common (> 1:5.1.4) but it is not going to be installed
libreoffice-java-common : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-breeze : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-elementary : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-galaxy : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-oxygen : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice-style-tango : Depends: libreoffice-common (= 1:5.1.4-0ubuntu1) but it is not going to be installed
libreoffice5.2-base : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-calc : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-dict-en : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-dict-es : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-dict-fr : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-draw : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-en-us : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-impress : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-math : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
libreoffice5.2-writer : Depends: libreoffice5.2 (>= 5.2.4.2) but it is not installable
Depends: libreoffice5.2 (<= 5.2.4.2-2) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
(完整版本)
答案1
看起来你的 LibreOffice 应用程序数据文件夹乱了,简单的解决方法是删除它们:
sudo rm /usr/bin/soffice
sudo rm -r /var/lib/libreoffice
如果您想继续使用 LibreOffice,最好删除 OpenOffice,可能这就是存在以下openoffice-debian-menus
软件包的原因:
sudo apt-get purge openoffice
sudo apt-get purge openoffice-debian-menus
接下来安装最新的 LibreOffice:
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt update; sudo apt dist-upgrade
sudo apt install libreoffice-gtk2 libreoffice-gnome
答案2
在评论互动中,我们发现除了 Ubuntu 默认软件包存储库中的部分 LibreOffice v5.1.* 安装外,还存在 LibreOffice v5.2.* 安装和 OpenOffice.org 安装的残留。我们可以通过以下方式解决此问题
手动删除 LibreOffice v5.2.* 和 OpenOffice.org(的残余):
dpkg-query -Wf '${Status;1} ${Package}\n' openoffice\* libreoffice5.2\* libobasis5.2\* | sed -ne 's/^i //p' | xargs sudo dpkg --remove
(按要求解释:输出的每一行上的第一个字段
dpkg-query
是包状态(由格式选项定义-f
)。i
表示“已安装”,因此sed -ne 's/^i //p'
只会打印以开头的行i
并删除该部分。)然后使用 Apt 修复剩余的包管理问题,并提供选择涉及安装的解决方案的提示
libreoffice-common
(来自默认存储库):sudo apt-get install -f libreoffice-common
答案3
似乎您尝试同时使用 Openoffice 和 Libreoffice...(?) Apt 无法配置 libreoffice-common,因为它将覆盖也已安装的 openoffice-debian-menus。
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.4-0ubuntu1_all.deb (--unpack):
trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.2-9782
尝试删除 openoffice (openoffice-debian-menus) 并再次执行“install -f”...
问候
答案4
您可以在终端中运行此命令
apt-get remove -f
你想删除
谢谢!