apt-get update fails in Ubuntu 16.04
Hi when trying
apt-get update
it fails with
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
** (appstreamcli:13571): CRITICAL **: Error while moving old database out of the way. AppStream cache update failed. Reading package lists... Done
I don't believe Ubuntu 16.04 is supported by WSL right now.
It's still working fine here.
ubuntu@DESKTOP-3RQO5S5:/mnt/c/Users/Dave/Desktop$ sudo apt-get update
sudo: unable to resolve host DESKTOP-3RQO5S5
Hit:1 mirror://mirrors.ubuntu.com/mirrors.txt xenial InRelease
Hit:2 mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates InRelease
Hit:3 mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports InRelease
Hit:4 mirror://mirrors.ubuntu.com/mirrors.txt xenial-security InRelease
Reading package lists... Done
ubuntu@DESKTOP-3RQO5S5:/mnt/c/Users/Dave/Desktop$ sudo apt-get upgrade
sudo: unable to resolve host DESKTOP-3RQO5S5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@Manouchehri do you get Ubuntu 16.04 when you run lsb_release -a?
@Manouchehri Unrelated, but if do "sudo rm /etc/hosts" and restart bash.exe does the sudo: unable to resolve host DESKTOP-3RQO5S5 error message go away?
Alex: Yes, I'm definitely running 16.04.
Ben: I'll try that when I get home and let you know.
@benhillis: Yep, that fixed it as expected. Thanks.
@alexanderwhatley:
ubuntu@DESKTOP-3RQO5S5:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04 LTS
Release: 16.04
Codename: xenial
ubuntu@DESKTOP-3RQO5S5:~$ uname -a
Linux DESKTOP-3RQO5S5 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux
I'm having the same issue, this is what my konsole displays:
kubuntu@kubuntu:~$ sudo apt-get install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
kubuntu@kubuntu:~$ sudo apt-get update
Ign:1 cdrom://Kubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1) xenial InRelease
Hit:2 cdrom://Kubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1) xenial Release
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Fetched 94.5 kB in 0s (155 kB/s)
** (appstreamcli:27258): CRITICAL **: Error while moving old database out of the way.
AppStream cache update failed.
Reading package lists... Done
Could someone offer any solution?
I did an "strace appstreamcli refresh-index" and saw a permission denied during rename of /var/cache/app-info/xapian/default. So I did "chmod 777 /var/cache/app-info/xapian/default -R" and that fixed it for me.
@AskeFC hi, thanks that worked.
For others who may come across this thread, you may get "You might need superuser permissions to perform this action." to which you can put "sudo" (spacebar) @AskeFC 's codes.
@AskeFC 777 permissions are a really bad idea. If you need to run several commands as root, just run sudo -i to get root.
@Manouchehri how did you got Ubuntu 16.04 ?, i got WSL with anniversary update. mine is 14.04, how do i upgrade to 16.04.
electron@DELL-PC:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
electron@DELL-PC:~$
@Manouchehri Unrelated, but if do "sudo rm /etc/hosts" and restart bash.exe does the sudo: unable to resolve host DESKTOP-3RQO5S5 error message go away?
I think it is better just to add DESKTOP-3RQO5S5 to the line that states: 127.0.0.1 localhost just make it look like: 127.0.0.1 localhost DESKTOP-3RQO5S5 It should make it work without loosing /etc/hosts (basically we are learning apps that DESKTOP03RQO5S5 is an alias for localhost).
chmod g+w /var/cache/app-info/xapian/default -R
... appears to be the safer fix for this issue, since in WSL you are already root...
@adamkruszewski
This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
127.0.0.1 localhost
127.0.1.1 DESKTOP-6VRROIO.localdomain DESKTOP-6VRROIO
@KubuntuUser and @Manouchehri hi, that fix is a temporarily one since a day or two after doing that the problem comes back.
Just wanted to ping this one because it definitely seems to be a "WSL thing". The chmod trick @jonstanley and others have posted works, but somewhere along the way the perms get messed again. It's a tough thing to generate a test case for because I have no idea right now what is causing /var/cache/app-info/xapian/default to get changed. Probably apt-get update or apt-get upgrade themselves, since there aren't any other likely candidates. My Ubuntu VM and my WSL system are always in sync from a package update perspective, and its not a problem on native; so something must be different on the WSL side of things.
Hey everyone, I had the same issue of the apt-get update failing. So I googled a bit. This was the second page that came up. The first one was http://askubuntu.com/questions/761592/unable-to-apt-get-dist-upgrade-on-a-persistent-ubuntu-16-04-usb Anyway, I followed their instructions. Working for now. We'll see if it screws up later.
Might want to give this a try.
sudo apt-get dselect-upgrade
be sure to check out the changes it will make before you commit. but was only way forward was to take a step back for me.