I'm trying to get Samba from apt on my Ubuntu Server 17.04 machine. When running sudo apt install samba I get the error "E: Unable to locate package samba".

I've tried sudo apt-get update but that won't work either, I get the error: Could not resolve 'se.archive.ubuntu.com'. The server doesn't seem to connect to security.ubuntu.com either.

By searching online I've found multiple threads about this and I've followed them up by adding the domains to my /etc/hosts file and checking my DNS settings, which are set to Google's and servers.

  • If your internet connection is otherwise working, try switching from local to main mirror – Zanna Jun 3 '17 at 9:28
  • Thanks, unfortunately it can't connect to the main mirror either. The server does have a working internet connection. – Axel Jun 3 '17 at 9:36

I finally solved it by following Helder's fix here: https://www.turnkeylinux.org/forum/support/20090724/fix-apt-get-could-not-resolve-archiveubuntucom

That is, change the order of the options for line 'host' in '/etc/nsswitch.conf'. Move 'dns' to the beginning of the row.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.