Unable to 'apt-get dist-upgrade' due to appstreamcli database error
I have created a USB stick with a persistent Ubuntu 16.04 (release version). I tried a couple of ways, using Startup Disk Creator and MultiSystem, but I get the same end result.
When I boot into the USB and do 'apt-get update', all is well. When I try 'apt-get dist-upgrade' I get:
** (appstreamcli:2761): CRITICAL **: Error while moving old database out of the way. AppStream cache update failed.
The only reference to this error message I can find is https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1561472 but would appear to be fixed, at least fixed by the time the release version of Ubuntu 16.04.
Aside: I want to test Unity8, which includes installing software. I don't have a spare computer, so I thought a persistent USB would do the trick.
Any takers?
This also happened to me using 16.04.1 live Ubuntu persistent USB stick.
uncledave's solution didn't work at first, but as suggested, changing the rights was the final solution.
Then I've found answer #11 from daniel-gimpelevich for bug 1601971
The following commands helped me repair apt-get update
sudo chmod -R a+rX,u+w /var/cache/app-info/xapian/default
How did I guess that 755 is the right mask? The difference between
ls -ld /var/cache/app-info/xapian
drwxr-xr-x 1 root root 4096 Nov 19 20:35 /var/cache/app-info/xapian/
and
ls -ld /var/cache/app-info/xapian/default
drw-r--r-- 2 root root 4096 Jul 19 20:54 /var/cache/app-info/xapian/default
After this apt-get update ran fine.
sudo apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Fetched 190 kB in 0s (312 kB/s)
Reading package lists... Done
Note1 Upgrading a live persistent USB stick this way is not suggested it will cause issues if too many packages are installed/upgraded.
Note2 It's a better idea to install Ubuntu directly to the USB stick if you want to use it as a bootable "Swiss Army Knife".
A google search led me to this link: on github
I've tried this command and it works for me:
chmod 777 /var/cache/app-info/xapian/default -R
On my persistent live USB with 16.04.1, Just typed
sudo -i
Then as root did
sudo apt-get update
And all was fine. Then
exit
And back to my original path ubuntu@ubuntu.