Page 1 of 1

Restart cinnamon from CLI

Posted: Mon Feb 17, 2014 6:51 am
by kaizer
Hello,

I am running LMDE and everything works perfectly expect that sometime cinnamon freeze after the laptop has been hibernating. I would like to know 2 things:
- what is the "cleanest" way to restart cinnamon from command line
- is it possible to register the required command such as next time it happen I can just go to a terminal and type something such as "cinnamon-restart"? It may be complicated to remember by heart a complicated command line.

Thank you in advance for your help.

Kaiz

Re: Restart cinnamon from CLI

Posted: Mon Feb 17, 2014 7:10 am
by kurotsugi
I'm not using cinnamon anymore but as far as I remember cinnamon could be restarted by simply pres Alt+F2 type r and enter. you can also use killall command to kill cinnamon then restart cinnamon afterward. I think both of them are work in same way.
- is it possible to register the required command such as next time it happen I can just go to a terminal and type something such as "cinnamon-restart"? It may be complicated to remember by heart a complicated command line.
you can do it via alias or create a script on /usr/bin or home. with alias, you can put something similar with this on ~/.bashrc

Code: Select all

alias kudate='sudo apt-get update'
alias kdown='sudo aptitude -d dist-upgrade'
alias kgrad='sudo aptitude dist-upgrade'
alias kremove='sudo aptitude purge $( deborphan --guess-all )'
alias kclean='sudo apt-get autoclean && sudo apt-get autoremove'
in your case it would be something like sudo killall cinnamon && <command to start cinnamon> . if you prefer to use script you can use something like

Code: Select all

#!/bin/sh
sudo killall cinnamon
sudo <command to start cinnamon>
exit 0

Re: Restart cinnamon from CLI

Posted: Mon Feb 17, 2014 7:21 am
by JosephM
This easiest way to restart cinnamon from the command line is

Code: Select all

cinnamon --replace

Re: Restart cinnamon from CLI

Posted: Mon Feb 17, 2014 9:30 am
by kaizer
Thank you, so next time cinnamon freeze .. I will just have to go to tty1 and then cinnamon --replace ? It looks too easy to be true :-) I will try that next time...
Thank you !!!

Re: Restart cinnamon from CLI

Posted: Fri Feb 21, 2014 10:53 am
by kaizer
It happened again today.
I wnt to tty1 then try

Code: Select all

cinnamon --replace
but I got an error message saying

Code: Select all

Windows manager error: Unable to open X display
I think that command would only work from terminal within X session. I still need a solution for when my X session is so corrupted that I can only use tty.

Anyone has a workaround?

Thank you in advance.

Re: Restart cinnamon from CLI

Posted: Fri Feb 21, 2014 11:37 am
by kurotsugi
you'll need to kill that cinnamon then run 'startx'

Re: Restart cinnamon from CLI

Posted: Sat Mar 01, 2014 3:10 pm
by akwala
When Cinnamon becomes unresponsive, I go to the text console (Ctrl-Alt-F1 or Ctrl-Alt-F2) and do the following:

Get the pid of the cinnamon process using this command:

Code: Select all

ps -ef | grep "cinnamon "
Kill the process with the pid listed above:

Code: Select all

kill -9 <pid>
This usually relaunches Cinnamon and I return to it by doing Ctrl-Alt-F7 or Ctrl-Alt-F8.

Occasionally, Cinnamon doesn't relaunch, in which case I launch it by doing the following*:

Code: Select all

export DISPLAY=:0.0 && cinnamon --replace &
The "w" command will give you the DISPLAY value, as shown in the example here: http://community.linuxmint.com/tutorial/view/641

* The "cinnamon" command also accepts the DISPLAY ID in its "--display" argument, like so:

Code: Select all

cinnamon --replace --display=:0
I've created a custom keyboard shortcut for this command, so I don't usually have to switch to the text console to restart Cinnamon.

Re: Restart cinnamon from CLI

Posted: Tue Apr 01, 2014 6:53 pm
by Redsandro
I need to (re)start cinnamon, or actually the login screen (which iirc is not actually cinnamon yet).

Either way, the commands discussed in this topic do not work.

Code: Select all

$ cinnamon --replace --display=:0 &
[1] 20869
$ No protocol specified
Window manager error: Unable to open X display :0

[1]+  Exit 1                  cinnamon --replace --display=:0
$ export DISPLAY=:0.0 && cinnamon --replace &
[1] 20997
$ No protocol specified
Window manager error: Unable to open X display :0.0

[1]+  Exit 1                  export DISPLAY=:0.0 && cinnamon --replace

Re: Restart cinnamon from CLI

Posted: Wed Apr 02, 2014 2:59 am
by Monsta
Another way is to restart your display manager. For example, for MDM (the default one) run this from the root console:

Code: Select all

service mdm restart
This will kill your desktop environment (e.g. Cinnamon) and show you the login screen.