Skip to content

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

Open
VannTen wants to merge 5 commits into
saber-nyan:masterfrom
VannTen:hardlinks_+_mount
Open

Use hardlinks, bind mount and systemd-tmpfiles to simplify the logic#20
VannTen wants to merge 5 commits into
saber-nyan:masterfrom
VannTen:hardlinks_+_mount

Conversation

@VannTen

@VannTen VannTen commented Jul 11, 2022

Copy link
Copy Markdown

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
Copy Markdown

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

VannTen commented Dec 26, 2022 via email

Copy link
Copy Markdown
Author

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

VannTen commented Feb 8, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown

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

isjerryxiao commented May 30, 2023

Copy link
Copy Markdown

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

@VannTen

VannTen commented May 31, 2023 via email

Copy link
Copy Markdown
Author

@isjerryxiao

Copy link
Copy Markdown

I don't see any file conflict.

@isjerryxiao

isjerryxiao commented May 31, 2023

Copy link
Copy Markdown

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