Restart cinnamon from CLI

Archived topics about LMDE 1 and LMDE 2
Locked
kaizer
Level 2
Level 2
Posts: 80
Joined: Wed Feb 16, 2011 8:49 am

Restart cinnamon from CLI

Post 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

kurotsugi
Level 6
Level 6
Posts: 1027
Joined: Fri Jan 25, 2013 3:54 am

Re: Restart cinnamon from CLI

Post 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

JosephM
Level 6
Level 6
Posts: 1169
Joined: Sun May 26, 2013 6:25 pm

Re: Restart cinnamon from CLI

Post by JosephM »

This easiest way to restart cinnamon from the command line is

Code: Select all

cinnamon --replace
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.

kaizer
Level 2
Level 2
Posts: 80
Joined: Wed Feb 16, 2011 8:49 am

Re: Restart cinnamon from CLI

Post 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 !!!

kaizer
Level 2
Level 2
Posts: 80
Joined: Wed Feb 16, 2011 8:49 am

Re: Restart cinnamon from CLI

Post 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.

kurotsugi
Level 6
Level 6
Posts: 1027
Joined: Fri Jan 25, 2013 3:54 am

Re: Restart cinnamon from CLI

Post by kurotsugi »

you'll need to kill that cinnamon then run 'startx'

User avatar
akwala
Level 1
Level 1
Posts: 5
Joined: Sun Aug 04, 2013 7:29 am

Re: Restart cinnamon from CLI

Post 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.
--aslamK

Redsandro
Level 3
Level 3
Posts: 149
Joined: Sun Jul 17, 2011 6:40 pm
Contact:

Re: Restart cinnamon from CLI

Post 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
🤘 Amp.lol. No bloat, just radio.
Ninite-killer. 1000+ packages.

Monsta
Level 10
Level 10
Posts: 3055
Joined: Fri Aug 19, 2011 3:46 am

Re: Restart cinnamon from CLI

Post 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.

Locked

Return to “LMDE Archive”