Restart cinnamon from CLI
Forum rules
LMDE 2 has reached end of support as of 1-1-2019
LMDE 2 has reached end of support as of 1-1-2019
Restart cinnamon from CLI
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
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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Restart cinnamon from CLI
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. 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
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- 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.
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'
Code: Select all
#!/bin/sh
sudo killall cinnamon
sudo <command to start cinnamon>
exit 0
Re: Restart cinnamon from CLI
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.
Re: Restart cinnamon from CLI
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 !!!
Thank you !!!
Re: Restart cinnamon from CLI
It happened again today.
I wnt to tty1 then try
but I got an error message saying
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.
I wnt to tty1 then try
Code: Select all
cinnamon --replace
Code: Select all
Windows manager error: Unable to open X display
Anyone has a workaround?
Thank you in advance.
Re: Restart cinnamon from CLI
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:
Kill the process with the pid listed above:
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*:
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:
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.
Get the pid of the cinnamon process using this command:
Code: Select all
ps -ef | grep "cinnamon "
Code: Select all
kill -9 <pid>
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 "cinnamon" command also accepts the DISPLAY ID in its "--display" argument, like so:
Code: Select all
cinnamon --replace --display=:0
--aslamK
Re: Restart cinnamon from CLI
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.
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
Another way is to restart your display manager. For example, for MDM (the default one) run this from the root console:
This will kill your desktop environment (e.g. Cinnamon) and show you the login screen.
Code: Select all
service mdm restart