The officially official Devuan Forum!

You are not logged in.

#1 2022-08-25 18:53:22

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

[SOLVED] How to Navigate Back to a Previous XFCE Session?

(upfront: nothing directly to do with Devuan; everything to do with me being a prat)

Whilst working with JOSM under XFCE to make some small updates to the OSM map I hit a wrong combination of keys & found myself at a fresh text-session. I then could neither shut down that new session nor navigate back to the original xfce-session. My actual actions probably made it impossible to be able to revert to the GUI, but I wanted to know how to do that under Devuan with a XFCE session.

  • The key-combo needed: Shift-Alt-F1
    (switch off auto-download prior to examining a large boundary-area)

  • The key-combo actually used: Ctl-Alt-F1
    (start up & switch to TTY1)
    (use of w indicated that the new session was under TTY1 & the former xfce-session was on 0:0 (whatever that is))

I cannot now remember the precise order of steps that I took, but I did try exit and startx, plus a text-login, and eventually got to a new XFCE session & used FF to research (it all seemed to be Ubuntu fixes), but nothing worked & I eventually had to shutdown & crash/burn the original GUI. Chromium managed to recover all the tabs in the former session, so that was OK.

If I ever do something as dumb as this again, how do I recover back to the original session?

Edit: fixed key combos

Last edited by alexkemp (2022-08-28 03:21:51)

Offline

#2 2022-08-25 20:23:22

Gregors
Member
From: Freiburg, Germany
Registered: 2018-08-09
Posts: 21  
Website

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Try Alt-F7

Just an idea

Gregor

Last edited by Gregors (2022-08-25 20:23:42)

Offline

#3 2022-08-25 21:33:25

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Gregors wrote:

Try Alt-F7

Why? What does it do? Where is the link to the documentation that it sits within?

Thanks for trying, Gregors, but an unreferenced reply is worthless.

These are two sites I referenced from FF:

  1. Command line to return to the GUI after Ctrl-Alt-F1?

  2. How to switch between the X sessions by only-using the command line?

Offline

#4 2022-08-25 21:55:33

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Gregors wrote:

Try Alt-F7

Reproduced the problem, and Alt-F7 worked to get me back to the logged-in GUI session at the identical place. Thank you Gregors.

The following page documents XFCE4 sessions (the use of alt-f7 is there) (and also, why it may not work):

Offline

#5 2022-08-25 21:56:09

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 730  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

You can usually determine which virtual terminal Xorg is using by:

$  pgrep -a Xorg

and if that says, say, vt07 you may shift to that with ctrl-alt-f7.
Or, if you have a command line, the root command

# chvt 7

will do the same.

Further, there is normally a /dev/ttyN set up for every virtual terminal N. Thus, you may use

$ ls /dev/tty[0-9]* | wc -l

to see how many virtual terminals are available.
I think that is a compilation setting for the kernel.

See e.g. man openvt and friends, and man Xorg (look for "terminal").

Offline

#6 2022-08-26 09:41:45

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Many thanks, Ralph.

Ctl-Alt-F1 got me to a text-screen under vt07; all that was on the screen was a prompt to login. All it (appeared to) accept as input was a username, then password, although on later testing Alt-F7 did actually return me to the xfce4-session under vt07.

Trying w + pgrep just now from an ordinary terminal:

$ w
 10:14:06 up 1 day,  1:34,  1 user,  load average: 0.63, 0.64, 0.81
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
alexk    :0.0     :0.0             Thu08   ?xdm?   7:53m  1.02s xfce4-session
$ pgrep -a Xorg
1899 /usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth vt07

That result for w is exactly what I got during my dilemma after the text login for the abandoned session. It neatly explains why I could not understand which TTY the XFCE Session was running under.

Whether Alt-F7 would have got me back *after* login I do not yet know. I also do not understand why exit following login did not shut down vt01 & drop me back into the still-running vt07 session. I see from man Xorg that Xorg supplies the Ctl-Alt-Fn commands, but I also still do not know which program is supplying the Alt-Fn command. So many questions.

Edit: fixed key combos

Last edited by alexkemp (2022-08-28 03:26:15)

Offline

#7 2022-08-26 10:57:36

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,130  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

0:0 is the display you're running on. If you run more than one xserver at a time, they will get unique display numbers.
I don't know what programs supply any of this, but I learned this early in my linux adventures.

Create a second user.
Drop to console with ctrl-alt-F1 (or I guess crtl-shift-F1 on your keyboard)
Log in as the second user.
Run startx -- :1
You will now be in an xsession as the second user on vt08 and display :1.
ctrl-alt-F7 to go to the first xsession
ctrl-alt-F8 to get back to the second xsession
When you're done playing, close that second xsession, log out second user and go back to vt07.

Offline

#8 2022-08-26 17:23:17

delgado
Member
Registered: 2022-07-14
Posts: 26  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

@alexkemp
The vt's have nothing to do with X, they are steady. The underlying process is a getty.
e.g. you can switch from X to vt3 with Alt-Ctrl-F3, but from a vt to vt3 with Alt-F3 (with or without Ctrl).
Another point of view is to see a vt as text console and a X as graphical console.

$ ps ax | grep getty
 1781 tty1     Ss+    0:00 /sbin/getty --noclear 38400 tty1
 1782 tty2     Ss+    0:00 /sbin/getty 38400 tty2
(...)
 1786 tty6     Ss+    0:00 /sbin/getty 38400 tty6

"I also still do not know which program is supplying the Alt-F7 command."

Good question - never crossed my mind - vt's were present as far as I can think.

Offline

#9 2022-08-26 17:51:00

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Thank you delgado. That was the kind of info that I was searching for.

alexkemp wrote:

Whether Alt-F7 would have got me back *after* login I do not yet know.

I do now, and the answer is "yes".

These are the steps I just took:

  1. Close down all programs.

  2. Open JOSM

  3. Issue (wrong for JOSM) kbd command Ctrl-Alt-F1
    (screen switches to text-screen vt01, with a login prompt on screen)

  4. Login with my user/password

  5. Issue w & pgrep commands (see below)

  6. Issue Alt-F7 command
    (screen instantly switches back to JOSM screen)

For reference, here are the results of w & pgrep from inside TTY1:

$ w
 18:23:03 up 1 day,  9:43,  2 users,  load average: 0.22, 0.70, 0.87
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
alexk    tty1     -                18:19    5.00s  0.15s  0.01s w
alexk    :0.0     :0.0             Thu08   ?xdm?   9:43m  1.10s xfce4-session
$ pgrep -a Xorg
1899 /usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth vt07

Unless someone knows what supplies Alt-F7 I guess that we are done with this question now. Thank you to everyone that responded - most helpful.

Last edited by alexkemp (2022-08-26 17:53:39)

Offline

#10 2022-08-28 01:14:25

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Like a Bulldog (and also a rat), once I get my teeth into something I cannot stop biting until my teeth meet (ratchet mechanism on their jaws).

alexkemp wrote:

(upfront: nothing directly to do with Devuan)

Surprisingly, this topic has *everything* to do with SystemD (if only in reverse), since the virus has taken over from the kernel the process of producing Virtual Terminals (VTs), just like so much else.

