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

Adjust installation for Red Hat based distributions #461

Merged
merged 1 commit into from
Nov 30, 2024
Merged

Conversation

scaronni
Copy link
Collaborator

Fix for cleaning up the kernel modules when a kernel is uninstalled

The trigger for the removal of DKMS modules in Red Hat based distributions happens when the kernel-core package is removed. That package contains no modules, so also the modules.dep is already gone at the moment of the trigger.

This makes the check for unbuild fail because the main DKMS script is not able to get the compression method used for the modules from the modules.dep file. So get the compression method by looking at modules in the kernel folder, which can either be distribution provided modules or the remaining DKMS modules when the distribution modules have disappeared already.

Reduce installation scripts and redirects

Red Hat based systems using kernel-install from systemd, do not use the prerm.d and postinst.d folders.

So instead of lots of redirects and links, use a different /usr/lib/kernel/install.d/40-dkms.install file on Red Hat based systems that is much simpler and self contained and drop all these files and folders:

/etc/kernel/postinst.d/
/etc/kernel/postinst.d/dkms
/etc/kernel/prerm.d/
/etc/kernel/prerm.d/dkms
/usr/lib/dkms/
/usr/lib/dkms/common.postinst
/usr/lib/dkms/dkms_autoinstaller

Other small stuff

Remove the executable bit from include files in the repositories, reduce the scope of the rm commands during make clean.

@scaronni
Copy link
Collaborator Author

Thanks!

@scaronni scaronni merged commit dacf2a8 into master Nov 30, 2024
56 checks passed
@scaronni scaronni deleted the redhat branch November 30, 2024 07:49
@iamandrii
Copy link

Hello, what was the reason to delete file /usr/lib/dkms/common.postinst?

We used this file in our postinstall phase in order to notify dkms about kernel module that we supply.

Now it is removed, and I do not understand correctly the reason behind this in the scope of the PR. Looks like it was a mistake?

iamandrii added a commit to iamandrii/dattobd that referenced this pull request Dec 11, 2024
Dell introduced a logic-breaking change in dell/dkms#461 which led to incorrect DattoBD installation behavior on RHEL systems. This patch has a small workaround to deal with that.
@scaronni
Copy link
Collaborator Author

Hello, the file has not been deleted, just not installed anymore with the install-redhat target as I know it's pretty entangled in some Debian packages. The same functionality can be achieved with:

%post
dkms add -m %{dkms_name} -v %{version} -q --rpm_safe_upgrade || :
# Rebuild and make available for the currently running kernel:
dkms build -m %{dkms_name} -v %{version} -q || :
dkms install -m %{dkms_name} -v %{version} -q --force || :

%preun
# Remove all versions from DKMS registry:
dkms remove -m %{dkms_name} -v %{version} -q --all --rpm_safe_upgrade || :

I can also add it back, that's not an iusse, but I think it's pretty redundant.

I've looked at the issues linked there and I have the impression the SPEC files are a bit too complicated in that regard. Is there any reason why you can't use the above snippet? Thanks.

iamandrii added a commit to iamandrii/dattobd that referenced this pull request Dec 12, 2024
Improved stability of DKMS workaround as it was proposed in dell/dkms#461
@scaronni
Copy link
Collaborator Author

@iamandrii maybe I was not clear enough, but I think you can replace your entire %post and %preun/%postun sections for the DKMS module with the snippet I pasted.

@iamandrii
Copy link

Hello, @scaronni.

Thank you for the snippet provided, for now I've just included workaround to work with the change (I am a bit worried about impact on older versions of DKMS, I have to investigate that first).

In general, I was concerned about the change at all, because as far as I understand, common.postinst was so-called "safe API" for all of the systems and all of the DKMS configurations. Now this was changed, and I guess a lot of .spec files might be broken as a result of the lack of the file.

IMHO, in case of such a changes it would be better to provide something like a placeholder file that only does the three commands you mentioned, as it would prevent unwanted breaks.

@scaronni
Copy link
Collaborator Author

Thank you for the snippet provided, for now I've just included workaround to work with the change (I am a bit worried about impact on older versions of DKMS, I have to investigate that first).

That script just calls dkms commands, so you can just call the commands instead,

IMHO, in case of such a changes it would be better to provide something like a placeholder file that only does the three commands you mentioned, as it would prevent unwanted breaks.

It has been readded.

iamandrii added a commit to iamandrii/dattobd that referenced this pull request Dec 19, 2024
Dell introduced a logic-breaking change in dell/dkms#461 which led to incorrect DattoBD installation behavior on RHEL systems. This patch has a small workaround to deal with that.
iamandrii added a commit to iamandrii/dattobd that referenced this pull request Dec 19, 2024
Improved stability of DKMS workaround as it was proposed in dell/dkms#461
iamandrii added a commit to datto/dattobd that referenced this pull request Dec 19, 2024
* Rewrote priorities of blk_alloc_queue variants (#5)

`blk_alloc_queue` had problems with correct priorities of definitions being used, which led to usage of `blk_alloc_queue(NUMA_NO_NODE)` instead of `blk_alloc_queue(GFP_KERNEL)` in some specific cases.

* Kernel 6.X support (#7)

* Implemented struct bdev_handle to replace it on older kernels; Modified fields of snap_device and surrounding functions to use bdev_handle instead of block_device.

* Modified bdev_freeze/thaw references according to Kernel 6.8

* Added emulation of debian/control file for Ubuntu 24.04 LTS

* Discovered that dpkg-gensymbols looks for debian/control only in current directory

* Fixed includes to handle bdev_handle correctly

* Kernel 6.6+ uses super_block as block_device holder

* Tracer destroy now destroys bdev_handle correctly

* Added vm_area_struct_vm_lock feature test

* Made functions inside cow_get_file_extents to return correct error codes, not shadowed ones

* Added test for vma_lock cache area

* Added vm_lock initialization during page stealing at cow_get_file_extents

* Fixed symbol test newline

* Renamed dattobd_blkdev_by_path so we will have correct prefix

dattobd_blkdev_by_path was previously named dattodb_blkdev_by_path, which is incorrect, as our module is called dattobd.

* Fixed symbol-tests again

It used CRLF instead of LF which led to incorrect behavior

* Patch to support Rocky 9.5

* Fix usage of old filp

* Version bump

* Patch to have a workaround with DKMS bug

Dell introduced a logic-breaking change in dell/dkms#461 which led to incorrect DattoBD installation behavior on RHEL systems. This patch has a small workaround to deal with that.

* Improved stability of DKMS workaround

Improved stability of DKMS workaround as it was proposed in dell/dkms#461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants