Lightdm could not start after edit /etc/hostname

Hello. On my Leap LXDE installation after manually editing /etc/hostname from “my-hostname” to “my-hostname.domain” and rebooting pc, I got an error about ’ Invalid MIT-MAGIC-COOKIE-1 key with permission denied to DISPLAY “” ’ and lightdm won’t boot - black screen with blinking terminal cursor.
I can solve this problem by login as root and start lightdm manually and after next reboot the problem will solve, but it is not solve the problem in generally.

Hello and welcome here.

This is nice story telling, but please SHOW the facts.

Also, what do you try to achieve by changing /etc/hostname?

Also from

man 5 hostname

… it is recommended that it consists only of 7-bit ASCII lower-case characters and no spaces or dots, …

Thuis it should not contain a domain name, but a host name only.

And from the same man page:

You may use hostnamectl(1) to change the value of this file from the command line.

IMHO that implies better not to change it by an editor.

And last, when you want to change your hostname, better use YaST, because it knows what all to do to achieve that.

Unless you REALLY know what you are doing use YaST to configure system/network stuff.
YaST > System > Network Settings > Hostname/DNS

This is nice story telling, but please SHOW the facts.

Here is my log files:

/var/log/lightdm/lightdm.log


+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log
+0.00s] DEBUG: Starting Light Display Manager 1.22.0, UID=0 PID=1108
+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d
+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-suse-defaults.conf
+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d
+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d
+0.00s] DEBUG: Loading configuration from /etc/lightdm/lightdm.conf
+0.00s] DEBUG: Registered seat module local
+0.00s] DEBUG: Registered seat module xremote
+0.00s] DEBUG: Registered seat module unity
+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager
+0.03s] DEBUG: Monitoring logind for seats
+0.03s] DEBUG: New seat added from logind: seat0
+0.03s] DEBUG: Seat seat0: Loading properties from config section Seat:*
+0.03s] DEBUG: Seat seat0: Starting
+0.03s] DEBUG: Seat seat0: Creating greeter session
+0.38s] DEBUG: Seat seat0: Creating display server of type x
+0.39s] DEBUG: Using VT 7
+0.39s] DEBUG: Seat seat0: Starting local X display on VT 7
+0.39s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
+0.39s] DEBUG: XServer 0: Writing X server authority to /run/lightdm/root/:0
+0.39s] DEBUG: XServer 0: Launching X Server
+0.39s] DEBUG: Launching process 1120: /usr/bin/X :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
+0.39s] DEBUG: XServer 0: Waiting for ready signal from X server :0
+0.39s] DEBUG: Acquired bus name org.freedesktop.DisplayManager
+0.39s] DEBUG: Registering seat with bus path /org/freedesktop/DisplayManager/Seat0
+0.95s] DEBUG: Loading users from org.freedesktop.Accounts
+0.95s] DEBUG: User /org/freedesktop/Accounts/User1000 added
+4.80s] DEBUG: Got signal 10 from process 1120
+4.80s] DEBUG: XServer 0: Got signal from X server :0
+4.80s] DEBUG: XServer 0: Connecting to XServer :0
+4.81s] CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
+4.81s] DEBUG: Seat seat0: Display server ready, starting session authentication
+4.81s] DEBUG: Session pid=1319: Started with service 'lightdm-greeter', username 'lightdm'
+4.88s] DEBUG: Session pid=1319: Authentication complete with return value 0: Success
+4.88s] DEBUG: Seat seat0: Session authenticated, running command
+4.88s] DEBUG: Launching process 1322: /etc/X11/xdm/Xsetup
+5.32s] DEBUG: Process 1322 exited with return value 0
+5.32s] DEBUG: Seat seat0: Exit status of /etc/X11/xdm/Xsetup: 0
+5.32s] DEBUG: Session pid=1319: Running command /usr/sbin/lightdm-gtk-greeter
+5.32s] DEBUG: Creating shared data directory /var/lib/lightdm-data/lightdm
+5.32s] DEBUG: Session pid=1319: Logging to /var/log/lightdm/seat0-greeter.log
+5.41s] DEBUG: Activating VT 7
+5.41s] DEBUG: Activating login1 session 1
+5.42s] DEBUG: Seat seat0 changes active session to 1
+5.42s] DEBUG: Session 1 is already active
+6.11s] DEBUG: Greeter closed communication channel
+6.11s] DEBUG: Session pid=1319: Exited with return value 1
+6.11s] DEBUG: Seat seat0: Session stopped
+6.11s] DEBUG: Seat seat0: Stopping; failed to start a greeter
+6.11s] DEBUG: Seat seat0: Stopping
+6.11s] DEBUG: Seat seat0: Stopping display server
+6.11s] DEBUG: Sending signal 15 to process 1120
+6.12s] DEBUG: Seat seat0 changes active session to 
+6.15s] DEBUG: Process 1120 exited with return value 0
+6.15s] DEBUG: XServer 0: X server stopped
+6.15s] DEBUG: Releasing VT 7
+6.15s] DEBUG: XServer 0: Removing X server authority /run/lightdm/root/:0
+6.15s] DEBUG: Seat seat0: Display server stopped
+6.15s] DEBUG: Seat seat0: Stopped
+6.15s] DEBUG: Required seat has stopped
+6.15s] DEBUG: Stopping display manager
+6.15s] DEBUG: Display manager stopped
+6.15s] DEBUG: Stopping daemon
+6.15s] DEBUG: Exiting with return value 1

