dracut icon indicating copy to clipboard operation
dracut copied to clipboard

`/etc/machine-id` included with wrong permissions, leading to unconfigurable networking

Open oddlama opened this issue 3 years ago • 0 comments

Describe the bug Configuring networking via systemd-networkd and a trivial dhcp config fails with the following log messages:

systemd-networkd: DHCPv4 client: Failed to set DUID-EN/Vendor: Permission denied
systemd-networkd: DHCPv4 CLIENT: Failed to set IAID+DUID: Permission denied

(These messages only appear when setting SYSTEMD_LOGLEVEL=debug for systemd-networkd). After some time I figured out that the message was in fact not related to configuring the interface but because /etc/machine-id was included into the image as 600 -rw------- instead of 444 -r--r--r--. Fixing the permissions on that file resolves the networking problems.

I did some further testing and determined that dracut assumes the user has an umask of 022 - but I have 077. This caused /etc/machine-id to be included as mode 600. I think dracut should set it's own umask before doing any file creation to ensure its assumptions hold up.

Distribution used Gentoo.

Dracut version dracut-056

Init system systemd

To Reproduce Include systemd-networkd and use a config like:

[Match]
Name=e*
[Network]
DHCP=yes

Expected behavior Dracut should include files with the correct permissions regardless of the user's umask value.

oddlama avatar Jul 03 '22 19:07 oddlama