Linux отключить графический режим

How to disable GUI in Ubuntu

Say if I wanted to replicate Ubuntu Server and have no GUI running what would I do to make this happen? Upon running htop/top from tty session I see both gnome and xorg are still running and sucking up quite a substantial amount of memory (I’m using VirtualBox and have 1024MB allocated to Ubuntu). I would preferably want the ability to disable/stop gnome and Xorg whenever I wish in order to free resources. I don’t see any point in switching to tty from Xorg and keeping the processes running. I would however like to have the ability to re-enable/start the necessary files upon leaving tty. I do not want things to be permanently disabled although having this option would be useful/ Any help? Thanks

An option for you is to install Ubuntu server which doesn’t have GUI at all. unless you have another reason to use the desktop ubuntu as a server. (e.g desktop version has more tools installed by default , like g++ ).

@ParsaMousavi that’s exactly what I did after asking my question. I still want to get the most out of Ubuntu Desktop without the GUI though as I’m trying to familiarize myself with using a Linux distro without needing to use the GUI

3 Answers 3

You can use systemctl to «isolate» targets, which is to some extend similar to switching runlevels. The targets of interest here are

Confusingly, graphical.target is the default target in both Ubuntu desktop and server, but since there is no display manager installed in server it’s essentially the same as multi-user.target .

Switch while Ubuntu is running

Switch to «text mode» (you can simply run this in e.g. gnome-terminal ):

sudo systemctl isolate multi-user.target 

Switch to «graphical mode»:

sudo systemctl isolate graphical.target 

Set boot target

You can set the default target that is reached after boot (persists across reboot), e.g.:

sudo systemctl set-default multi-user.target 

You can also set a target with the kernel parameter systemd.unit , e.g.

systemd.unit=multi-user.target 

The kernel parameter has precedence over the default target.

Читайте также:  Linux hdd read only

This can be used to boot to a specific target once by editing the grub boot entry before boot. Or you could add multiple boot entries for different targets.

This answer seems to work. However when I type in the command for switching to text mode I have to manually switch to a tty session using CTRL+ALT+F*. If I don’t I’m just left with a blinking cursor and no text. Is there a way to do this while referring to exactly what session I want?

@customcup which Ubuntu version do you use? In my 18.04 virtualbox VM, I get a login screen on tty1 after isolating multi-user.target. Did you run it in a tty or in a terminal emulator inside gnome?

You can use systemctl(the systemd system and service manager) to control your display manager. In the case of Ubuntu, this is GDM — Gnome Display Manager, SDDM and LightDM are other common display managers.

To check the status from the command line:

sudo systemctl status gdm 

To disable (prevent loading at system startup):

sudo systemctl disable gdm 

To enable (loading at system startup):

sudo systemctl enable gdm 

The answer by @NGRhodes that advises systemctl stop gdm is the most relevant and should be the correct answer, it directly answers the question and eliminates memory load when you look at Htop. Desktop Environment in that sense becomes nothing but a file and a configuration, but no load, which should be the approach for a casual server user.

Another way of achieving this is to edit the line beginning with the linux command on your grub entry and add the number 3 at the end to boot in runlevel 3 which won’t start x-server at all by default.

It should look something like this :

 linux /boot/vmlinuz-5.3.0-46-generic root=UUID=SOME_UUID ro quiet splash 3 

This has the same result as others have pointed out , but you can change it even before the system boots up.

In the grub menu press the e button on the ubuntu menu entry and after putting 3 at the end of the line , just press Ctrl+x to boot. Note that this won’t save this config for you. If you want to save it , you must edit the file /boot/grub/grub.cfg . (And this is the scenario if you cannot get the grub menu at boot screen , because for example grub’s timeout was set to zero. )

Читайте также:  Arch linux add user

And another option for you is to install Ubuntu server which doesn’t have GUI at all. unless you have a reason to stick with the desktop version. (e.g desktop version has more tools installed by default , like g++ ).

Источник

How to disable and enable GUI of debian 10

Hello I want to disable my GUI and enable it again (debian 10 buster) for testing purposes is it possible?

you are talking about the desktop manager then . which one are you using? . also, be aware that you asked a simple yes/no question that has a yes answer . is that really all you want to know?

@JohnLloydGementiza , In UNIX(contains GNU\linux OS), you have more than 10 GUI, So you need to tell your desktop manager. If you have GDM , you can use systemctl disable gdm3 , for sddm , use systemctl disable sddm .

2 Answers 2

sudo systemctl set-default multi-user.target sudo reboot 
sudo systemctl set-default graphical.target sudo reboot 

You have 3 layers for each GUI in UNIX:

  1. X :
    It’s low level application for using GUI, it supports keyboard, video card and so on. many years ago, XFree86 was used in linux, Then replaced with X.org application, now you have wayland .
  2. Window Manager :
    each «Desktop Environment» uses itself Window Manager. Window Manager allow you to switch between windows, create title, close, minimize and some possibilities for your Desktop Environnment, Gnome Desktop Environment uses metacity Window Manager, for list of Window Managers, you can visit Window Managers.
  3. Desktop Manager :
    Desktop Manager is login manager such as GDM , KDM , SDDM , CDM and so on.

Abobe 3 layers are your Desktop Environment, Desktop Environment such as GNOME , KDE Plasma , awesome , LXDE and so on.

When your Desktop Manager is started, above application will be started.

But your question:

for disable or enable as permanent your Desktop Manager :

Читайте также:  Скзи континент ап linux

systemctl enable,disable YOUR_DESKTOP_MANAGER
such as : systemctl disable gdm3

service YOUR_DESKTOP_MANAGER start,stop
such as : service gdm3 stop

Источник

How do I stop GUI?

I need to enter the command line alone with no GUI to install the official NVIDIA drivers. I’m trying to get my computer to work over HDMI and someone on Youtube shows how but you have to be in the Nvidia settings program.

7 Answers 7

To do that just follow this:

  1. Go to CLI mode: CTRL + ALT + F1
  2. Stop GUI service on Ubuntu:
sudo service lightdm stop 

This simple service stopping and starting works — but it is the full canonical mode change? In the old times one entered non-graphical mulit-user mode by ‘runlevel 3’ and back graphical by ‘runlevel 5’. With systemd this should translate to (A) systemctl isolate multi-user and (B) systemctl isolate graphical . (A) indeed closes GUI, (B) brings up the login screen again — which however yields errors («Could not connect to bus session: Failed to connect to socket /run/user/1000/bus: Connection refused») when trying to login. Why?

I’ll accept yours because my question was too way specific. Actually I needed to run telinit 1 to completely disable not required processes.

If your purpose is to temporarily disable GUI — you can stop the lightdm service ( or whichever greeter you’re using ) with sudo service lightdm stop (14.04 and earlier) or sudo systemctl stop lightdm (since 15.04) from tty1, as shown by others already.

If your purpose to boot into command line for extended period of time between reboots, you can open /etc/default/grub with the choice of your text editor. I personally use nano , so for me the command would be sudo nano /etc/default/grub . Now, find GRUB_CMDLINE_LINUX=»» to GRUB_CMDLINE_LINUX=»text» . Or you can create two lines, one commented , one uncommented like so:

#GRUB_CMDLINE_LINUX="text" GRUB_CMDLINE_LINUX="" 

Once necessary, just uncomment the line for which mode you wanna enter. Upon completing editing the /etc/default/grub file, save it, and run sudo update-grub to make the configurations loaded into the actual grub.cfg file. Reboot, and you should enter the command line directly.

Источник

Оцените статью
Adblock
detector