From ff401021b34fd6646185e2180b382501aa97db92 Mon Sep 17 00:00:00 2001 From: kguiheux Date: Sat, 25 Mar 2023 12:46:27 +0100 Subject: [PATCH 1/2] Fix: /boot/cmdline.txt with recent kernel version --- RPiOS64-IA-Install.sh | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/RPiOS64-IA-Install.sh b/RPiOS64-IA-Install.sh index 799b82d..70d887e 100644 --- a/RPiOS64-IA-Install.sh +++ b/RPiOS64-IA-Install.sh @@ -108,13 +108,24 @@ iface vmbr0 inet static ========================================================================================= THE HOSTNAMES IN : $YELLOW /etc/hosts $NORMAL WILL BE $RED OVERWRITTEN $NORMAL !!! WITH : 127.0.0.1\tlocalhost -$RPI_IP_ONLY\t$HOSTNAME -========================================================================================= +$RPI_IP_ONLY\t$HOSTNAME" +uname -a | cut -d " " -f 3 | grep -E '6\.[0-9]+\.[0-9]+' +if [ $? != 0 ] +then +printf "========================================================================================= THESE STATEMENTS WILL BE $RED ADDED $NORMAL TO THE $YELLOW /boot/cmdline.txt $NORMAL IF NONE EXISTENT : cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 $YELLOW========================================================================================= #########################################################################################\n $NORMAL " +else +printf "========================================================================================= +THESE STATEMENTS WILL BE $RED ADDED $NORMAL TO THE $YELLOW /boot/cmdline.txt $NORMAL IF NONE EXISTENT : +systemd.unified_cgroup_hierarchy=0 +$YELLOW========================================================================================= +#########################################################################################\n $NORMAL +" +fi #### PROMPT FOR CONFORMATION ############################################################################################################ read -p "YOU ARE OKAY WITH THESE CHANGES ? YOUR DECLARATIONS ARE CORRECT ? CONTINUE ? y / n : " CONFIRM @@ -149,11 +160,24 @@ apt purge -y dhcpcd5 apt autoremove -y #### FIX CONTAINER STATS NOT SHOWING UP IN WEB GUI ####################################################################################### -if [ "$(cat /boot/cmdline.txt | grep cgroup)" != "" ] - then - printf "Seems to be already fixed!" - else - sed -i "1 s|$| cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1|" /boot/cmdline.txt + +# Check if kernel version is over 6.X.X if true add systemd.unified_cgroup_hierarchy=0 else systemd.unified_cgroup_hierarchy=0 in /boot/cmdline.txt +name -a | cut -d " " -f 3 | grep -E '6\.[0-9]+\.[0-9]+' +if [ $? != 0 ] +then + if [ "$(cat /boot/cmdline.txt | grep cgroup)" != "" ] + then + printf "Seems to be already fixed!" + else + sed -i "1 s|$| cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1|" /boot/cmdline.txt + fi +else + if [ "$(cat /boot/cmdline.txt | grep unified_cgroup)" != "" ] + then + printf "Seems to be already fixed!" + else + sed -i "1 s|$| systemd.unified_cgroup_hierarchy=0|" /boot/cmdline.txt + fi fi #### INSTALL PIMOX7 AND REBOOT ########################################################################################################### From c40fbfe605c493c6ac7e807183e8968247469ee6 Mon Sep 17 00:00:00 2001 From: kguiheux Date: Sat, 25 Mar 2023 12:50:53 +0100 Subject: [PATCH 2/2] Fix: quiet grep when checking version --- RPiOS64-IA-Install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RPiOS64-IA-Install.sh b/RPiOS64-IA-Install.sh index 70d887e..b190261 100644 --- a/RPiOS64-IA-Install.sh +++ b/RPiOS64-IA-Install.sh @@ -109,7 +109,7 @@ iface vmbr0 inet static THE HOSTNAMES IN : $YELLOW /etc/hosts $NORMAL WILL BE $RED OVERWRITTEN $NORMAL !!! WITH : 127.0.0.1\tlocalhost $RPI_IP_ONLY\t$HOSTNAME" -uname -a | cut -d " " -f 3 | grep -E '6\.[0-9]+\.[0-9]+' +uname -a | cut -d " " -f 3 | grep -q -E '6\.[0-9]+\.[0-9]+' if [ $? != 0 ] then printf "========================================================================================= @@ -162,7 +162,7 @@ apt autoremove -y #### FIX CONTAINER STATS NOT SHOWING UP IN WEB GUI ####################################################################################### # Check if kernel version is over 6.X.X if true add systemd.unified_cgroup_hierarchy=0 else systemd.unified_cgroup_hierarchy=0 in /boot/cmdline.txt -name -a | cut -d " " -f 3 | grep -E '6\.[0-9]+\.[0-9]+' +name -a | cut -d " " -f 3 | grep -q -E '6\.[0-9]+\.[0-9]+' if [ $? != 0 ] then if [ "$(cat /boot/cmdline.txt | grep cgroup)" != "" ]