I don't remember installing anything recently but when I pulled my laptop out of standby today I got the following notification:
In words:
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
(Side question: Is there a log file somewhere to copy the text from?)
I don't know what the right-click menu is. When I click on preferences, Software & Updates
opens up, but I'm unsure what to do there.
running apt-get check
diplays
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.
I have since tried: per 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
reverted with
sudo mv /tmp /var/lib/apt/lists
There were error messages for several repositories, examplary:
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.
This same error happened with my Ubuntu 18.04. Then I reboot twice until it didn't start more. Instead, the boot initramfs started.
Then, I run the 3 commands:
PS.: I guess that had occurred any disk error after the last upgrade kernel. This already occurred in recent past two or three times.
Rebooting the computer solved the problem this time, however the
Error: Opening the cache (E:Couldn't create a temporary file to work with /var/lib/apt/lists/)
indicates that there may be an underlying problem with bad blocks on your standby laptop's hard drive. In that casesudo badblocks -s /dev/sdX
where X is replaced by Device's letter in the Disks application will probably also report that there are bad blocks. To fix bad blocks boot from the same Ubuntu live USB/DVD that you used to install Ubuntu and runfsck
to check and optionally repair the filesystem by following the instructions in this answer.Before performing a live check, you can do a test run with
fsck
. Pass the-N
option to thefsck
command to perform a test: sourceThe output prints what would happen, but does not perform any actions.