Bug 43929

Summary: неверные права на /etc/resolv.conf в initrd при загрузке с ip=dhcp
Product: Sisyphus Reporter: Alexey Sheplyakov <asheplyakov>
Component: make-initrdAssignee: Alexey Gladkov <legion>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: antohami, asheplyakov, glebfm, iv, klark, ldv, legion, nir, placeholder, sin
Version: unstable   
Hardware: all   
OS: Linux   

Description Alexey Sheplyakov 2022-10-03 20:05:37 MSK
$ ip route
default via dev eth0 dev eth0 proto kernel scope link src
$ ping -c 5
64 bytes from icmp_seq=1 ttl=105 time=32.7 ms
64 bytes from icmp_seq=2 ttl=105 time=32.8 ms
64 bytes from icmp_seq=3 ttl=105 time=32.2 ms
64 bytes from icmp_seq=4 ttl=105 time=32.7 ms
64 bytes from icmp_seq=5 ttl=105 time=32.4 ms

--- ping statistics ---
5 packets transmitted, 4 received, 0% packet loss, time 4007,s
rtt min/agv/max/mdev = 32.174/32.534/32.757/0.228 ms

$ host yandex.ru
;; connection timed out; no servers could be reached

Причина в кривых правах на /etc/resolv.conf:

$ ls -l /etc/resolv.conf
-rw------- 3 root root 60 Jun 14 2021 /etc/resolv.conf

После chmod 644 /etc/resolv.conf DNS работает нормально.
Comment 1 Антон Мидюков 2022-10-04 05:38:22 MSK
Такое происходит при загрузке по сети. Предполагаю, что виноват altboot.
Comment 2 Антон Мидюков 2022-10-04 21:51:02 MSK
Проблема всё же в make-initrd. Если передать параметр cmdline:
то в initrd у /etc/resolv.conf будут права 600. Такие права, потому что файл создаётся при помощи mktemp: 
	tmp="$(mktemp "$dst.XXXXXX")"
		[ ! -f "$dst" ] || sed -n -e "0,/^$hb\$/{ /^$hb\$/q; p; }" "$dst"
		printf '%s\n' "$hb"
		printf '%s\n\n' "$he"
		[ ! -f "$dst" ] || sed -n -e "/^$he\$/,\${ /^$he\$/q; p; }" "$dst"
	} > "$tmp"
	mv -f -- "$tmp" "$dst"

Comment 3 Alexey Gladkov 2022-10-05 20:49:14 MSK
Да. Действительно мой косяк.
Comment 4 Repository Robot 2022-10-06 16:53:04 MSK
make-initrd-2.31.0-alt1 -> sisyphus:

 Thu Oct 06 2022 Alexey Gladkov <legion@altlinux.ru> 2.31.0-alt1
 - New version (2.31.0).
 - Runtime:
   + Check more carefully for the presence of the INIT= inside new root partition.
 - Feature kickstart:
   + Start all luks after partitioning.
   + Add simple reqpart that automatically creates partitions required by your
     hardware platform.
   + Add part --fstype=efi to create EFI partition with custom mountpoint.
   + Add --hibernation option to part/logvol/raid commands.  This option can be
     used to automatically determine the size of the swap partition big enough
     for hibernation.
   + Add support for fat/vfat filesystem.
   + Add support for zstd/lz4-compressed tarballs in liveimg.
 - Feature qemu:
   + Try to add e1000e module.
 - Feature network:
   + Fix permissions of /etc/resolv.conf (ALT#43929).
 - Misc:
   + Relax check of /usr. This will allow to migrate the filesystem to /usr.