I want to run wireguard in initrd. My config is very similar to the one in the wiki.
I have access to a tty shell in the initrd. I can see this error:
-bash-5.3# journalctl -b | grep -e "wg0"
Dec 15 18:03:59 myhost systemd-networkd[201]: wg0: Failed to read private key from '/etc/secrets/initrd/50-wg0.key', ignoring network device: Permission denied
I can confirm that the file /etc/secrets/initrd/50-wg0.key actually exists in the initrd.
-bash-5.3# ls -lisa /etc/secrets/initrd/
total 8
1568 0 drwxr-xr-x 2 root root 0 Dec 15 18:03 .
1567 0 drwxr-xr-x 3 root root 0 Dec 15 18:03 ..
1571 4 -rw------- 1 root root 45 Dec 15 18:03 50-wg0.key
1569 4 -rw------- 1 root root 411 Dec 15 18:03 ssh_host_ed25519_key
That’s why I believe it is a permission-related issue, kind of like over here, except that working in the initrd makes everything more complicated.
What’s the best way to fix this without starting to use a new system likes sops/age/…. ?
Any advice is appreciated.