Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dkms build leaves empty folders in /usr/lib/modules/KERNEL/build behind #16221

Closed
SoongNoonien opened this issue May 23, 2024 · 11 comments · Fixed by #16241
Closed

dkms build leaves empty folders in /usr/lib/modules/KERNEL/build behind #16221

SoongNoonien opened this issue May 23, 2024 · 11 comments · Fixed by #16241
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@SoongNoonien
Copy link
Contributor

System information

Type Version/Name
Distribution Name Arch Linux
Distribution Version rolling
Kernel Version 6.6.31
Architecture amd64
OpenZFS Version 2.2.4

Describe the problem you're observing

It seems like the dkms build leaves some empty folder tree in /usr/lib/modules/6.6.31-2-lts/build/module behind. I'm not sure if this is an OpenZFS bug or rather an ArchZFS one. But as far as I know they don't do something special with dkms over on ArchZFS. Maybe it could be a problem with dkms itself? In my case this looks something like that (no folder actually contains any files):

/usr/lib/modules/6.6.31-2-lts/build/module# ls
insgesamt 13K
drwxr-xr-x  3 root root  3 23. Mai 18:23 avl
drwxr-xr-x 12 root root 12 23. Mai 18:23 icp
drwxr-xr-x  3 root root  3 23. Mai 18:23 lua
drwxr-xr-x  3 root root  3 23. Mai 18:23 nvpair
drwxr-xr-x  4 root root  4 23. Mai 18:23 os
drwxr-xr-x  3 root root  3 23. Mai 18:23 unicode
drwxr-xr-x  3 root root  3 23. Mai 18:23 zcommon
drwxr-xr-x  3 root root  3 23. Mai 18:23 zfs
drwxr-xr-x  4 root root  4 23. Mai 18:23 zstd

This has the unwanted side effect that the package manager won't remove old directories under /usr/lib/modules on kernel updates.

Describe how to reproduce the problem

Build the zfs kernel module via dkms.

Include any warning/errors/backtraces from the system logs

Unfortunately there are none.

@SoongNoonien SoongNoonien added the Type: Defect Incorrect behavior (e.g. crash, hang) label May 23, 2024
@SoongNoonien
Copy link
Contributor Author

Ok, I've looked a little closer and the folders are actually not empty. Probably this is the reason why they aren't removed. There are hidden folders named .deps which contain multiple "dummy" file:

/usr/lib/modules/6.6.31-2-lts/build/module/zfs/.deps$ ls
insgesamt 61K
-rw-r--r-- 1 root root 8 23. Mai 18:23 libicp_la-zfs_impl.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-abd.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-aggsum.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-arc.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-blake3_zfs.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-blkptr.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-bplist.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-bpobj.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-bptree.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-bqueue.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-brt.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-btree.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dbuf.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dbuf_stats.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-ddt.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-ddt_zap.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_diff.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_object.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_objset.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_recv.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_redact.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_send.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_traverse.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_tx.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dmu_zfetch.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dnode.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dnode_sync.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_bookmark.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_crypt.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_dataset.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_deadlist.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_deleg.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_destroy.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_dir.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_pool.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_prop.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_scan.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_synctask.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-dsl_userhold.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-edonr_zfs.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-fm.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-gzip.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-hkdf.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-lz4.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-lz4_zfs.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-lzjb.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-metaslab.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-mmp.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-multilist.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-objlist.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-pathname.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-range_tree.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-refcount.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-rrwlock.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-sa.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-sha2_zfs.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-skein_zfs.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-space_map.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-space_reftree.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_checkpoint.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_config.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_errlog.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_history.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_log_spacemap.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_misc.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-spa_stats.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-txg.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-uberblock.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-unique.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_draid.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_draid_rand.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_indirect_births.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_indirect_mapping.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_indirect.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_initialize.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_label.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_mirror.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_missing.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_queue.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_aarch64_neon.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_aarch64_neonx2.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_avx2.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_avx512bw.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_avx512f.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_powerpc_altivec.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_scalar.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_sse2.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz_math_ssse3.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_raidz.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_rebuild.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_removal.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_root.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-vdev_trim.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zap_leaf.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zap_micro.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zap.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp_get.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp_global.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp_iter.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp_set.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zcp_synctask.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfeature.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_byteswap.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_chksum.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_fm.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_fuid.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_ratelimit.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_rlock.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zfs_sa.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zil.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zio_checksum.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zio_compress.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zio_inject.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zio.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zle.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zrlock.Plo
-rw-r--r-- 1 root root 8 23. Mai 18:23 libzpool_la-zthr.Plo

