WSL icon indicating copy to clipboard operation
WSL copied to clipboard

apt-get update fails in Ubuntu 16.04

Open paladox opened this issue 10 years ago • 60 comments

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

paladox avatar Jul 10 '16 21:07 paladox

I don't believe Ubuntu 16.04 is supported by WSL right now.

alexanderwhatley avatar Jul 11 '16 00:07 alexanderwhatley

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 avatar Jul 11 '16 21:07 Manouchehri

@Manouchehri do you get Ubuntu 16.04 when you run lsb_release -a?

alexanderwhatley avatar Jul 11 '16 22:07 alexanderwhatley

@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?

benhillis avatar Jul 11 '16 22:07 benhillis

Alex: Yes, I'm definitely running 16.04.

Ben: I'll try that when I get home and let you know.

Manouchehri avatar Jul 11 '16 23:07 Manouchehri

@benhillis: Yep, that fixed it as expected. Thanks.

Manouchehri avatar Jul 12 '16 05:07 Manouchehri

@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

Manouchehri avatar Jul 12 '16 05:07 Manouchehri

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?

TaffyMadeThat avatar Jul 14 '16 07:07 TaffyMadeThat

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 avatar Jul 14 '16 12:07 AskeFC

@AskeFC hi, thanks that worked.

paladox avatar Jul 14 '16 13:07 paladox

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.

TaffyMadeThat avatar Jul 14 '16 17:07 TaffyMadeThat

@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 avatar Jul 14 '16 17:07 Manouchehri

@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:~$

electron0zero avatar Aug 05 '16 18:08 electron0zero

@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).

adamkruszewski avatar Aug 12 '16 21:08 adamkruszewski

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...

jonstanley avatar Sep 23 '16 03:09 jonstanley

@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

codex-corp avatar Oct 08 '16 22:10 codex-corp

@KubuntuUser and @Manouchehri hi, that fix is a temporarily one since a day or two after doing that the problem comes back.

paladox avatar Oct 09 '16 00:10 paladox

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.

therealkenc avatar Dec 18 '16 03:12 therealkenc

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.

ezzep avatar Dec 27 '16 06:12 ezzep

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.

pknsuthar avatar Feb 11 '17 09:02 pknsuthar