BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Starting GUI from text login

Sat May 08, 2021 1:13 pm

Hi, all.
I recently used raspi-config to tweak my Pi 4 (Buster) to boot to a text login prompt. I could then log in and start the GUI with 'startx'... but 'dm-tool lock' no longer worked (probably because lightdm wasn't running). (Using raspi-config to switch back to a GUI boot-up, dm-tool was happy again.)
How should I start the GUI from a text login?
Alas, my knowledge of how the RPi OS starts up is too feeble for me to be able to figure out what it does when it boots to the GUI that it doesn't do when booting to text followed by 'startx'. (I got as far as figuring out that Xorg has very different arguments in the 2 cases, but I don't know what runs Xorg.)
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

User avatar
B.Goode
Posts: 12085
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Starting GUI from text login

Sat May 08, 2021 1:29 pm

BMardle wrote:
Sat May 08, 2021 1:13 pm
Hi, all.
I recently used raspi-config to tweak my Pi 4 (Buster) to boot to a text login prompt. I could then log in and start the GUI with 'startx'... but 'dm-tool lock' no longer worked (probably because lightdm wasn't running). (Using raspi-config to switch back to a GUI boot-up, dm-tool was happy again.)
How should I start the GUI from a text login?
Alas, my knowledge of how the RPi OS starts up is too feeble for me to be able to figure out what it does when it boots to the GUI that it doesn't do when booting to text followed by 'startx'. (I got as far as figuring out that Xorg has very different arguments in the 2 cases, but I don't know what runs Xorg.)


"How should I start the GUI from a text login?"

Code: Select all

startlxde-pi

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Sat May 08, 2021 1:35 pm

B.Goode wrote:
Sat May 08, 2021 1:29 pm

Code: Select all

startlxde-pi
I tried that but it didn't get very far.
Regrettably, I can't remember what the error message was and I don't have my Pi with me.
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

drtechno
Posts: 243
Joined: Fri Apr 09, 2021 6:33 pm

Re: Starting GUI from text login

Sat May 08, 2021 3:14 pm

Normally:
To start GUI with current login:

Code: Select all

startx
To start gui without current user logged into the GUI:

Code: Select all

init 5






This branch of linux used rc.d method of runtime management. So, the raspi -config is executing the perl code:

Code: Select all

sudo update-rc.d -f gdm remove
To remove the Xwindows from runtime

and

Code: Select all

sudo update-rc.d gdm defaults
to restore it back to booting to Xwindows.


In the case where the runtime has been removed, you would start Xwindows by:

Code: Select all

gdm
To exit Xwindows :

Code: Select all

sudo /etc/init.d/gdm stop
This is true in all distributions that doesn't have the older system runtime config file (removed from Debian branch about 10 years ago):
/etc/inittab

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Sat May 08, 2021 4:31 pm

drtechno wrote:
Sat May 08, 2021 3:14 pm
In the case where the runtime has been removed, you would start Xwindows by:

Code: Select all

gdm
Thanks. I'll give that a go the next time I'm "at the console".
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Thu May 13, 2021 12:26 pm

drtechno wrote:
Sat May 08, 2021 3:14 pm
In the case where the runtime has been removed, you would start Xwindows by:

Code: Select all

gdm
To exit Xwindows :

Code: Select all

sudo /etc/init.d/gdm stop
This is true in all distributions that doesn't have the older system runtime config file (removed from Debian branch about 10 years ago):
/etc/inittab
My Pi4 doesn't have gdm in /etc/init.d or anywhere else, so that can't be the solution!
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

bls
Posts: 1475
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Starting GUI from text login

Thu May 13, 2021 1:21 pm

Correct. RasPiOS with desktop uses lightdm, not gdm. There's no gdm to be found in a vanilla, standard RasPiOS Desktop.
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Thu May 13, 2021 2:29 pm

B.Goode wrote:
Sat May 08, 2021 1:29 pm
"How should I start the GUI from a text login?"

Code: Select all

startlxde-pi
That gives "display not found:". If I export DISPLAY=:0.0 first, it gives "display not found: :0.0".
If I run startlxde-pi after startx, I get 2 copies of my startup programs -- I could fix that -- but dm-tool --lock says "Not running inside a display manager. XDG_SEAT_PATH not defined".
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Thu May 13, 2021 2:33 pm

