How do I restart plasmashell after it crashes?

In Windows, if explorer.exe crashes and for some reason doesn’t restart, you can double click on the desktop to restart explorer.exe, and if that fails, you can do Ctrl+Alt+Del > Task Manager > File > Run > “explorer.exe”

Since plasmashell crashes quite often, and doesn’t always restart automatically, how can I restart it manually? If I switch to one of the virtual terminals, I can’t start it because it can’t find the display.

If I have a terminal window open when plasmashell does this, I can restart it using “kstart plasmashell”, but if I don’t have a terminal window open, then I’m stuck.

What’s the way to restart plasmashell manually, without having to lose your login session?

1 Like

Use krunner (alt-f2 or alt-space) to enter the desired command directly, or to open applications, including your terminal.

3 Likes

I have defined a keyboard shortcut for this via System Settings > Keyboard > Shortcuts, and now I just press Meta+Backspace to execute the command plasmashell —-replace

However, you might also look into the reasons why plasmashell crashes quite often in your case.

2 Likes

i’ve added this line to my ~/.bash_aliases

alias nps='systemctl restart --user plasma-plasmashell.service'

you don’t need a terminal, you can type nps directly into krunner

4 Likes

Ahh, good to know. I would have thought that krunner would have been part of plasmashell.

Thanks!

So, tangentially, what’s the best command to run to restart plasmashell?

kstart plasmashell

systemctl restart --user plasma-plasmashell.service

plasmashell --replace

or something else?

I just use plasmashell --replace as this stops plasmashell (if necessary) and reloads it. This seems safer, to me.

Doesn’t that bind the process to your terminal session though?

Where as kstart plasmashell would run it detached from your current terminal tty?

I don’t think so, or at least it doesn’t act that way. I may well have been doing it wrong all these years, for sure.

However, I have never seen an issue using it this way in krunner. I am guessing that krunner isn’t using that session or acting similar to kstart here.

I know when I run it from the terminal, it won’t detach and return to the prompt, and killing that terminal session will kill plasmashell…

So maybe krunner or kstart is the better way to start it?

I guess the other question that remains, if I use one of the other ttys that don’t have wayland running on them, how can I start plasmashell on the tty that does have the display on it?

Yes.

That’s where you would need to use systemctl restart --user plasma-plasmashell.service

But if you needed to switch to a different tty to do this, then you probably have more going on than plasmashell having died, I imagine.

1 Like

Awesome, that’s perfect! You’re right, starting it with systemctl will do exactly that!

I put that in a bash script and copied it to bin ‘prestart’ for plasma restart… ’ cos I can’t remember last time it crashed, but I remember prestart because I used it during some theming.

I’d like to add the following summary from AI:

In KDE Plasma 6, you should generally prefer systemctl restart --user plasma-plasmashell.service because:

  • It’s the official supported method for the systemd-managed session

  • Better handles dependencies and session integration

  • More reliable cleanup and restart process

However, plasmashell --replace still works and can be useful for:

  • Quick testing or troubleshooting

  • Systems not using systemd user sessions

  • Emergency recovery if the systemd service is having issues

Both will restart your Plasma Shell, but the systemctl method is more aligned with how Plasma 6 is designed to run.

So, if i do systemctl status --user plasma-plasmashell.service it says the service is disabled and not running, even when plasmashell IS running.

It doesn’t seem on Fedora 43 that plasma is running via systemd

So is this ACTUALLY the right way to do it? Is this a Fedora specific quirk?

I posted this earlier and deleted it.

I was wrong, on a fresh boot, systemd WAS responsible for starting plasmashell, and status would show that it was running. So I guess systemd is the best way to (re)start plasmashell.

Thanks for all the input everyone!

Maybe the command for an alias and/or keyboard shortcut should better be like this (to include a fallback if the preferred one fails)?
systemctl restart --user plasma-plasmashell.service || plasmashell --replace

I think what might have happened is this:

  • plasmashell crashed
  • systemd restarted it
  • after a couple of repeats systemd considered plasmashell to be too unstable and disabled it

This is when you checked its status.

Sometimes the causes of a crash are not inside the process that crashes but in another component.

If that component had now also been disabled, a subsequent restart of plasmashell would no longer be affected