我不记得最近安装过任何东西,但是今天当我将笔记本电脑从待机状态取出时,我收到了以下通知:
用文字表示:(
An error occurred, please run Package Manager from the right-click menu or apt-get in a terminal to see what is wrong. The error message was: Error: Opening the cache (E:Couldn't create temporary file to work with /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu__dists__bionic__InRelease - mkstemp (2: No such file or directory), E:The package lists or status file could not be parsed or opened.)'. This usually means that your installed packages have unmet dependencies
附带问题:是否有可以从某处复制文本的日志文件?)
我不知道右键菜单是什么。当我点击首选项时,Software & Updates
会打开它,但我不确定在那里做什么。
运行apt-get check
显示
Reading package lists... Error! E: Couldn't create temporary file to work with /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_bionic_InRelease - mkstemp (2: No such file or directory) E: The package lists or status file could not be parsed or opened.
从那时起我就尝试过:https://sillycodes.com/quick-tip-couldnt-create-temporary-file/:
sudo apt-get clean sudo mv /var/lib/apt/lists /tmp sudo mkdir -p /var/lib/apt/lists/partial sudo apt-get clean sudo apt-get update
恢复为
sudo mv /tmp /var/lib/apt/lists
有多个存储库出现错误消息,例如:
W: GPG error: http://de.archive.ubuntu.com/ubuntu bionic-backports InRelease: Couldn't create temporary file /tmp/apt.conf.tiVq7R for passing config to apt-key E: The repository 'http://de.archive.ubuntu.com/ubuntu bionic-backports InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
答案1
我的 Ubuntu 18.04 也出现了同样的错误。然后我重启了两次,直到它不再启动。相反,启动 initramfs 启动了。
然后,我运行以下 3 个命令:
(initramfs) exit
...
(initramfs) fsck /dev/mapper/ubuntu–vg-root -y
...
(initramfs) reboot
...
PS:我猜想上次升级内核后发生了磁盘错误。这种情况最近已经发生过两三次了。
答案2
这次重新启动计算机解决了这个问题,但这Error: Opening the cache (E:Couldn't create a temporary file to work with /var/lib/apt/lists/)
表明备用笔记本电脑的硬盘驱动器上可能存在坏块问题。在这种情况下sudo badblocks -s /dev/sdX
X被磁盘应用程序中的设备字母替换,可能还会报告有坏块。要修复坏块,请从安装 Ubuntu 时使用的同一个 Ubuntu live USB/DVD 启动,然后运行fsck
以检查文件系统,并按照以下说明进行修复这个答案。
在执行实时检查之前,你可以使用 进行测试运行fsck
。将-N
选项传递给fsck
命令以执行测试: 来源
sudo fsck -N /dev/sdX
输出打印将要发生的情况,但不执行任何操作。