This is the content of such a file:

/usr/lib/modules/6.6.31-2-lts/build/module/zfs/.deps$ cat libzpool_la-zthr.Plo 
# dummy

@AllKind
Copy link
Contributor

AllKind commented May 25, 2024

Probably this is the reason why they aren't removed. There are hidden folders named .deps which contain multiple "dummy" file:

Yes that is the reason the folder(s) won't get removed.
Looks to me more like a package manager thing, than a dkms thing.
Most likely not a ZFS thing.

@SoongNoonien
Copy link
Contributor Author

Looks to me more like a package manager thing, than a dkms thing.

I'm not sure how this can be a package manager issue when those files aren't even part of the package database:

$ pacman -Qo /usr/lib/modules/6.6.31-2-lts/build/module/zfs/.deps/libzpool_la-zthr.Plo
error: No package owns /usr/lib/modules/6.6.31-2-lts/build/module/zfs/.deps/libzpool_la-zthr.Plo

That these .../build/module/... folders aren't removed on a kernel update is the intended behavior if they contain files not tracked by the package manager. But that they contain untracked files is what I consider to be a zfs or dkms issue. These files appear when the zfs kernel modules are built via dkms and remain there indefinitely.

@AllKind
Copy link
Contributor

AllKind commented May 25, 2024

Personally I'm on a Mint (ubuntu based) and still on 2.1.15 maybe there's a difference to a 2.2.x release.
But I use dkms and do not have those .Plo files in /lib/modules or /usr/src.
But I found them below the git source tree.
Googling what they are seems this is correct:

.Plo files are generated outputs of an Automake- and libtool-basedbuild system

How they end up on your system under /usr/lib/modules I don't know - sorry.

@SoongNoonien
Copy link
Contributor Author

Personally I'm on a Mint (ubuntu based) and still on 2.1.15 maybe there's a difference to a 2.2.x release.

It worked for me until 2.2.3 and started to break after the update to 2.2.4.

Googling what they are seems this is correct:

.Plo files are generated outputs of an Automake- and libtool-basedbuild system

Yes, I found this as well.

How they end up on your system under /usr/lib/modules I don't know - sorry.

They end up under /usr/lib/modules when dkms builds the kernel modules. But they should be cleaned afterwards as they are just some temp data use while compiling. At least as far as I understand this.

@SoongNoonien
Copy link
Contributor Author

But I found them below the git source tree.

Where did you find them in the git source tree?

@AllKind
Copy link
Contributor

AllKind commented May 26, 2024

Sorry if I wasn't clear.
In my local git repo, where I build ZFS for my personal computer.

@SoongNoonien
Copy link
Contributor Author

Ok, yes, this makes sense.

@AllKind
Copy link
Contributor

AllKind commented May 26, 2024

From what source did you install the zfs-dkms package?
From what I know (and I took a quick look again) OpenZFS only has native support for building rpm and debian packages.
As from the quick look I took, the creation and entries for deletion (in the resulting Makefile(s)) of the .Plo files is entirely handled by autotools.
I'm not saying it is, but I wonder if maybe the maintainer of the Arch package accidentally included the .Plo files in the Arch package for the 2.2.4 release?

@SoongNoonien
Copy link
Contributor Author

From what source did you install the zfs-dkms package?

archzfs.com

From what I know (and I took a quick look again) OpenZFS only has native support for building rpm and debian packages.

Yes, but building a dkms config is also support, which is what archzfs does.

I'm not saying it is, but I wonder if maybe the maintainer of the Arch package accidentally included the .Plo files in the Arch package for the 2.2.4 release?

No, this is not the case as I've stated above these files are not part of the package database. But here is a list of all files contained in the zfs-dkms package:
files.txt

@SoongNoonien
Copy link
Contributor Author

Over on dkms I got the answer that this is caused by automake. I'll open a PR with the suggested fix, though I'm not sure if this has any unwanted side effects.

robn pushed a commit to robn/zfs that referenced this issue Jul 18, 2024
Previously the dkms build left some unwanted files
in `/usr/lib/modules` which could cause package
managers to not properly clean up old kernels.

Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Martin Wagner <[email protected]>
Closes openzfs#16221 
Closes openzfs#16241
lundman pushed a commit to openzfsonwindows/openzfs that referenced this issue Sep 4, 2024
Previously the dkms build left some unwanted files
in `/usr/lib/modules` which could cause package
managers to not properly clean up old kernels.

Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Martin Wagner <[email protected]>
Closes openzfs#16221 
Closes openzfs#16241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants