Correct command for restarting certain processes

Info:
my system: Lubuntu 20.04.4 LTS, 64 bit

Hi all, :wave:

I wonder if anyone could help me with a certain “problem”.

Yesterday evening (I just wanted to end my session) my system suddenly went partially unresponsive. :slightly_frowning_face:
What I had done just before it happened was this:

I unmounted my USB-Sticks from within PCManFM-Qt and then closed the file-manager.
I seemed to have forgotten something, so I opened up thunar (which is also installed on my system). Yet this took an unusually long time and I couldn´t close it anymore.

Plus: every popup-window I opened by clicking on the respective icon in the taskbar couldn´t be closed either.
This is the unresponsive-part.

But I could change into a virtual terminal with CTRL+ALT+3. From there I could have triggered some appropriate action - had I known what to do. :thinking:

top -i didn´t show any process with unusually high cpu consumption. So nothing there.

I would have liked to restart either (or all) of those processes:

openbox, lxqt-panel, pcmanfm-qt … in the hope to get a responsive system back.

Could you tell me what the correct command for doing this might be :question:

Many thanks in advance …
… and many greetings from Rosika :slightly_smiling_face:

P.S.:

In the end I issued the REISUB-sequence (holding ALT+Print) and after the reboot everything worked fine again. :+1:

So the init for Ubuntu has been systemd for a while now. For starting, restarting, and stopping processes (among other things), you can use the systemctl command. You will need sudo privleges for this.

The command will likely be like this for you:

sudo systemctl restart programname

*where programname is whatever program you’re trying to restart.

In your case, I don’t know what’s causing the issue. Has this issue happened again since then? If yes, does it always happen randomly or only when you open certain apps (e.g. Thunar)?

3 Likes

Hi John, :wave:

thank you so much for your help. :+1:

I see.
Well, I´ve sometimes used it for restarting services like
sudo systemctl restart incron.service
but I didn´t know it could be applied to any process.

In the special case I mentioned in my initial post I would have to issue the command from a virtual console . Therefore:
Should I prepend the command with “DISPLAY=:0” like so:

DISPLAY=:0 sudo systemctl restart lxqt-panel

or wouldn´t this be necessary :question:

Many thanks again and many greetings
Rosika :slightly_smiling_face:

P.S.:

No, it hasn´t. Well, it occurred just yesterday in the evening but not again.
Also: it hadn´t happened before. Never.

Today I looked through the logs:
lnav /var/log/syslog.1
but couldn´t find anything hinting towards some unusual points.

Neither PCManFM-Qt nor thunar misbehaved in any way (besides this one time).

That’s a good point that I didn’t consider. I haven’t really dealt with this problem before myself but it looks like you understand what’s required more than I do. I’ll leave that call to you.

I tend to interchange the words process and service a lot when I try to explain systemd. My bad. I would also say systemd is the service manager for the system.

Since the glitch didn’t happen again, it’s hard to say what it could be at this point. It could actually be a hardware issue or perhaps there’s an anomaly with the file system. You can check the RAM sticks in your PC with the live cd I think. You can also use fsck to check out the file system but if the logs haven’t really mentioned anything then it might not be that either.

If the error occurs again, you can login from the other console and save the syslog for that session somewhere you can yank later. Good luck! :wink:

2 Likes

Hi again, John, :wave:

thank you for your new reply.

Well, I certainly wouldn´t go as far as that… :wink:

In fact I just conducted an experiment with my Debian (xfce desktop) virtual machine.
I´ll always make use of a VM for testing purposes. Much safer this way… :wink:

First I switched over to a virtual console and typed mousepad. This didn´t work. I almost expected such an outcome.
Then - also from a virtual console - I typed
env DISPLAY=:0 mousepad &
(I needed env because that´s the correct syntax for the fish-shell; for bash it can be omitted, I guess).

That worked :smile: . I got the mousepad text-editor on my graphical desktop.

In the virtual console I typed: CTRL+D and then:
disown [PID for mousepad]
After that I could exit the virtual console and still had mousepad running on the graphical desktop.

Well, as I said, that was an experiment but it should theoretically work with other processes too.

Yet the other point we discussed seems to have proved less successful. :frowning_face:

The systemctl restart-command seems to be valid for .services only.

I tried it with:

sudo systemctl restart xfce4-panel
Failed to restart xfce4-panel.service: Unit xfce4-panel.service not found.

So the command is definitively looking for the seemingly non-existent xfce4-panel.service and not for the respective process. :thinking:

Taking a look at Lubuntu now:

ps aux | grep lxqt-panel
rosika      1483  0.1  0.8 741728 33000 ?        Sl   12:59   0:19 /usr/bin/lxqt-panel
rosika     25297  0.0  0.0   9412   724 pts/2    S+   15:55   0:00 grep --color=auto lxqt-panel

restarting e.g. lxqt-panel from a virtual console should then be possible by

  • killing the process first
  • env DISPLAY=:0 lxqt-panel &

At least that´s what I´m guessing. :blush:

Well, God-be-thanked- the logs didn´t reveal anything untoward. Perhaps - and hopefully - this was a one-time occurrence… :shushing_face:
But thanks a lot for all your suggestions regarding the matter. I´ll keep them in mind.

Many thanks again for your kind help. :heart:
Many greetings from Rosika :slightly_smiling_face:

1 Like

Yes, that would actually make more sense than what I initially recommended. I don’t know if there’s a service related to the processes that got impacted by the glitch but what you’ve outlined to do should absolutely work provided you stop the right processes. I’ve never done it before though.

There might be other commands for the binaries actually involved with the impacted processes which you’ll find with either ps or top. Of course, I’m with you on that boat as I don’t know how to identify the problem process impacted by the glitch behavior.

Thanks Rosika! :slightly_smiling_face:

1 Like

Hello John, :wave:

thanks a lot for your reply.

Thanks for the confirmation.

Well, as I´ve already said, the error hasn´t come up again, which I´m really thankful for.
But in any case it´s certainly comforting to know how to go about, should the need for any action arise.

Thank you very much for your help …
… and many greetings from Rosika :slightly_smiling_face:

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.