我正在使用 Ubuntu MATE 16.04。我认为我有一些损坏的软件包,导致apt-get upgrade
返回以下错误:
Do you want to continue? [Y/n] y
(Reading database ... 386704 files and directories currently installed.)
Removing nvidia-prime (0.8.2) ...
/var/lib/dpkg/info/nvidia-prime.postrm: 79: /var/lib/dpkg/info/nvidia-prime.postrm: lsb_release: not found
dpkg: error processing package nvidia-prime (--remove):
subprocess installed post-removal script returned error exit status 127
Errors were encountered while processing:
nvidia-prime
E: Sub-process /usr/bin/dpkg returned an error code (1)
任何帮助,将不胜感激。
答案1
sudo apt-get upgrade
lsb-release 包未安装,因此在尝试访问它时会收到错误消息。
打开终端,将目录更改为cd
下载 lsb-release_9.20160110_all.deb 的目录,然后使用以下命令进行安装:
sudo apt install ./lsb-release_9.20160110_all.deb
创建一个新的 sources.list 文件。
sudo mkdir -p /etc/apt/
cd /etc/apt/
sudo touch sources.list
/etc/apt/sources.list
使用以下命令在 nano 文本编辑器中打开进行编辑:
sudo nano etc/apt/sources.list
将以下行添加到 sources.list。
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
使用 nano 编辑器的说明总是位于每页的底部。按键盘组合键Ctrl+ O,然后按Enter保存正在编辑的文件。按键盘组合键Ctrl+X退出 nano。
更新可用软件列表并修复损坏的软件包。
sudo apt update
sudo apt install lsb-release python3.5-minimal
sudo apt install python3 nvidia-prime
sudo reboot
如果sudo apt update
成功,尝试sudo apt upgrade
再次运行。
sudo apt upgrade