In Devuan, the kernel produces a whole bunch of VTs on startup. The precise number will be a kernel setup item. For myself it seems to be 64 (see Ralph's answer), although there are also a few extra:

$ ls /dev/tty[0-9]* | wc -l
64
$ la /dev/tty*
crw-rw-rw- 1 root  tty     5,  0 Aug 25 08:40 /dev/tty
crw--w---- 1 root  tty     4,  0 Aug 25 08:40 /dev/tty0
crw------- 1 alexk tty     4,  1 Aug 26 18:23 /dev/tty1
crw--w---- 1 root  tty     4, 10 Aug 25 08:40 /dev/tty10
…
crw--w---- 1 root  tty     4,  9 Aug 25 08:40 /dev/tty9
crw-rw---- 1 root  dialout 4, 64 Aug 25 08:40 /dev/ttyS0
crw-rw---- 1 root  dialout 4, 65 Aug 25 08:40 /dev/ttyS1
crw-rw---- 1 root  dialout 4, 66 Aug 25 08:40 /dev/ttyS2
crw-rw---- 1 root  dialout 4, 67 Aug 25 08:40 /dev/ttyS3

We now need to consider delgado's answer, and it has taken me quite some time to get the point.

When the computer is first started, the screen that appears is a VT initiated (as best as I can tell) by agetty via init:

man agetty wrote:

DESCRIPTION
       agetty opens a tty port, prompts for a login name and invokes the /bin/login command.  It is normally invoked by init(8).

My system uses XFCE as a Desktop Manager and SLiM as a Login Manager. Therefore it is startxfce4 for me rather than startx, but the point is that an X-Session is launched which provides the GUI components in both cases, and that is comprehensively different to agetty, which is text-only.

With hindsight it is blooming obvious, but the VT produced by agetty has absolutely nothing to do with the terminal produced by xterm (or in my case, xfce-terminal) which is a GUI emulation of a text-terminal. For those that are interested in historical research, this is what it took to drive a text-terminal (aka typewriter) in the 1960s:

1960s terminals

The main difference is that a VT does NOT have a mouse, nor history support. It is possible, though damn difficult, to install them. It is, however, important to know which of the two (VT or GUI-Terminal) you are in, because the commands to switch between VT & GUI are different depending on whether you are based within a GUI or VT screen:

  • VT → VT : Ctrl + Alt + F7 or, Alt + F7  (switch to VT07, etc) (Ctrl key is optional)

  • VT → GUI : Ctrl + Alt + F7 or, Alt + F7  (switch to VT07, etc) (Ctrl key is optional)

  • GUI → VT : Ctrl + Alt + F7 (switch to VT07, etc) (all 3 keys required)

By default, most systems keep 6 text VTs available (at 1-6) and one GUI at '7', so the return in a default system is Ctrl-F7. However, this can be changed (just open another X-Session) and, worse, some distributions change the setup. Yikes! This page has good info on the command to change VTs, etc. (CHVT), and make a note that the TTY command gives a different result in Devuan to SystemD distros:

$ tty
/dev/pts/0

so make a note of the pgrep -a Xorg command that ralph gave.

It seems clear, then, that it is Xorg that handles 3-finger salutes to change from the GUI to a VT, but (perhaps) agetty that handles 2-finger salutes to switch out of the VT to another VT/GUI.

Offline

#11 2022-08-28 06:57:49

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 730  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Well, I favour the belief that it is the Linux kernel itself that handles both C-A-Fn and A-Fn unless something like Xorg intervenes and "steal" the A-Fn key combinations. For example, you can easily switch also to VTs without input handlers. Or try:

# sudo openvt -f -c 24 echo "HELLO THERE VT24"
# sudo chvt 24

Doing that leaves you hanging in VT24 without any keyboard listener, but you would use A-F7 or C-A-F7 to "return" to X.

Offline

#12 2022-08-28 09:04:55

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,528  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

alexkemp wrote:

make a note that the TTY command gives a different result in Devuan to SystemD distros:

$ tty
/dev/pts/0

Nope:

archie:~$ cat /proc/1/comm
systemd
archie:~$ tty
/dev/pts/0
archie:~$

^ That output is normal for any graphical terminal emulator regardless of the init system.

Offline

#13 2022-08-28 12:19:36

alexkemp
Member
Registered: 2018-05-14
Posts: 72  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Hi HoaS.

Head_on_a_Stick wrote:

^ That output is normal for any graphical terminal emulator regardless of the init system.

This OSTechNix page reports the following for an Ubuntu 18.04 LTS server:
tty command output under SystemD(in text: (user command) tty => /dev/tty1)

When I read that, I saw the words “Ubuntu 18.04 LTS” & overlooked the word server.

Sure ’nuff; in xfce4-terminal:

alexk@ng3:~$ tty
/dev/pts/0

In vt01:

alexk@ng3:~$ tty
/dev/tty1

Thanks for the correction.

Added later:
I now realise that other commands within the OSTechNix page also rely on being within a VT session. As one example, the page reports that:

OSTechNix wrote:

By default, there are 7 ttys in Linux. … The 1 to 6 ttys are command line only. The 7th tty is GUI (your X desktop session).

To view the total number of active virtual consoles, run: fgconsole
You can see the next unallocated virtual terminal using command: fgconsole --next-available

In xfce4-terminal:

$ fgconsole
Couldn't get a file descriptor referring to the console.

In vt01:

$ fgconsole
1
$ fgconsole --next-available
8

That confirms the simple statements within the OSTechNix page quoted at the top of this section. However, also necessary to realise that those simple statements are there to help give simple inroads to begin understanding some of the basics of this topic, whilst the topic itself is way more complex than that (as is indicated by the 64+ VTs created at init startup).

Further, lets offer a silent prayer of thanks up for the fact that Devuan has a simple sanity at it's heart, and that we are not forced to use an OS that has an eternal struggle for domination at it's heart. I spent 12 hours yesterday researching to try to discover which binaries handle the C‑A‑Fn + A‑Fn key combos. I'm a professional researcher with multiple decades experience, but could not find a definitive answer (it should not be a difficult question). What I *did* find was the way that multiple distros are beginning to make simple certainties no longer certain. An example:– The simple route back to a GUI from a VT is Alt‑F7, and that has been true within a default setup for decades. During my research I found many distros that have recently changed the default VT setup, with radical differences in the methods of return. And I'm sorry; I went through scores of websites and, because I was not looking for that precise issue, I did not record which they were.

Last edited by alexkemp (2022-08-28 14:00:39)

Offline

#14 2022-08-28 14:00:32

steve_v
Member
Registered: 2018-01-11
Posts: 137  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

alexkemp wrote:

a VT does NOT have a mouse

apt install gpm
alexkemp wrote:

nor history support

Used to have scrollback, removed recently (Grrr) because "nobody was using it" (which is bollocks).
Patches exist to restore this functionality, but Debian/Devuan does not include them.


alexkemp wrote:
$ tty/dev/pts/0

Psuedo-terminal virtual filesystem, used by GUI terminal emulators. Predates systemd by about a decade.


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#15 2022-08-28 15:01:27

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,528  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

steve_v wrote:

Patches exist to restore this functionality, but Debian/Devuan does not include them.

Both screen and tmux are available from the repositories big_smile

Offline

#16 2022-08-29 04:56:05

steve_v
Member
Registered: 2018-01-11
Posts: 137  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

Head_on_a_Stick wrote:

Both screen and tmux are available from the repositories big_smile

And unavailable early in the boot process, the initrd, or by default on many minimal installs.
Shift+pgup is both ingrained muscle-memory and a lot less annoying (IMO) than the likes of vi-style keybinds, and screen is gratuitous bloat when all you want is a fully functional VT.


Console scrollback has been around forever, and it's one of the very first things that made me go "wow, this is way better" when transitioning from DOS.
Frankly this "everyone just uses the GUI (or laptop/phablet/whatever trendy disposable junk is FotM) these days" rubbish is getting extremely annoying. I for one use real VTs on a real PC every day, and have since the late '90s.

Now I' guess I'm just waiting for GNU/Linux to remove VTs altogether, make touchscreens mandatory, and replace all kernel output with inane spinning widgets and emojis.
I'm sure all the windows refugees will just love it, since there'd be no need to learn to read and no keyboard to clean the drool out of.


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#17 2022-08-29 09:43:05

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,528  

Re: [SOLVED] How to Navigate Back to a Previous XFCE Session?

You can get scrollback in fbterm but it needs a dirty hack to work with a non-root user:

https://forums.debian.net/viewtopic.php … 63#p756463

Last edited by Head_on_a_Stick (2022-08-29 09:43:48)

Offline

Board footer