2

My problem started with this question: Failed to start Load Kernel Modules Ubuntu 16.04

Now I can boot but only log in on tty1. I am trying to get sudo apt-get update to work to try and fix all the other issues. The problem is, that I can not connect to the internet. ifconfig tells me that I have a connection, and sudo dhclient wlan0 and sudo dhclient eth0 now execute successfully, but pinging any host won't work via hostname (I always get a unknown host error). I can successfully ping 8.8.8.8 though.

service network-manager status shows active and running

ip route has a default route default via 192.168.1.1 dev eth0

How can I connect to the internet?

Fullk33
  • 201
  • 1
  • 2
  • 6
  • 1
    If `ip route` (See `man route;man ip-route`) does not show a `default` route, you will have to add it via something like (YMMV): `ip route add default via 192.168.1.1 dev eth0` – waltinator Aug 08 '16 at 22:43
  • checked `ip route`. It shows a default route though. `default via 192.168.1.1 dev eth0` – Fullk33 Aug 08 '16 at 22:47
  • 1
    Have you tried to ping by IP, or only by hostname? – steeldriver Aug 08 '16 at 22:55
  • I tried `ping google.com` – Fullk33 Aug 08 '16 at 22:57
  • 1
    Try `ping 8.8.8.8` - if that works, then it's most likely just a DNS issue – steeldriver Aug 08 '16 at 23:26
  • oh yes that worked! – Fullk33 Aug 08 '16 at 23:27
  • 1
    OK in that case try `echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf` which will (temporarily - until you reboot, or restart the resolvconf service) hardwire your system to use one of the google public DNS servers. Then try `ping google.com` again. If that works, try your `sudo apt-get update` once more. – steeldriver Aug 09 '16 at 01:17

1 Answers1

2

It looks like you are booting in single-user, networkless, failsafe level.

To fix your DNS issues, just:

echo "nameserver 8.8.8.8" > /etc/resolv.conf

Then at least from that session, you should be able to ping by hosts. Assuming 8.8.8.8 is ping-able (as you stated) and that it is one of google's free DNS servers.

This way, while you'd have DNS servers set up, it is not guaranteed that apt-get will work. As a fail-safe boot, partitions might have been mounted read-only or not mounted at all.

If you can't create/edit /etc/resolv.conf because the filesystem is mounted read-only, as being root you can fix that (assuming the filesystem can be mounted read-write -- i.e. not a hardware limitation) with:

mount -o remount,rw /

Then do the command again to set the nameserver. Assuming /etc is a directory under partition mounted in /, and no dedicated partition for /etc.

To add another DNS server (append) to the file:

echo "nameserver 8.8.4.4" >> /etc/resolv.conf
Avenger
  • 21
  • 2
  • by "pingable" I meant "reachable". i.e. if your ISP filters access to DNS services, you might want to use your ISP's provided DNS server address (or maybe your modem or router's IP address -- if cable, adsl, this may be the case!). They may block effective DNS access while still letting ICMP (ping) requests go! – Avenger Aug 09 '16 at 05:22
  • Ok thank you, I will try doing this as soon as I can. – Fullk33 Aug 09 '16 at 08:37