Try an easy fix by restarting Cinnamon and X Server

Most crashes on Mint and Ubuntu are caused by an unresponsive X Server or because Cinnamon has frozen up so it’s worth trying these easy fixes first.

# Option 1 = restart Cinnamon via command box
1. Alt + F2 on your keyboard
1. Type "r" in the "Enter a command" box
1. Press Enter

# Option 2 = kill X server via keyboard
Control + Alt + Backspace

# Option 3 = restart Cinnamon via command line
cinnamon --replace

# Option 4 = restart display manager
sudo systemctl restart lightdm

Step 1. Switch to a different virtual console

This opens a tty prompt allowing you to run some commands to stop whatever has frozen your machine. The name of the program that ctrl alt F1 uses is called getty (or agetty). There are multiple virtual consoles available on F1 - F6.

Ctrl + Alt F1

Step 2. Get the PID of the offending package

This step isn’t totally necessary as there are ways to indiscriminately kill processes by name (killall and pkill) but I think it’s good practice to target only the process that is causing the problem.

Know the name of the crashed package? Then use pgrep

If you know what process has caused the crash then you can use either pgrep or pidof to find the process id of the offending package. Although both these tools do pretty much the same job I prefer using pgrep because the regex matching of the process name is real handy.

# Best option = pgrep
# (uses regex for matching name of process)
# (output is a line-broken list in numerical order)
root@planetroast:~$ pgrep chrome
116029
117032

# 2nd best option = pidof
# (output is a space separated string)
# (requires the exact name of the process)
root@planetroast:~$ pidof chrome
116029 117032

# Alternative option = ps
# (might not be installed by default on your system)
# (you'll need the grep because the list will be huge)
# (the aux flags relate to filtering the results)
root@planetroast:~$ ps aux | grep chrome
root        116029  6.9 16.1 25840080 1219964 ?    Sl   Jul30 520:17 /usr/lib/firefox/firefox

Don’t know what caused the crash? Then use top

The top package should be installed on your system by default and it shows a real time view of your system including a list of processes and how much CPU and memory they are eating up. By default the list is sorted by CPU usage so your offending package should be near the top of the list.

root@planetroast:~$ top

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 138426 root      20   0 3099388 348192 112884 S  99.7  44.6  48:06.94 Isolated Web Co
 116029 root      20   0   16.6g   1.2g 289412 S   0.7  16.0 519:17.76 firefox-bin
    549 kernoops  20   0   11252    444      0 S   0.3   0.0   0:35.40 kerneloops
 169975 root      20   0 2657568 199332  99184 S   0.3   2.6   7:25.30 Isolated Web Co
 176319 root      20   0 2672828 202964  98400 S   0.3   2.7   7:28.09 Isolated Web Co

There’s a similar package available called htop which does the same job but looks a bit nicer and has some useful features such as search and filtering. It also lets you kill a process straight from the package which saves you step. Only downside of htop is that it probably won’t be installed by default so might not be an option in the event of a crash.

Step 3. Kill the process

The -9 indicates the type of signal sent, 9 being the signal for ‘kill’ which forces the termination of a process. Another commonly used signal is -15 which sends the more graceful termination signal. There are a bunch more of these but those are the two you’ll use the most.

# Option 1 (kills a specific process)
kill -9 your-pid-here

# Option 2 (kills all processes by name)
# (requires exact process name)
killall -9 chrome 

# Option 3 (kills all processess by name)
# (uses regex for matching name of process)
pkill -9 chrome

Step 4. Switch back to the gui

Now that your process has (hopefully) shut down and your system is back to normal you can switch back to the GUI and continue doing your work.

Ctrl + Alt F7