You are not logged in.

#1 2023-05-08 01:27:51

ltsdw
Member
Registered: 2020-04-20
Posts: 73

[Solved] Untracked /usr/lib/modules/kerver/build/.thinlto-cache files

Hello there, this isn't a issue at all, I just find out recently that, if I create a PKGBUILD for a custom kernel and build this kernel using clang/thinlto, and so dkms will also build modules using clang and place its thinlto cache at /usr/lib/modules/kerver/build/.thinlto-cache. This directory and its files isn't tracked by pacman, and when updating that kernel package it wont remove the /usr/lib/modules/kerver (expected behavior).

Eventually a lot of directories will pile up there, also a error message of dkms will be displayed if it finds a directory at /usr/lib/modules/kerver when it doesn't find a correspondent header (also expected behavior), nothing wrong here too.

I think it's possible to specify to which directory the thinlto cache should go ([1/1] Kbuild, clang: add option for choosing a ThinLTO cache directory), like this:

LDFLAGS="$LDFLAGS --thinlto-cache-dir=some/path/here"

I could probably export LDFLAGS before updating the kernel, but I don't know, it doesn't feel quite right, at least not when using makepkg/pacman instead of manually compiling the modules or manually calling dkms.

My question is what is the right/best approach in this case? Right now I manually remove the directories when I feel like it.

Last edited by ltsdw (2023-05-09 06:29:41)

Offline

#2 2023-05-09 06:29:20

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Untracked /usr/lib/modules/kerver/build/.thinlto-cache files

Ok, ended up creating a little script that checks if the directory /usr/lib/modules/kerver/build/.thinlto-cache exists for a specific kernel version, which I use pacman to query the version, otherwise using uname -r would return the current kernel version, and that one may (or may not) be the kernel that I'm upgrading/removing.

This script is only executed when its parent is pacman in other words when called by a hook (alpm-hooks.5.en) when upgrading/removing "PreTransaction" triggered, for the specific kernel being updated/removed, deleting the .thinltocache directory and then pacman can remove all package related directories.

I think this solution is the better one, it's automatic, will only execute when called by a process of name "pacman", it's simple, so I'll go with it.

Again, thank you smile

Offline

Board footer

Powered by FluxBB