bls wrote:
Thu May 13, 2021 1:21 pm
Correct. RasPiOS with desktop uses lightdm, not gdm. There's no gdm to be found in a vanilla, standard RasPiOS Desktop.
So... how do I start X? If I do 'sudo lightdm' it starts X but I don't have a taskbar. (It does start my programs, and dm-tool does work.)
(If I knew how to start whatever produces the taskbar, I might be able to start that explicitly... though I find that works for some programs but not others. E.G., xterm doesn't.)
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

User avatar
jojopi
Posts: 3474
Joined: Tue Oct 11, 2011 8:38 pm

Re: Starting GUI from text login

Thu May 13, 2021 3:21 pm

BMardle wrote:
Sat May 08, 2021 1:13 pm
I could then log in and start the GUI with 'startx'... but 'dm-tool lock' no longer worked.
So originally you just needed a way to lock the screen independently of lightdm? xscreensaver or slock from suckless-tools.

By the way, screen locking does not prevent switching consoles (Ctrl+Alt+Fn). So dm-tool lock may already have been ineffective unless you made sure there were never any other console or graphical sessions active.

(sudo) service lightdm start/stop
(sudo) systemctl start/stop lightdm

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Thu May 13, 2021 3:42 pm

jojopi wrote:
Thu May 13, 2021 3:21 pm
BMardle wrote:
Sat May 08, 2021 1:13 pm
I could then log in and start the GUI with 'startx'... but 'dm-tool lock' no longer worked.
So originally you just needed a way to lock the screen independently of lightdm? xscreensaver or slock from suckless-tools.

By the way, screen locking does not prevent switching consoles (Ctrl+Alt+Fn). So dm-tool lock may already have been ineffective unless you made sure there were never any other console or graphical sessions active.

(sudo) service lightdm start/stop
(sudo) systemctl start/stop lightdm
Thanks, jojopi. startx with slock does the trick.
Since I've got my Pi4 set to require users to log in, other consoles aren't a problem unless I leave 1 logged in.
(I can't remember what I use to lock the screen on my old Pi*; it isn't dm-tool.)
Last edited by BMardle on Thu May 13, 2021 4:14 pm, edited 1 time in total.
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

klricks
Posts: 7779
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Starting GUI from text login

Thu May 13, 2021 4:08 pm

BMardle wrote:
Thu May 13, 2021 3:42 pm
.....
(I can't remember what I use to lock the screen on my old Pi*; it isn't dm-lock.)
It is:

Code: Select all

dm-tool lock
FYI - I made a desktop icon with this:

Code: Select all

[Desktop Entry]
Comment=Lock Screen
Terminal=false
Name=Lock Screen
Exec=dm-tool lock
Type=Application
Icon=gnome-lockscreen.png
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Thu May 13, 2021 4:16 pm

klricks wrote:
Thu May 13, 2021 4:08 pm
BMardle wrote:
Thu May 13, 2021 3:42 pm
.....
(I can't remember what I use to lock the screen on my old Pi*; it isn't dm-lock.)
It is:

Code: Select all

dm-tool lock
Sorry, "dm-lock" was a typo (which I've now fixed).
dm-tool isn't how I used to lock my screen and (as it says in the 1st message in this thread) it doesn't work if I start X with startx.
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

User avatar
DougieLawson
Posts: 41309
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Starting GUI from text login

Fri May 14, 2021 10:25 am

drtechno wrote:
Fri May 14, 2021 12:46 am
bls wrote:
Thu May 13, 2021 1:21 pm
Correct. RasPiOS with desktop uses lightdm, not gdm. There's no gdm to be found in a vanilla, standard RasPiOS Desktop.
Oh well, that is why its a junk os
That was a compromise when Raspberries had 256MB of RAM and the Raspberry folks were creating their modified version of DebIan.
Gnome and all of its constituent parts are a memory hog.

It's not junk. Then again, it's not the choice you'd make now if you were creating a modified version of DebIan for an 8GB system. It's highly likely they wouldn't choose plain old DebIan if they were building the system today.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
thagrol
Posts: 4980
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Starting GUI from text login

Fri May 14, 2021 11:05 am

drtechno wrote:
Sat May 08, 2021 3:14 pm
This branch of linux used rc.d method of runtime management. So, the raspi -config is executing the perl code:
Nope. RPiOS uses systemd as does Debian.

Code: Select all

sudo update-rc.d -f gdm remove
To remove the Xwindows from runtime

and

Code: Select all

sudo update-rc.d gdm defaults
to restore it back to booting to Xwindows.
Nope. systemctl set-default multi-user.target to disable and systemctl set-default graphical.target to enable.
In the case where the runtime has been removed, you would start Xwindows by:

Code: Select all

gdm
To exit Xwindows :

Code: Select all

sudo /etc/init.d/gdm stop
This is true in all distributions that doesn't have the older system runtime config file (removed from Debian branch about 10 years ago):
/etc/inittab
Again, nope.

I've no idea where you're getting your information from but it clearly doesn't apply to RPiOS. Same applies to some of the other threads you've posted in.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
thagrol
Posts: 4980
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Starting GUI from text login

Fri May 14, 2021 11:23 am

DougieLawson wrote:
Fri May 14, 2021 10:25 am
drtechno wrote:
Fri May 14, 2021 12:46 am
bls wrote:
Thu May 13, 2021 1:21 pm
Correct. RasPiOS with desktop uses lightdm, not gdm. There's no gdm to be found in a vanilla, standard RasPiOS Desktop.
Oh well, that is why its a junk os
That was a compromise when Raspberries had 256MB of RAM and the Raspberry folks were creating their modified version of DebIan.
Gnome and all of its constituent parts are a memory hog.
IIRC that was in the days of Raspbian. It was a third party OS back then not one from RPF/RPT.
It's not junk. Then again, it's not the choice you'd make now if you were creating a modified version of DebIan for an 8GB system. It's highly likely they wouldn't choose plain old DebIan if they were building the system today.
Just because the 4B now comes with an 8GB model you can't assume that everyone is using one. There are a lot of 512MB zeros out there.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
DougieLawson
Posts: 41309
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Starting GUI from text login

Fri May 14, 2021 11:34 am

thagrol wrote:
Fri May 14, 2021 11:23 am
Just because the 4B now comes with an 8GB model you can't assume that everyone is using one. There are a lot of 512MB zeros out there.
Exactly and Gnome is still a memory hog.

None of my RPis has more than 1GB. None of them have less than 512MB.

One day I may get round to buying a RPi4B.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Fri May 14, 2021 1:48 pm

I'm happy with jojopi's solution (for now!) but, in case anyone's interested, when I run raspi-config from an X 'terminal', it prints
Created symlink /etc/systemd/system/default.target ->/lib/systemd/system/multi-user.target
or
Created symlink /etc/systemd/system/default.target ->/lib/systemd/system/graphical.target
depending on whether I'm switching it to text login prompt or graphical login prompt.
(I think that ties in with what thagrol said.)
Unfortunately, I've no idea what processes those files or what their contents mean!
I suppose I ought to RTFM!
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

drtechno
Posts: 243
Joined: Fri Apr 09, 2021 6:33 pm

Re: Starting GUI from text login

Fri May 14, 2021 2:30 pm

DougieLawson wrote:
Fri May 14, 2021 11:34 am
thagrol wrote:
Fri May 14, 2021 11:23 am
Just because the 4B now comes with an 8GB model you can't assume that everyone is using one. There are a lot of 512MB zeros out there.
Exactly and Gnome is still a memory hog.

None of my RPis has more than 1GB. None of them have less than 512MB.

One day I may get round to buying a RPi4B.
It still doesn't really excuse the os, since "startx" is a link created at installation when it writes the /usr/share/x11/xorg.conf.d file. I bet there is a lot of system paths and default symbol links not present that are normally there.

drtechno
Posts: 243
Joined: Fri Apr 09, 2021 6:33 pm

Re: Starting GUI from text login

Fri May 14, 2021 2:33 pm

BMardle wrote:
Fri May 14, 2021 1:48 pm
I'm happy with jojopi's solution (for now!) but, in case anyone's interested, when I run raspi-config from an X 'terminal', it prints
Created symlink /etc/systemd/system/default.target ->/lib/systemd/system/multi-user.target
or
Created symlink /etc/systemd/system/default.target ->/lib/systemd/system/graphical.target
depending on whether I'm switching it to text login prompt or graphical login prompt.
(I think that ties in with what thagrol said.)
Unfortunately, I've no idea what processes those files or what their contents mean!
I suppose I ought to RTFM!
Its an interesting solution for a system that doesn't have grub installed. Which is normally used to switch booting modes and system kernel environments. But if the system is already booted, switching to a full terminal screen is just ctrl-alt-f2 through ctrl-alt-f8, but there will be a couple of tty terminal environments usually reserved, like tty1 (ctr-alt-1) is text print out of system boot up and shutdown, X11 can be assigned to any of the others during its install (depends on distribution weather or not they assign this automatically or you choose it during its installation), and usually tty8 (ctr-alt-8) is system error messages. and you can switch between all of these while X11 is running.

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Fri May 14, 2021 3:01 pm

drtechno wrote:
Fri May 14, 2021 2:33 pm
But if the system is already booted, switching to a full terminal screen is just ctrl-alt-f2 through ctrl-alt-f8, but there will be a couple of tty terminal environments usually reserved, like tty1 (ctr-alt-1) is text print out of system boot up and shutdown, X11 can be assigned to any of the others during its install (depends on distribution weather or not they assign this automatically or you choose it during its installation), and usually tty8 (ctr-alt-8) is system error messages. and you can switch between all of these while X11 is running.
I think I wanted to run something without X running at all, though I can't remember why! (I think my brain ran out of room for new computer information circa 2000 :roll: A little bit of room becomes available when something is deleted!)
PS: I'm currently reading the manpage for systemd. Let's see how long before I forget it all :)
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

BMardle
Posts: 181
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Starting GUI from text login

Fri May 14, 2021 4:42 pm

After skimming manpages for systemd and friends, I think the following, executed from a text login, has the same effect as a graphical login:
sudo systemctl start display-manager.service
I don't know if there's a way of 'undoing' that.
sudo systemctl stop display-manager.service
would seem logical, but it takes the Pi to a screen blank except for a text cursor and stays there.
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

User avatar
kerry_s
Posts: 2103
Joined: Thu Jan 30, 2020 7:14 pm

Re: Starting GUI from text login

Fri May 14, 2021 4:50 pm

there shouldn't be nothing you can do in cli that you can't do in gui.
if you want the full cli you can always just ctrl+alt+f# to switch to a tty.

User avatar
thagrol
Posts: 4980
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Starting GUI from text login

Fri May 14, 2021 5:22 pm

drtechno wrote:
Fri May 14, 2021 2:30 pm
It still doesn't really excuse the os, since "startx" is a link created at installation when it writes the /usr/share/x11/xorg.conf.d file. I bet there is a lot of system paths and default symbol links not present that are normally there.
Nope. At least not on my Pi (RPiOS Buster):
ls.jpg
ls.jpg (38.69 KiB) Viewed 721 times
I'm guessing you're not using Raspberry Pi OS (or possibly anything Debian based).

Please stop posting incorrect information and advice. I tjust confuses folks and creates a mess others end up having to clean up.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
jojopi
Posts: 3474
Joined: Tue Oct 11, 2011 8:38 pm

Re: Starting GUI from text login

Fri May 14, 2021 5:54 pm

BMardle wrote:
Fri May 14, 2021 4:42 pm
sudo systemctl stop display-manager.service
would seem logical, but it takes the Pi to a screen blank except for a text cursor and stays there.
Starting a display manager has the side effect of moving you to its new virtual console. When you stop it, there is no reason for the system to try to guess which console you might want to go back to; just press Ctrl+Alt+Fn. It is probably better practice to make sure you are logged into a text console, and stop the dm from there, anyway.

Assuming that display-manager.service is a symlink to lightdm.service, your commands are identical to the shorter versions I gave earlier.

Return to “Advanced users”