mirror of
https://github.com/xcat2/confluent.git
synced 2026-11-19 17:02:22 +00:00
Do not autoactivate LVM on local disks on diskless boot
An old stateful OS on LVM was activated at diskless boot and kept the disk busy, so repartitioning it for scratch failed. Set an empty auto_activation_volume_list unless the image sets one. Ubuntu also needs it in the initramfs, whose udev rules activate LVM earlier.
This commit is contained in:
@@ -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}')
|
||||
|
||||
Reference in New Issue
Block a user