You are not logged in.
Hello.
according to https://wiki.archlinux.org/index.php/Dm … _initramfs I need to "chmod 600" the initramfs, because there is a keyfile inside. Unfortunately after every initramfs update the permission is set back to 644. So how to automate the "chmod 600 ..."?
I tried a pacman hook like
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = /usr/lib/modules/*/vmlinuz
Target = /usr/lib/initcpio/*
[Action]
Description = Updating initramfs permission...
When = PostTransaction
Exec = chmod 600 /boot/initramfs-linux*
NeedsTargetsbut this hook never applies after the initramfs changes. How do I make this hook work?
Last edited by equalizer876 (2021-02-16 17:33:51)
Offline
Systemd unit files aren't bash scripts, the command in your Exec= line isn't being parsed how you think it is....
Offline
Thanks I forgot about that. Then I would need to do
Exec = /bin/bash -c 'chmod 600 /boot/initramfs-linux*'Well, but it still wouldn't get called. When pacman -Syu updated "linux" then I never saw the past transaction hook with description "Updating initramfs permission...".
Offline
Paths refer to the files in the package archive; the installation root should not be included in the path.
You also don't need NeedsTargets
Offline
I changed the hook, but it still doesn't get triggered.
It's placed inside /etc/pacman.d/hooks
Last edited by equalizer876 (2021-01-30 11:41:28)
Offline
Does the filename end in .hook can you post the updated hook ?
Offline
/etc/pacman.d/hooks/initramfs_update.hook
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = /boot/initramfs-linux*
Target = /usr/lib/modules/*/vmlinuz
Target = /usr/lib/initcpio/*
[Action]
Description = Updating initramfs permission...
When = PostTransaction
Exec = /bin/bash -c 'chmod 600 /boot/initramfs-linux*'Offline
What apg wanted to point out with his quote was that your target paths should not include the root, so your Target definitions should look like:
Target = usr/lib/modules/*/vmlinuz
Target = usr/lib/initcpio/*note the lack of a leading /
Offline
Thanks. I will try next time.
Now it works!
Last edited by equalizer876 (2021-02-16 17:34:04)
Offline