Restart display manager linux

How can I restart GNOME Shell, after it freezes or becomes unresponsive?

Sometimes, my GNOME Shell freezes. I can see (hear) background processes working (playing music), but I can’t do anything in GNOME. No Alt + F2 followed by R and Enter . I can switch to console using: Ctrl + Alt + F1 , login as the same user and execute:

and return back Ctrl + F7 , but then, I get a strange behavior. For example I cannot edit network connections. I cannot logout as well. What is the proper way to restart the gnome-shell ?

Does gnome-shell freezes while using the search-function in gnome-shell overview , or on what particular occasion, if you can tell?

If you use any shell-extensions from: extensions.gnome.org deactivate all of them and reboot, to see if one of them caused the trouble. I use an older version of gnome-shell and had plenty of issues due to that exact cause! (Maybe it is just as simple as that?!)

11 Answers 11

The easier way is just pressing Alt + F2 , type r then Enter . This will work so long the shell is usable.

You can also send SIGQUIT to the gnome-shell process which will terminate only the shell:

Other methods use more destructive means, which close all the applications, this shouldn’t.

+1 for the SIGHUP tip, however, wouldn’t the correct command then be killall -1 gnome-shell ? At least according to man 7 signal , the value for SIGHUP is 1. Value 3 corresponds to SIGQUIT . I have sent value 1 to the Gnome Shell and it was cleanly restarted as expected.

I wish we could also use a terminal command having exactly the same effect as Alt+F2 and r , i.e. without blanking the whole screen.

This one disabled all my gnome-shell-extensions. Even after restart, they didn’t back until I activated them again one by one.

  • If you want to ask «nicely» to gnome-shell to restart itsself, then you can call it’s internal restart function over dbus with following command (assuming you have DBUS_SESSION_BUS_ADDRESS env var set to the correct value and run as same user):
dbus-send --type=method_call --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'global.reexec_self()' 

I created a shell function that sets the DBUS_SESSION_BUS_ADDRESS from the gnome-shell process environment (so you can logout otheruser1 otheruser2 ) askubuntu.com/a/874504/17941

Читайте также:  Linux узнать загрузку процессора

Got the error Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Shell was not provided by any .service files without sudo and Failed to open connection to «session» message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11 with sudo.

If you have installed ubuntu gnome, which you should have, you might be using the gnome display manager. In that case you should change to another TTY, like Ctrl + Alt + F4 and then

I also wrote an article about such situation recently:

this completely fucked up the current session: it started to blink and then went to nirvana.. had to reboot.

I agree, be careful! This command cause you can lost settings. For me: lost mouse settings, disabled GNOME Shell Extensions (extensions: Dash to Panel, Clock Override, Datetime Format).

Here is a different workaround:

  1. Log in a local terminal by pressing CTRL + ALT + F1 .
  2. Run the command:
sudo kill -HUP $(pidof gnome-shell) 

PS: I’m using lightdm instead of gdm3.

Whilst this does successfully restart gnome-shell; I find that some programs — presumably those less well integrated with GNOME — don’t survive; eg: Firefox, Thunderbird, VirtualBox VMs. Example of programs that survive: «Files», Terminal, ImageViewer. Ideally there’s be a way to restart gnome-shell without jeopardizing any running program (Ubuntu 19.10)

Since you are not satisfied with gnome-shell —replace , you might want to try restarting the display manager itself.

sudo service lightdm restart 

If you are seriously into something that make you freeze everytime, enable the SysRq as mentioned in https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst, and then give to kill whatever its there on the screen.

Restarting lighdm works, but I want to avoid it, because I have to reopen everything from a scratch. Especially if I know it is problem of a Gnome-shell and restarting it almost works.

I am unaware of other methods to restrat just the gnome shell. Did you try whether DISPLAY=:7 gnome-shell —replace works ?

No, it does not, I use display, when w shows display different than :0. If I use a wrong display I get an error.

Sorry, I’m out of options. You should probably ask in the gnome user/developer mailing list. First figure out why you have abnormalities with alt-f2-r or gnome-shell —replace when it is the gnome’s recommended way.

So am I. I did even followed this link setting up more ENV variables, but I still cannot edit network connections when restarting gnome-shell from a different terminal. In the end, I end up with this trick