/var/log/lightdm/seat0-greeter.log

** Message: Starting lightdm-gtk-greeter 2.0.2 (%{b} %{d} %{Y}, %{H}:%{M})
** Message: [Configuration] Reading file: /etc/lightdm/lightdm-gtk-greeter.conf
Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect to: Connection refused
(lightdm-gtk-greeter:1335): Gtk-WARNING **: cannot open display: :0

/var/log/lightdm/x-0.log

(II) Server terminated successfully (0). Closing log file.

Also, what do you try to achieve by changing /etc/hostname?

I need that to run some software to my work :frowning:

Those logs is already something, but I guess we would like to see what the contents of /etc/hostname was and what you changed it into.

Also the quote above is not very explaining. I can not imagine that the software said something like: “please change /etc/hostsname into …”. There must be a reason behind that.

And again, when you want to change the hostname of the system, use YaST. It is too easy to make inconsistancies between the different places where several emanations of the hostname are stored.

Before:

cat /etc/hostname
desktop-test

After:

cat /etc/hostname
desktop-test.linux

If I change hostname by hostnamectl command everything is going OK. I just don’t understand why lightdm can’t start after editing /etc/hostname by hands.

Because hostnamectl does apparently more then just editing the file. There would not be much need to create a special tool if the only thing it would do is a simple edit. And it is the same reason we advice you to use YaST. There is a lot of hostname related files and structures (network related or not). Even in the kernel (/proc/sys/kernel/hostname). There must be some consistency between them.

Sorry, but you want to change /etc/hostname or /etc/hosts?

As you can see in post #7 he is definitely talking about /etc/hostname.

But there are connections between the two (and other files as mentioned above).

And we still do not know what the reason for the change is, but as the OP seems to have it solved to his satisfaction, it will probably stay unknown by us here what application wanted what for what reason.

I think you are right.
With hostnamectl I think that you change /etc/hostname and /etc/hosts (127.0.1.1 your old hostname), in the same time.
With “editor” /etc/hostname, after you change hostname I think you need to change “your old hostname” in /etc/hosts.
PS. Please, don’t shoot again, if I am wrong. :slight_smile:
PPS. I am trying to make a joke.

it will probably stay unknown by us here what application wanted what for what reason.

It is an old proprietary client-server useful software from our vendor.

Thanks everyone for help.