2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-12 11:06:17 +00:00

Merge pull request #377 from Obihoernchen/fix/diskless-lvm-autoactivation

Do not autoactivate LVM on local disks on diskless boot
This commit is contained in:
Jarrod Johnson
2026-11-09 15:38:42 -05:00
committed by GitHub
8 changed files with 32 additions and 0 deletions
@@ -159,6 +159,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
if [ -x /sysroot/usr/sbin/matchpathcon ] && grep -Eq '^SELINUX=(enforcing|permissive)' /sysroot/etc/selinux/config 2> /dev/null; then
# Files written to /sysroot before policy load are unlabeled.
selinuxpolicy=$(sed -n 's/^SELINUXTYPE=//p' /sysroot/etc/selinux/config)
@@ -133,6 +133,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
if grep installtodisk /proc/cmdline > /dev/null; then
. /etc/confluent/functions
run_remote installimage
@@ -137,6 +137,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
if [ -x /sysroot/usr/sbin/matchpathcon ] && grep -Eq '^SELINUX=(enforcing|permissive)' /sysroot/etc/selinux/config 2> /dev/null; then
# Files written to the upper layer before policy load are unlabeled.
# Label only those, using globstar since the initramfs has no find.
@@ -161,6 +161,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
rm -f /sysroot/etc/dracut.conf.d/diskless.conf # remove diskless dracut from runtime, to make kdump happier
if [ -x /sysroot/usr/sbin/matchpathcon ] && grep -Eq '^SELINUX=(enforcing|permissive)' /sysroot/etc/selinux/config 2> /dev/null; then
# Files written to /sysroot before policy load are unlabeled.
@@ -121,6 +121,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
nameserversec=0
nameservers=""
@@ -121,6 +121,10 @@ if [ ${#machineid} -eq 32 ]; then
echo $machineid > /sysroot/etc/machine-id
chmod 444 /sysroot/etc/machine-id
fi
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
# Hand NetworkManager the connection the initramfs is already using. Without
# this it claims the interface on its own terms and the tethered root
@@ -7,3 +7,7 @@ if ! grep console= /proc/cmdline > /dev/null; then
fi
fi
echo . /scripts/init-premount/confluent >> /scripts/init-premount/ORDER
# Same as imageboot.sh, but for the lvm2 udev rules in this initramfs
if [ -e /etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /etc/lvm/lvm.conf /etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /etc/lvm/lvmlocal.conf
fi
@@ -208,6 +208,10 @@ else
hostname | sha512sum | head -c 32 > /sysroot/etc/machine-id
fi
echo >> /sysroot/etc/machine-id
# Do not autoactivate LVM on local disks unless the image sets auto_activation_volume_list
if [ -e /sysroot/etc/lvm/lvm.conf ] && ! grep -qs '^[[:space:]]*auto_activation_volume_list' /sysroot/etc/lvm/lvm.conf /sysroot/etc/lvm/lvmlocal.conf; then
printf 'activation {\n\tauto_activation_volume_list = []\n}\n' >> /sysroot/etc/lvm/lvmlocal.conf
fi
ipv4=$(grep ^ipv4_address: /etc/confluent/confluent.deploycfg | awk '{print $2}')
ipv4method=$(grep ^ipv4_method: /etc/confluent/confluent.deploycfg | awk '{print $2}')
ipv4gateway=$(grep ^ipv4_gateway: /etc/confluent/confluent.deploycfg | awk '{print $2}')