Monday, April 13, 2020

Run a GUI app with sudo

Use pkexec as a GUI alternative for sudo.

A krusader's custom action as an examle:
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /bin/bash -c "cryptsetup open --allow-discards /dev/sdb7 data -d /key && mount /dev/mapper/data /media/user/data"; %aGoto("/media/user")%

Thursday, April 2, 2020

Clear systemd journal

examples are taken here

Systemd stores its logs in /var/log/journal.
$ du -hs /var/log/journal/
4.1G    /var/log/journal/
Check the oldest logs date:
$ ls -lath /var/log/journal/*/ | tail -n 2
-rw-r-x---+ 1 root systemd-journal 8.0M Dec 24 05:15 user-xxx.journal

Clear by date: older than X days

Clearing everything older than 10 days:
$ journalctl --vacuum-time=10d
...
Vacuuming done, freed 2.3G of archived journals on disk.

Clear by size: if they exceed X storage

Clearing everything that exceeds 2GB size:
$ journalctl --vacuum-size=2G
...
Vacuuming done, freed 720.0M of archived journals on disk.