LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   [SOLVED] NetworkManager causing "unable to open display" errors (https://www.linuxquestions.org/questions/linux-wireless-networking-41/%5Bsolved%5D-networkmanager-causing-unable-to-open-display-errors-4175618492/)

archimandrite 11-27-2017 04:54 PM

[SOLVED] NetworkManager causing "unable to open display" errors
 
During my first Arch Linux installation, I encountered this fairly bizarre error, and a quick google search showed that I wasn't alone. However, none of the posts thrown up by google actually gave any concrete explanation of why this was happening - rather, just vague causes and some rather hack-like solutions. So just in case anyone's struggling with this at the moment, or will encounter it in the future, here's what I found to be the problem, and the solution.

- - The Problem - -

First, some context. I'm running Arch with a Plasma 5 desktop. My networking is being controlled by NetworkManager.service, using the plasma-nm panel applet, with my wi-fi being handled by wpa_supplicant. That all seemed to be running perfectly. However, any time the wi-fi was connected, I was unable to open any applications. They returned 'unable to open display' errors when executed from the konsole, and did nothing at all when executed from an icon in the GUI. As soon as I disconnected the wi-fi and stopped NetworkManager.service, the problem vanished, and I was able to open my programs once more.

- - The Cause - -

After many hours of googling and Konsole-ing, I have arrived at the following conclusion: When NetworkManager.service starts, it looks at the hostname of your system. If it considers your hostname "invalid", it simply assigns your system a new one which it considers more proper (a so-called "transient" hostname). The difference between the transient hostname assigned by NetworkManager and the static hostname specified in /etc/hosts and /etc/hostname is what causes the problem and prevents new windows from opening. There are four hostnames which NetworkManager considers invalid: 'localhost', 'localhost6', 'localhost.localdomain' and 'localhost6.localdomain'.

- - The Solution - -

Simply change the hostname of your system to something which is not considered invalid by NetworkManager. Run 'sudo hostnamectl set-hostname <yournamehere>' at the terminal to do this (substitute the hostname you wish to use for <yournamehere> in the command), then run 'sudo nano /etc/hosts' and change all the instances of the hostname in that file. Save it and close, then reboot. Once your system starts up again, you should be able to connect to the network and open applications at the same time! big_smile

Apologies if you knew all that already; here's hoping at least someone can benefit from my hours of frustration.

PS: The list of invalid hostnames is taken from https://developer.gnome.org/NetworkM...ager.conf.html


All times are GMT -5. The time now is 04:52 PM.