Kernel net.ifnames flags for working net post install

This commit is contained in:
natemaia 2023-01-18 09:45:51 -08:00
parent 2b3903862b
commit c12955753f

View File

@ -2345,6 +2345,10 @@ prerun_grub()
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub"
fi
# fix network interface names changing after reboot
# https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
sed -i 's/\(GRUB_CMDLINE_LINUX=".*\)"/\1 net.ifnames=0"/g' "$MNT/etc/default/grub"
# setup for os-prober module
mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev}
mount --bind /run/lvm "$MNT/hostrun/lvm"
@ -2367,7 +2371,7 @@ prerun_efistub()
{
BCMDS[efistub]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1
efibootmgr -v -d $BOOT_D -p $BOOT_NUM -c -L '${DIST} Linux' -l /vmlinuz-${KERNEL} \
-u 'root=$ROOT_ID rw $(
-u 'root=$ROOT_ID rw net.ifnames=0 $(
[[ $BTRFS_MNT ]] && printf '%s ' "$BTRFS_MNT"
[[ $UCODE ]] && printf 'initrd=\%s.img ' "$UCODE"
)initrd=\initramfs-${KERNEL}.img'"
@ -2427,13 +2431,13 @@ prerun_syslinux()
LABEL $DIST
MENU LABEL $DIST Linux
LINUX $d/vmlinuz-$KERNEL
APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img
LABEL ${DIST}fallback
MENU LABEL $DIST Linux Fallback
LINUX $d/vmlinuz-$KERNEL
APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img
EOF
return 0
@ -2459,14 +2463,14 @@ prerun_systemd-boot()
title $DIST Linux
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
initrd /initramfs-$KERNEL.img
options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
EOF
cat > "$MNT/boot/loader/entries/${DIST,,}-fallback.conf" <<- EOF
title $DIST Linux Fallback
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
initrd /initramfs-$KERNEL-fallback.img
options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT")
EOF
mkdir -pv "$MNT/etc/pacman.d/hooks"
@ -3284,10 +3288,12 @@ al_repo()
cat >> "$conf" <<- EOF
# [archlabs-testing]
# Server = https://pub-7d84e047b852442a86fd6d7feb1ff2cd.r2.dev/\$repo/\$arch
# Server = https://github.com/ArchLabs/\$repo/raw/master/\$arch
# Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch
[archlabs]
Server = https://pub-7d84e047b852442a86fd6d7feb1ff2cd.r2.dev/\$repo/\$arch
Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch
Server = https://github.com/ArchLabs/\$repo/raw/master/\$arch
Server = https://sourceforge.net/projects/archlabs-repo/files/\$repo/\$arch