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

Use hardlinks, bind mount and systemd-tmpfiles to simplify the logic #20

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

VannTen
Copy link

@VannTen VannTen commented Jul 11, 2022

Hi folks,

I propose to simplify the logic by relying on bind mount and systemd-tmpfiles
instead of cleaning up ourselves.

High-level view of new workflow :

On kernel upgrade / or removal :

  • cp the whole /usr/lib/modules/$(kver) tree using hardlinks before the
    transaction to /usr/lib/modules/backup-$(kver)
  • after the transaction, bind mount /usr/lib/modules/backup-$(kver) to
    /usr/lib/modules/$(kver)
  • On next boot, bind mount is gone so :
    -> we delete recursively dir matching /usr/lib/modules/backup-*
    -> we delete empty dir matching /usr/lib/modules/* (installed kernel is not
    emtpy so it will not be deleted, but the mount point for the old kernel is)

That's a pretty big change ; I'm ok forking if you think it does not fit that
project.

Thanks.

@isjerryxiao
Copy link

Brilliant idea. But there's one little flaw: what if the user would like to revert back to the running kernel without a reboot? The bind mounted old kernel would essentially block the downgrade path.

@VannTen
Copy link
Author

VannTen commented Dec 26, 2022 via email

This looks wrong to ignore files in the repostory.
The Unlicense license is include in the licenses packages, not need to
include it.
@VannTen VannTen force-pushed the hardlinks_+_mount branch 2 times, most recently from 9497d34 to cfa301a Compare February 8, 2023 16:01
@VannTen
Copy link
Author

VannTen commented Feb 8, 2023

Hi o/

So I reworked a bit the hooks:

The pre-hook:

  • check if the path exist -> detect whether we install or remove
  • only copy if the copy does not exist yet (multiple install/uninstall case)
  • checks if there is already a mount only when triggered by "Install" (-> the case where the user reinstall the running kernel after having installed another version)
  • Also, we only copy the kernel/ directy and all modules* files, which should supersede Skip pkgbase file on save/restore #12 (when other scripts have problem with duplicate pkgbase)

WARNING: I haven't tested it yet.

Thoughts ?

@VannTen VannTen force-pushed the hardlinks_+_mount branch 2 times, most recently from 7768fbc to 401c1fe Compare February 9, 2023 21:35
@isjerryxiao
Copy link

Great job!

This use cp with hardlinks + a bind mount for keeping the removed kernel
modules accessible.
Cleaning up the backup is done by systemd-tmpfiles on next boot.
Cleaning up the mount is either done on shutdown implicitly, or when we
reinstall the running kernel by the pre-hook script.

No systemd service enabling is needed.
@isjerryxiao
Copy link

isjerryxiao commented May 30, 2023

Your script is faulty in several ways
fix: archlinux-jerry/pkgbuilds@512e59c and archlinux-jerry/pkgbuilds@d49e711

@VannTen
Copy link
Author

VannTen commented May 31, 2023 via email

@isjerryxiao
Copy link

I don't see any file conflict.

@isjerryxiao
Copy link

isjerryxiao commented May 31, 2023

should have removed the mount point after umount
archlinux-jerry/pkgbuilds@f69c1ab

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.

2 participants