Friendly reminder to do some system maintenance

Just FYI you want to run

sudoedit /etc/systemd/journald.conf

Not sudo nano. Sudoedit doesn’t actually run the editor as root and is better from a security perspective.

Any time you wish to edit a root required file it should be done in this way so as to not run things as root you don’t need to.

Sudoedit creates a temporary copy of the file allowing non root to edit it (it creates specific locked down permission for doing so) then when finished root will write the file if changed.

3 Likes

Came hear as part of searching for suggestions on how to clear my AUR cache but learning some useful stuff along the way in this thread. I’m also discovering that “paru -Scc” is not really working (had to delete that cache manually - researching elsewhere seems to indicate that’s a known issue). Looks like my journal default settings are just fine. Gone ahead and set up the paccache timer for now but very intrigued at the idea of creating a pacman hook that can clean both pacman and aur caches automatically.

It would probably be easier to setup a systemd unit to clean the paru and yay caches. pacman hooks run as root so you would have to work around that otherwise.

As a side note, you should probably try to use either paru or yay, not both. By switching back and forth, you won’t get proper diffs.

1 Like

Well i just regained 20GB of disk space.

:sweat_smile:

Question:
Why it is not enabled be default?
There should be more ppl not in need of more than three version? :thinking:

Yup, I’m starting to figure that out. :wink:

…as for paccache.timer; I had that set up on my Arch build but kind of overlooked it here so, that was a good heads-up…

1 Like

Some people like to retain more versions. When it comes to defaults that would delete data, the more conservative action is not to enable it.

Ok so, I’ll just run with “yay” for now. It appears that, if I wanted to include my “yay” cache in the paccache.timer periodic cleanup, I can go into /usr/lib/systemd/system/paccache.service and add the following line in bold text

[Unit]
Description=Remove unused cached package files

[Service]
Type=oneshot
ExecStart=/usr/bin/paccache -r
ExecStart=/usr/bin/paccache -r -c ~/.cache/yay/*/

…unless, of course, that runs as root and I have to, therefore, explicitly state where my home yay cache is or else it just cleans the root yay cache…

I’ll do some further reading before I make any changes.
I’ve learned not to play “what if” on system files :wink:

That runs as root.

Use a separate user service to cleanup your home.

1 Like

there is no yay cache in /root folder at all if you use yay properly…
i would add user services in users home path and use --user option to run them in user level…
under: mkdir -p ~/.config/systemd/user/ and starting it like so:
systemctl --user daemon-reload
systemctl --user enable yaycache.service

Understood, was just trying to indicate that I understood running as root means “~” points to that directory…

i should read all before i hit reply…

2 Likes

You would probably create a timer and enable that. The service looks like a oneshot.

yes only as a hint to use --user option :wink:
timers are the way to do this … also for the reason that you may not reboot that often

2 Likes

Well, now I’m kind of wanting to give it a try just for the learning experience. If I get stuck or unsure, I’ll ask for help :wink:

…actually, this doesn’t look like it will be too tricky. Looks like I want to create the .service file and a .timer file for it as well. Since there aren’t nearly as many AURs installed, perhaps monthly will be sufficient.