Re: [systemd-devel] Restart SystemD service when Memory Usage in More than a threshold
So here is my final service file: tee ~/.local/share/systemd/user/nemo-desktop-bug-workaround.service << END > [Unit] > Description=Nemo Desktop Bug Workaround > Wants=graphical-session.target gnome-session.target > PartOf=graphical-session.target > BindsTo=graphical-session.target [Service] > Type=simple > StartLimitIntervalSec=3 > ExecStart=/usr/bin/nemo-desktop > # MemoryHigh=5K > MemoryMax=10K > Restart=always > KillMode=process > KillSignal=SIGKILL [Install] > WantedBy=graphical-session.target gnome-session.target > END systemctl --user daemon-reload > systemctl --user start nemo-desktop-bug-workaround.service > systemctl --user enable nemo-desktop-bug-workaround.service I have tried with Type=forking as well. The issue is, after I run this service, when there is a heavy load for example i try to run a qemu command or something like that in my terminal emulator, the tmux sessions crash. It does not happen when I am not using this service. I am too close to a solution but think that missing some minor details. On Tue, Sep 19, 2023 at 11:28 AM Ahmad Ismail wrote: > Here is the bug https://github.com/linuxmint/nemo/issues/3306 . > Unfortunately nemo-desktop is a very important dependency for my regular > work. > > Currently I manually restart it. Restarting this is not as bad as it > sounds like. Just the desktop icons go away and come back. > > Here is the service file I am currently at: > > [Unit] > Description=Nemo Desktop Bug Workaround > Wants=xdg-desktop-autostart.target > PartOf=graphical-session.target > BindsTo=graphical-session.target > > [Service] > Type=forking > StartLimitIntervalSec=3 > ExecStart=/usr/bin/nemo-desktop > # MemoryHigh=5K > MemoryMax=10K > Restart=always > KillMode=process > KillSignal=SIGKILL > > [Install] > WantedBy=graphical-session.target xsession.target gnome-session.target > END > > I have run: > > > systemctl --user list-dependencies xdg-desktop-autostart.target >> xdg-desktop-autostart.target >> ○ ├─app-geoclue\x2ddemo\x2dagent@autostart.service >> ○ ├─app-gnome\x2dinitial\x2dsetup\x2dfirst\x2dlogin@autostart.service >> ○ ├─app-gnome\x2dshell\x2doverrides\x2dmigration@autostart.service >> ○ ├─app-im\x2dlaunch@autostart.service >> ○ ├─app-nemo\x2ddesktop@autostart.service >> ○ ├─app-nm\x2dapplet@autostart.service >> ○ ├─app-orca\x2dautostart@autostart.service >> ○ ├─app-org.gnome.Evolution\x2dalarm\x2dnotify@autostart.service >> ○ ├─app-org.gnome.SettingsDaemon.DiskUtilityNotify@autostart.service >> ○ ├─app-org.gnome.Software@autostart.service >> ○ ├─app-user\x2ddirs\x2dupdate\x2dgtk@autostart.service >> ○ ├─app-xdg\x2duser\x2ddirs\x2dkde@autostart.service >> ○ └─app-yandex\x2ddisk@autostart.service > > > Here app-nemo\x2ddesktop@autostart.service is most probably generated > by systemd-xdg-autostart-generator using: > > [Desktop Entry] >> Type=Application >> Name=Nemo >> Comment=Start Nemo desktop at log in >> Exec=nemo-desktop >> X-GNOME-AutoRestart=true >> NoDisplay=true > > > How can I view app-nemo\x2ddesktop@autostart.service ? If I can view > this file then would like to copy the contents and edit it then remove > app-nemo\x2ddesktop@autostart.service and install the custom service. On > that note, would be glad to know how to remove these auto-generated files > when i have a new one. > > > On Mon, Sep 18, 2023 at 11:12 PM Michal Koutný wrote: > >> Hello Ahmad. >> >> On Sat, Sep 16, 2023 at 09:29:07PM +0600, Ahmad Ismail < >> ismail...@gmail.com> wrote: >> > The file in ~/.config/autostart which autostart the service is: >> ^^^ >> >> > So, I came up with a systemd service which will restart nemo-desktop >> when >> > memory usage is 100MB. >> >> Is the bug you mention a memory leak? (A restart at arbitrary moment >> doesn't sound like the best user experience.) >> >> Or is it another cause? Nevertheless, you may want to report it to >> the respective upstream or upgrade to its latest version. >> >> > sudo tee /etc/systemd/system/nemo-desktop-bug-workaround.service << END >> ^^ >> >> > [Service] >> > User=ismail >> > Group=ismail >> ... >> > ExecStart=/usr/bin/nemo-desktop >> ... >> > What am I doing wrong here? >> >> Maybe you conflate a system service (running with changed User=/Group=) >> and a user instance service (spawned under user@$UID.service) and some >> necessary settings are missing in the nemo-dektop's environment (I'm not >> familiar with that particular program, hence a guess only). >> >> HTH, >> Michal >> >
Re: [systemd-devel] Restart SystemD service when Memory Usage in More than a threshold
Here is the bug https://github.com/linuxmint/nemo/issues/3306 . Unfortunately nemo-desktop is a very important dependency for my regular work. Currently I manually restart it. Restarting this is not as bad as it sounds like. Just the desktop icons go away and come back. Here is the service file I am currently at: [Unit] Description=Nemo Desktop Bug Workaround Wants=xdg-desktop-autostart.target PartOf=graphical-session.target BindsTo=graphical-session.target [Service] Type=forking StartLimitIntervalSec=3 ExecStart=/usr/bin/nemo-desktop # MemoryHigh=5K MemoryMax=10K Restart=always KillMode=process KillSignal=SIGKILL [Install] WantedBy=graphical-session.target xsession.target gnome-session.target END I have run: > systemctl --user list-dependencies xdg-desktop-autostart.target > xdg-desktop-autostart.target > ○ ├─app-geoclue\x2ddemo\x2dagent@autostart.service > ○ ├─app-gnome\x2dinitial\x2dsetup\x2dfirst\x2dlogin@autostart.service > ○ ├─app-gnome\x2dshell\x2doverrides\x2dmigration@autostart.service > ○ ├─app-im\x2dlaunch@autostart.service > ○ ├─app-nemo\x2ddesktop@autostart.service > ○ ├─app-nm\x2dapplet@autostart.service > ○ ├─app-orca\x2dautostart@autostart.service > ○ ├─app-org.gnome.Evolution\x2dalarm\x2dnotify@autostart.service > ○ ├─app-org.gnome.SettingsDaemon.DiskUtilityNotify@autostart.service > ○ ├─app-org.gnome.Software@autostart.service > ○ ├─app-user\x2ddirs\x2dupdate\x2dgtk@autostart.service > ○ ├─app-xdg\x2duser\x2ddirs\x2dkde@autostart.service > ○ └─app-yandex\x2ddisk@autostart.service Here app-nemo\x2ddesktop@autostart.service is most probably generated by systemd-xdg-autostart-generator using: [Desktop Entry] > Type=Application > Name=Nemo > Comment=Start Nemo desktop at log in > Exec=nemo-desktop > X-GNOME-AutoRestart=true > NoDisplay=true How can I view app-nemo\x2ddesktop@autostart.service ? If I can view this file then would like to copy the contents and edit it then remove app-nemo\x2ddesktop@autostart.service and install the custom service. On that note, would be glad to know how to remove these auto-generated files when i have a new one. On Mon, Sep 18, 2023 at 11:12 PM Michal Koutný wrote: > Hello Ahmad. > > On Sat, Sep 16, 2023 at 09:29:07PM +0600, Ahmad Ismail < > ismail...@gmail.com> wrote: > > The file in ~/.config/autostart which autostart the service is: > ^^^ > > > So, I came up with a systemd service which will restart nemo-desktop when > > memory usage is 100MB. > > Is the bug you mention a memory leak? (A restart at arbitrary moment > doesn't sound like the best user experience.) > > Or is it another cause? Nevertheless, you may want to report it to > the respective upstream or upgrade to its latest version. > > > sudo tee /etc/systemd/system/nemo-desktop-bug-workaround.service << END > ^^ > > > [Service] > > User=ismail > > Group=ismail > ... > > ExecStart=/usr/bin/nemo-desktop > ... > > What am I doing wrong here? > > Maybe you conflate a system service (running with changed User=/Group=) > and a user instance service (spawned under user@$UID.service) and some > necessary settings are missing in the nemo-dektop's environment (I'm not > familiar with that particular program, hence a guess only). > > HTH, > Michal >
Re: [systemd-devel] Restart SystemD service when Memory Usage in More than a threshold
Hello Ahmad. On Sat, Sep 16, 2023 at 09:29:07PM +0600, Ahmad Ismail wrote: > The file in ~/.config/autostart which autostart the service is: ^^^ > So, I came up with a systemd service which will restart nemo-desktop when > memory usage is 100MB. Is the bug you mention a memory leak? (A restart at arbitrary moment doesn't sound like the best user experience.) Or is it another cause? Nevertheless, you may want to report it to the respective upstream or upgrade to its latest version. > sudo tee /etc/systemd/system/nemo-desktop-bug-workaround.service << END ^^ > [Service] > User=ismail > Group=ismail ... > ExecStart=/usr/bin/nemo-desktop ... > What am I doing wrong here? Maybe you conflate a system service (running with changed User=/Group=) and a user instance service (spawned under user@$UID.service) and some necessary settings are missing in the nemo-dektop's environment (I'm not familiar with that particular program, hence a guess only). HTH, Michal signature.asc Description: PGP signature
[systemd-devel] Restart SystemD service when Memory Usage in More than a threshold
My nemo-desktop instance keeps crashing due to a bug. The file in ~/.config/autostart which autostart the service is: [Desktop Entry] Type=Application Name=Nemo Comment=Start Nemo desktop at log in Exec=nemo-desktop X-GNOME-AutoRestart=true NoDisplay=true So, I came up with a systemd service which will restart nemo-desktop when memory usage is 100MB. sudo tee /etc/systemd/system/nemo-desktop-bug-workaround.service << END [Unit] Description=Nemo Desktop Bug Workaround Wants=xdg-desktop-autostart.target PartOf=graphical-session.target BindsTo=graphical-session.target [Service] User=ismail Group=ismail Type=forking StartLimitIntervalSec=3 ExecStart=/usr/bin/nemo-desktop ExecStop=/usr/bin/nemo-desktop --quit MemoryAccounting=true # MemoryHigh=5K MemoryMax=10K Restart=always KillMode=process [Install] WantedBy=graphical.target END systemctl daemon-reload systemctl start nemo-desktop-bug-workaround.service systemctl enable nemo-desktop-bug-workaround.service Now the problem is, it crashes with the terminal emulators. What am I doing wrong here?