When I login on my laptop, without /etc/hostname, kdm will change the hostname it uses. xauth list :0 output different hostname, from localhost/unix to localhost.localdomain/unix. This causes all GUI library to "can not open display :0" some time after logged in. I've fixed it on my system by create my own /etc/hostname, but this is an abnormal behavior of KDM. It waste me several days to log out and log int to get out of this error. Please fix it. Reproducible: Always Steps to Reproduce: No /etc/hostname Sometime after logged in Actual Results: hostname changed before and after this issue
KDM is unmaintained and not used in KDE Plasma 5. SDDM is the login manager used in KDE Plasma 5. If you still have this same issue with SDDM, please file an issue on the SDDM bugtracker (after doing a search for existing issues first!): https://github.com/sddm/sddm/issues/