[SOLVED] Turning off GUI - the method that worked and the 3 that didn't
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Turning off GUI - the method that worked and the 3 that didn't
I'm going through the Introduction to Linux course on edx as it seems just right for my level of dummy. When I got the Lab exercise of turning the GUI off and back on a few things didn't go as the course suggested. I did get it to work and am fairly certain most of the issues will become apparent as I learn more. One, however, is bugging me and I'd really like to know why it is the way it is. The course offers the following ways to turn off the GUI:
student:/tmp> sudo systemctl stop gdm
student:/tmp> sudo systemctl stop lightdm
student:/tmp> sudo telinit 3
student:/tmp> sudo service gdm stop
Of those, only the telinit one works, the gdm just return the prompt and nothing happens, lightdm, apparently, isn't loaded. When starting it back up, all work except the lightdm one(which cannot be found).
And, finally, the question: why do the gdm version work to start it up but not to turn it off?
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Hi EvaJane,
Welcome to LQ.
From what I can determine, your student documentation is offering you several different possible solutions, but whether or not a given method functions depends on what you have installed (as a Display Manager, for example).
The 1st 2 commands tell the system to stop the display manager service : the first one is valid if you are using Light Display Manager (lightdm), the 2nd one for Gnome Display Manager (gdm). In both cases, it is assumed that the version of linux you are using is running systemd to control services.
The 3rd command is a generic linux command that tells the system to immediately switch to what is called "runlevel" 3 (essentially, a multi-user console session with networking enabled (switching back would be runlevel 5).
The 4th command seems to be to stop Gnome Display Manager other than with the usual systemctl command. I am guessing this is for version of linux that use something other than systemd to manage services.
Hope this helps - please get back to us for any more info.
Wow, that was fast. Greatly appreciate it.
I don't quite understand why neither
sudo systemctl stop gdm
nor
sudo service gdm stop
work when trying to turn it off but both
sudo systemctl start gdm
and
sudo service gdm start
work to turn it back on. It seems a bit odd that the only way to turn it off is telinit...isn't it?
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Hi again EvaJane,
I'm going to hazard a guess here, so please validate on your own.
To begin with, I just did a little test ... I use Arch / Gnome with the LXDM Display manager. I shut down LXDM with :
Code:
sudo systemctl stop lxdm
... it shut down all right ... But the result wasn't very useful. I was brought back to the point during the boot sequence where systemd started lxdm ... I basically had to reboot. I *may* have been able to flip to a different console and start lxdm manually from there - didn't try. Irrespective of that, it is not something I would choose to do again.
I believe that since I have set up my system with the display manager systemd service enabled so it starts automatically at boot, if I stop it as mentioned above, the result will be to bring me back to where the service was started, before login.
If you start your DM manually after already having logged in (somewhat redundant), you will probably be brought back to the command prompt where this command was executed.
In your case, you should check whether gdm is enabled as a service or started manually. Unlike lxdm for me, perhaps gdm prevents users from doing to themselves what I did to myself ...
Again .. this is all speculation.
That said, another way to go to a console while you have a GUI session running is simply to switch consoles (CTRL-ALT-F2 through at least F6) ... You can toggle back and forth (returning to your GUI session is CTRL-ALT-F1).
Oh, wow, OK. I had to read it three times before I understood but, yes, that does make sense. Assuming I did the check right, gdm is enabled as service and most likely preventing me from doing something bad to it. Once it's off though, it has no problem letting me start it up again. That is so cool.
Also. Oh, wow, I'd read about the, erh, they called them Virtual Terminals but didn't quite get what they were and was too chicken to check(why does the same thing have so many names -.-). Figured I was bound to get it eventually. Now I do. Thank you so very much, you have been more than helpful!
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Quote:
Originally Posted by EvaJane
Oh, wow, OK. I had to read it three times before I understood but, yes, that does make sense. Assuming I did the check right, gdm is enabled as service and most likely preventing me from doing something bad to it. Once it's off though, it has no problem letting me start it up again. That is so cool.
Also. Oh, wow, I'd read about the, erh, they called them Virtual Terminals but didn't quite get what they were and was too chicken to check(why does the same thing have so many names -.-). Figured I was bound to get it eventually. Now I do. Thank you so very much, you have been more than helpful!
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,479
Rep:
Learning the basics of the Linux system is quite hard, but well worth the effort, glad to see you doing it.
I don't want to preempt your tutorial, but ctrl+alt+F1 is not the usual way to switch back to your GUI from a VT, more likely to be ctrl+alt+F7 - this is because most Linux set up six VTs when they boot up, each accessed by using ctrl+alt+F1~6, & the GUI uses the seventh.
(There can be twelve VTs in a normal Linux set up, but six is the normal.)
Another useful thing to know as a beginner is, ctrl+alt+backspace will exit the GUI, then running startx at the command line will start it back up.
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Quote:
Originally Posted by fatmac
Learning the basics of the Linux system is quite hard, but well worth the effort, glad to see you doing it.
I don't want to preempt your tutorial, but ctrl+alt+F1 is not the usual way to switch back to your GUI from a VT, more likely to be ctrl+alt+F7 - this is because most Linux set up six VTs when they boot up, each accessed by using ctrl+alt+F1~6, & the GUI uses the seventh.
(There can be twelve VTs in a normal Linux set up, but six is the normal.)
Another useful thing to know as a beginner is, ctrl+alt+backspace will exit the GUI, then running startx at the command line will start it back up.
Hey fatmac - thanks for the CTRL-ALT-BACKSPACE tip ... never used that before ...
As to the F-key that brings you back to GUI, I think it must be distro-dependant or DE-dependant. I have used some for which it is F7, as you state, however all of my systems on Arch / LXDE use F1 ...
As to the F-key that brings you back to GUI, I think it must be distro-dependant or DE-dependant. I have used some for which it is F7, as you state, however all of my systems on Arch / LXDE use F1 ...
It absolutely is distro-dependent. Virtually all distros used to use 7 for the GUI. Systemd devs tried to change it to 1, but some distros resisted, and remain on 7, keeping the traditional 1-6 free for shell logins. Systemd (via logind) did manage to change the behavior of startx, which regardless of having been executed on 1, 2, 3, 4, 5 or 6, used to open X on 7, or higher when 7 is occupied by a login manager or open X session. Now it opens on the same on which started.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.