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, 2017 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, 2017 at 9:36

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .