#4694 hdd detection fix (#4728)

* call resolvconf native path
* only fatpack with lcd when called by command
* repair ssh
* hdd minimum size 130 gb
* detectVM
This commit is contained in:
/rootzoll 2024-09-12 16:02:42 +02:00 committed by GitHub
parent d816282ab6
commit e6a8753212
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 18 deletions

View File

@ -45,14 +45,9 @@ echo "***********************************************" >> $logFile
# list all running systemd services for future debug
systemctl list-units --type=service --state=running >> $logFile
# check if the file /etc/ssh/sshd_init_keys exists --> initial boot of fresh sd card image
if [ -f "/etc/ssh/sshd_init_keys" ]; then
echo "# init SSH KEYS fresh for new user" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh init >> $logFile
else
echo "# make sure SSH server is configured & running" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh checkrepair >> $logFile
fi
# make sure ssh is configured and running
echo "# make sure SSH server is configured & running" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh checkrepair >> $logFile
echo "## prepare raspiblitz temp" >> $logFile
@ -86,6 +81,12 @@ ln_cl_mainnet_sync_initial_done=0
ln_cl_testnet_sync_initial_done=0
ln_cl_signet_sync_initial_done=0
# detect VM
vm=0
if [ $(systemd-detect-virt) != "none" ]; then
vm=1
fi
# load already persisted valued (overwriting defaults if exist)
source ${infoFile} 2>/dev/null
@ -96,6 +97,7 @@ echo "setupPhase=${setupPhase}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
echo "baseimage=${baseimage}" >> $infoFile
echo "cpu=${cpu}" >> $infoFile
echo "vm=${vm}" >> $infoFile
echo "blitzapi=${blitzapi}" >> $infoFile
echo "displayClass=${displayClass}" >> $infoFile
echo "displayType=${displayType}" >> $infoFile
@ -131,8 +133,9 @@ echo "# raspi_bootdir(${raspi_bootdir})" >> $logFile
flagExists=$(ls ${raspi_bootdir}/stop 2>/dev/null | grep -c 'stop')
if [ "${flagExists}" == "1" ]; then
# set state info
localip=$(hostname -I | awk '{print $1}')
/home/admin/_cache.sh set state "stop"
/home/admin/_cache.sh set message "stopped for manual provision"
/home/admin/_cache.sh set message "stopped for manual provision ${localip}"
systemctl stop background.service
systemctl stop background.scan.service
# log info
@ -284,7 +287,6 @@ source <(/home/admin/config.scripts/blitz.datadrive.sh status)
################################
echo "Waiting for HDD/SSD ..." >> $logFile
ls -la /etc/ssh >> $logFile
until [ ${isMounted} -eq 1 ] || [ ${#hddCandidate} -gt 0 ]
do

View File

@ -230,21 +230,29 @@ if [ "$1" = "status" ]; then
echo "hddTemperature="
echo "hddTemperatureStr='?°C'"
# display results from hdd & partition detection
echo "hddCandidate='${hdd}'"
hddBytes=0
hddGigaBytes=0
if [ "${hdd}" != "" ]; then
hddBytes=$(fdisk -l /dev/$hdd | grep GiB | cut -d " " -f 5)
if [ "${hddBytes}" = "" ]; then
hddBytes=$(fdisk -l /dev/$hdd | grep TiB | cut -d " " -f 5)
hddBytes=$(fdisk -l /dev/$hdd | grep TiB | cut -d " " -f 5)
fi
hddGigaBytes=$(echo "scale=0; ${hddBytes}/1024/1024/1024" | bc -l)
fi
# check if big enough
if [ ${hddGigaBytes} -lt 130 ]; then
echo "# Found HDD '${hdd}' is smaller than 130GB"
hdd=""
hddDataPartition=""
fi
# display results from hdd & partition detection
echo "hddCandidate='${hdd}'"
echo "hddBytes=${hddBytes}"
echo "hddGigaBytes=${hddGigaBytes}"
echo "hddPartitionCandidate='${hddDataPartition}'"
# if positive deliver more data
if [ ${#hddDataPartition} -gt 0 ]; then
# check partition size in bytes and GBs

View File

@ -86,10 +86,9 @@ fi
echo
echo "deleting SSH Pub keys ..."
echo "keys will get recreated and sshd reactivated on fresh bootup, by _bootstrap.sh service"
sudo systemctl stop sshd
sudo systemctl disable sshd
sudo systemctl stop ssh
sudo systemctl disable ssh
sudo rm /etc/ssh/ssh_host_*
sudo touch ${raspi_bootdir}/ssh
echo "OK"
echo

View File

@ -52,6 +52,7 @@ if [ "$1" = "init" ]; then
rm /etc/ssh/sshd_init_keys
echo "# restart sshd"
systemctl enable ssh
systemctl restart sshd
if [ $? -gt 0 ]; then
echo "error='sshd restart failed'"
@ -138,7 +139,8 @@ if [ "$1" = "checkrepair" ]; then
if [ ${sshdRunning} -eq 0 ]; then
echo "# DETECTED: SSHD NOT RUNNING --> Try reconfigure & kickstart again"
sudo dpkg-reconfigure openssh-server
sudo systemctl restart sshd
sudo systemctl enable ssh
sudo systemctl restart ssh
sleep 3
fi