I do sometimes have the same problem as you describe, and my solution is:

Ctrl + Alt + F1 , login as same user and execute:

And return back with Ctrl + Alt + F7

If this is the proper way, I don’t know. For me it works everytime.

This will kill all users instances of gnome-shell which may not be something you want to do in a multi-user scenario. Normally you only have to kill your own (pkill -HUP gnome-shell)

Restart X

cat /etc/X11/default-display-manager 

Methods

  1. Ctrl+Alt+F1 to exit, and Ctrl+Alt+F3 to bring one back
  2. sudo /etc/init.d/gdm3 restart
  3. systemctl restart gdm.service
  4. sudo service gdm3 restart
  5. dbus-send —type=method_call —print-reply —dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:’global.reexec_self()’
  6. An easy way is just pressing Alt + F2, and type r then press Enter. This will work so long the shell isn’t unusable.

Method 5 is lifted verbatim from korc’s answer and 6 from Braiam’s answer. Plagiarism isn’t against the rules here, but it’s definitely not cool. All you really need to do is indicate that the work is not your own by putting it in quotes, and give attribution by including a link to the source post and a link to the author’s profile page. For more details, see this blog post: Attribution Required

For Ubuntu 20.04 if you have ssh enabled on the affected computer.

  1. ssh into the affected computer from a remote computer
  2. execute killall -1 gnome-shell without sudo.

There’s a bit of lag at the start when logging as it is re-instantiating all gnome objects be patient; but most if not all running programs should continue working.

The (currently) most upvoted answer by @Braiam misses some details. Some of the other answers didn’t work for me. Hence, I am writing what did work for me. Note that this is tested on Ubuntu 20.04 running GNOME Shell 3.36.9.

  1. If the current instance of GNOME Shell is still responsive, restart it with Alt + F2 → r → Enter . This should work in most cases. But once in a while, the shell may become completely unresponsive, or even this command may get stuck. In that case, go on to the following steps.
  2. Go to a TTY. On my system, the key combination would be Ctrl + Alt + F3 to F6 .
  3. Log in. (Note that in TTY, number keys on numeric keypad may not work!)
  4. Find the PID of GNOME Shell using pidof gnome-shell .
  5. Kill it using sudo kill -1 replacing with the output of the above step. (If you don’t use sudo , you will get the Operation not permitted error.)
  6. Re-execute step 3. If nothing is returned, then GNOME Shell has not yet restarted. Keep repeating step 3 until you get the PID of the new instance of the shell. (Note that this PID will not be the same as what you had got in step 3.)
  7. Once the PID of the new shell instance is returned, you can safely return to the GUI. Type exit and log out of the TTY.
  8. Return to the GUI. In Ubuntu 20.04, this is achieved using Ctrl + Alt + F2 .

This method did not close any of the applications that were running. Unsaved changes in such applications still existed without any problem. All GNOME extensions were loaded properly too.

Источник

How do I restart the window manager?

How to restart window manager so that styles (or whatever) are restored? After doing /etc/init.d/networking stop they feel completely broken. I have reinstalled lightdm. I have restarted lightdm. Nothing seems to help. Is there a command line tool to reconfigure lightdm with?

This is not an answer in any way but just saying, a nicer way to stop the networking service is by sudo service networking stop

7 Answers 7

You may need to restart your display manager to fix your problem.

11.04 and earlier.

Ubuntu 11.10 and newer.

sudo service lightdm restart 

lightdm replaces gdm in Ubuntu 11.10

Ubuntu 15.04 and newer.

sudo service sddm restart 

While restarting lightdm restarts the entire display manager, you may be able to resolve the issue by restarting unity or compiz (Unity is a compiz plugin).

Restarting Unity ( nohup setsid unity OR nohup unity —restart on the CLI OR Alt + F2 and type unity ) restarts the Unity shell.

If that doesn’t work, restart compiz with nohup compiz —replace . You may need to restart unity again after restarting compiz.

Restarting lightdm restarts the entire display manager which is most likely to work but it will also close your running applications. Which you need to do depends on how broken your session is. If you can just restart Unity or Compiz, do that. If that doesn’t work, restart lightdm.

The following wiki article has additional information about fixing LightDM issues:

Источник

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