Bionic Beaver, 18.04.
A funny thing happened today. I have a system, working fine, booted up to the desktop - uptime about 80 days, lots of windows open on the desktop. Everything fine, until... GUI is running on tty1 (as expected).
In trying to debug another problem, I decide to switch away from the desktop GUI to a virtual console and login. So,I do "sudo chvt 2" and get to the login prompt on tty2. So far, so good. I log in as myself (on tty2), do a few things, then logout (via ^D) - expecting to get back to a login prompt, from which I can then switch back to my GUI desktop session.
However, next thing that happens is that I am presented with a pure purple screen, then about 10 seconds later, a GUI screen asking for my password. I log in and am presented with a clean, fresh desktop. All windows that had previously been there are gone (meaning, I have to figure out what was there before, and restart everything).
It looks like somehow, logging out of tty2, sent a Hangup signal to all the processes running on the GUI desktop, including the desktop itself, forcing you to log in again and restarts whatever had been running before.
Why does this happen?
Some additional information:
After the desktop re-start - and after I've run my scripts to open up my usual windows (programs) - I find that there are a maze of processes running on tty1, running as user "gdm", and also a maze of processed on tty3, running as user "me". All of these processes (on both tty1 and tty3) show as being started at the time of the desktop re-start. There is a single process (a getty) running on tty2.
There is a single file in /var/crash, timestamped at the time of the desktop re-start, that corresponds to one of my processes (i.e., something I had running in one of my terminal windows at the time of the crash). That file shows it to have been killed by signal 6 (SIGABRT). SIGABRT is usually caused by a program failing an assert(3).
tty1is the login screen and
tty2is the X GUI sesson. It looks like you just logged out of your Xorg sesson.
ttl3. If you are using a laptop you may have to add the [Fn] key into the mix.