Networking doesn't start correctly when logging onto a console instead of GUI (MATE) in Ubuntu 18.04
I'm trying to repair a neighbour's laptop (I'll just call him "D") and came to the conclusion I really need to run an update. The difficulty is that the laptop won't boot to a normal GUI interface (D uses MATE), so I am restricted to using the console. My attempts at resolving the problem can be seen in this forum thread:
https://www.linuxquestions.org/quest...356/page2.html That brings me to the current problem. In order to run apt-get update and associated commands, I need to have a network connection. The information below is essentially from my last post on that other thread. To find out what the networking status on D's machine is, I ran ifconfig with the following result: Code:
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 Next I tried to find out what DNS settings were in use. From what I've read so far the command systemd-resolve --status should provide some information. The results were less than encouraging: Code:
Global In a first attempt I tried nmcli device status: Code:
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN So I tried nmcli device show to find out what the device IDs are (I've left out the WLAN stuff since that's not relevant. Besides... it isn't activated from what I can see in the results so far) : Code:
GENERAL.DEVICE: enp2s0 Code:
connection.id: Kabelgebundene Verbindung 1 Code:
IP4.DNS[1]: 192.168.1.1 If anybody can provide some advice on how I can fix the internet access using the console, I would be very grateful. |
The reason his network won't boot is probably that X isn't going, so NetworkManager doesn't start.
You could have a look in Xorg.0.log to find why X isn't running. Post the errors and weird stuff near the end, but don't post the lot. To set him up manually on wifi is doable, but is a major PITA. There's a rather long config line, unless your network is open. Post the output of Code:
iwconfig enp2s0 Code:
sudo cat /etc/resolv.conf Code:
route EDIT: If you want the really long line to manually connect, I'll dream one up for you. |
I don't know NM well and can't interpret the nmcli output. The only time I have used systemd-resolve I created a dent in my wall from banging my head against it, so I am not that clued in there either. However, there are simpler ways to check network connectivity.
You do have an IP address, which tells me that there is some connectivity. My first question is, what makes you think you have no internet access? What error message (if any) do you get from apt-get update? Sorry for this question, but is the laptop wired to a switch? What does ping report? ping router, ping your-DNS-server, ping 1.1.1.1 etc. What does your routing table look like? Run ip route to check. How about testing DNS with the commands nslookup, host and/or dig (not sure which of them is installed)? |
@business_kid:
The Xorg.0.log doesn't really look all that weird and there don't seem to be any obvious problems. That said, I'll have to have a closer look and filter out the rubbish. All that will take a bit of time, because I have to mount a USB drive, then copy the file to the USB drive, unmount it again, transfer to my machine.... you get the picture. Fact is that X isn't running (you got that right), but that is the initial problem as defined in the "Linux Desktop" forum post that I mentioned. The fact that X doesn't run is, IMO, a symptom and not a cause. It seems to be the snapd service that is causing the problem... maybe. Still, I would like to get networking running. WLAN is not really an option, because that doesn't really start up at all. It's the wlp3s0 connection. I left the WLAN (AKA wifi) stuff out of my previous post, but here is what nmcli device gives back about it: Code:
GENERAL.DEVICE: wlp3s0 The file resolv.conf just contains comments and the advice that the systemd.resolve --status gives details of the actual name servers. I posted the results of that command earlier in my original post on this forum. The route command gave the following: Code:
Kernel IP routing table @berndbausch: Most of the stuff you asked about is on that other post in the "Linux Desktop" forum. I should have thought of posting that here as well. Here's what I can tell you so far: Yes, the laptop is connected via a switch... but then so is mine and, when I work from home, so is my work laptop. All 3 run Ubuntu 18.04. Ping: I can ping the DNS on my local IPCop server, but I cannot ping anything on the internet like google or linuxquestions. When I try anything on the internet I get "name or service not found". That tells me fairly directly that domain names are not being resolved. running apt-get update gave the following: Code:
Ign:1 cdrom://Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021) wily InRelease running ip route gives: Code:
default via 192.168.1.1 dev enp2s0 proto dhcp metric 20100 As for the other commands you recommend, I'll give them a go tomorrow. I'm hoping I'll get a bit more time to work on this then. Thanks to both business_kid and bernbausch for their input. If anyone else can provide advice, all tips and hints are welcome. |
Getting the network card up is comparatively easy beside wifi. It needs it's module, & firmware both of which the kernel should have. Then you need to know what you're connecting to.
From your ifconfig output I can see that epn2s0 is the wifi and has an IP. Seeing as wifi nearly invariably connects via dhcp, it means that wifi has some connection. You can verify this with Code:
iwconfig epn2s0 Once you get some info on what you should be connecting the nic to, and how (fixed IP, DHCP, etc) we can handle that in all likelihood with a few commands. |
Your routing table looks good.
It looks like you have, indeed, a problem with DNS. Ubuntu 18.04 uses systemd to manage DNS, and as I alluded, I had a hard time getting it to work a few months back. It turns out that the PC's DNS server is either configured via DHCP, or by writing its IP address in /etc/systemd/resolved.conf. Here is my version of this file: Code:
[Resolve] That's all I can contribute in good faith. You should pursue your troubleshooting with the systemd-resolve command; you started already but need somebody to help you with the output. |
As berndbausch has pointed out, /etc/systemd/resolved.conf appears to be the canonical file. But as long as you're in the shell, you're going to have to populate it each time. I have Mint here, which is Ubuntu with a faster GUI, and the file looks like this
Code:
#DNS= Code:
# Generated by dhcpcd from wlan0.dhcp |
@busuness_kid
I'm not sure why you figure that enp2s0 is a wifi connection. The data above suggests to me that it is an ordinary ethernet connection. (I think that's why it's called "en<something>") The wireless connection is wlp3s0 ("wl" ==> wireless LAN, perhaps?). But to make sure, I tried the iwconfig command on both. iwconfig enp2s0: Code:
enp2s0 no wireless extensions. Code:
wlp3s0 IEEE 802.11 ESSID:off/any I could try editing /etc/resolv.conf after backing up the symlink, but I'm unsure what to do with it. According to the warning in the linked file, any content will be overwritten. Is there a command that I can use instead? Is there a reason not to put the necessary data into the file /etc/systemd/resolved.conf? I'm being a coward... OK... I did the backup of the symlink, made the modifications you suggested in a new file called /etc/resolv.conf, and rebooted. After switching to root and remounting / as a writable file system, I tried ping www-google.com and "hey presto", it worked! I then tried apt-get update and apt-get upgrade and both of those worked (despite getting all the warnings about multiple repository configs). Unfortunately, when I rebooted, I got the same problem as before... the boot process hangs on the splash screen. (sigh) That is what the other post (mentioned above) is all about, so I guess I'll try following up the problem there. @berndbausch I didn't try editing /etc/systemd/resolved.conf, because the hack suggested by business_kid worked. As you point out the most important entry is the DNS IP address. I'll check out the details in the man pages, and maybe I can avoid having to use that hack. Thanks to both of you for the advice. I will mark this as solved. |
Good to heart my bodge worked. The reasoning behind it was that the links were
etc/resolv.conf -->/run/systemd/resolve/stub-resolv.conf and that's a null file of 0 bytes. So to get that, NetworkManager has to run. Catch-22. Now that you ran X, /etc/resolv.conf is gone. Make a backup of it - you might need it. I would boot to console, regain your internet access, run 'sudo apt-get dist-upgrade'. Then find Xorg.0.log. My Mint has it in /var/log; the other possible location is ~/.local/share/xorg/ grab a copy on a usb disk, and post the output of Code:
cat Xorg.0.log |tail -n 30 EDIT: to save hassle, use this command Code:
cat > /etc/resolv.conf << eof |
Thanks business_kid. I understand the logic behind the networking "kludge" you suggested. I must remember to reverse it when I no longer need it. Still, it's good to know how to set up networking without the network manager.
I'm afraid my successes, however, were not as far reaching as you think. I did not get X running and when I try the normal boot (not switching plymouth off) the system hangs at the splash screen as before. Since this is not really a networking problem and I already have an open thread for the boot issue, I will continue with the earlier thread: https://www.linuxquestions.org/quest...356/page2.html You (and anyone else) are welcome to provide input there. I still do not know what is causing the boot sequence to simply "hang" at the splash screen. Thanks again for your help with the networking problem. |
Ok.
From my last post: Quote:
|
All times are GMT -5. The time now is 05:28 PM. |