Petitboot, yet another bootloader based on KEXEC

Post Reply
Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by Moan »

Okay, so I've a small update on this issue:
photo1.png
photo1.png (1.1 MiB) Viewed 251 times
photo2.png
photo2.png (1.21 MiB) Viewed 251 times
It seems like this disk / partition is not visible, until manual re-plug. However, listing USBs with lsusb shows 0bda:9210 which according to the previous output (from the booted Odroid N2) is "Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter". So the USB is visible but doesn't show the disk. I suppose delaying petitboot start by 5 seconds could do some magic, but it's probably not possible.

I tried to connect that NVMe adapter directly to Odroid, but it seems like there are issues when this adapter is connected directly, without the extra-powered HUB. I started copying ~10GB files over SMB from the NVMe partiton, and during the copying process it had 3-4 few seconds pauses. The same thing I observed when I was typing commands in terminal. Sometimes new typed letters weren't showing up, and appeared after short pause. You probably know what I mean since you used Linux a lot :) So in summary, this adapter possibly needs an extra power that the USB Hub gives to it. Otherwise it has periodical lags. I need to use the HUB -> NVMe adapter, otherwise the device is unstable. But this causes booting problem after the full electricity loss and resume.

So maybe I should try the workaround with a USB stick, with a different OS on it that would auto-reboot 60 seconds after start... But it still doesn't give 100% chance that the NVMe adapter would then appear in petitboot.

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by Moan »

I think I successfully workaround this issue for now.

I found out an old BlitzWolf BW-SHP6 10A Wi-Fi plug and I put Odroid power supply to it.
I have the "Tasmota" firmware flashed on it.
In the console, I added:

Code: Select all

PulseTime 150
PowerOnState 5
(the time is in deciseconds, so it's around 15 seconds).

Now, when the power is restored, the WiFi plug stays powered off for over 20-30 seconds (I'm not sure why it's longer, possibly because no Wi-Fi since router is also restarting).
In 3/3 tests I made, the OS from the external NVMe drive started successfully.

Besides that, I also made a script for my old WD My Cloud device with Linux, so that it tries to access the Adguard page on Odroid, and if it's unable to reach it, it power-cycles the WiFi plug:

hotfix_restart_Odroid_N2_after_electricity_loss.sh:

Code: Select all

#!/bin/bash

# chmod +x /DataVolume/hotfix_restart_Odroid_N2_after_electricity_loss.sh
# Fix dos2unix:
# sed -i 's/\r$//' /DataVolume/hotfix_restart_Odroid_N2_after_electricity_loss.sh
# nano /etc/rc2.d/S98user-start :
# ----
# #Tasmota N2 monitor and restart:
# /DataVolume/hotfix_restart_Odroid_N2_after_electricity_loss.sh &
# ----


# Set shell and path variables
SHELL=/bin/bash
PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Log file for debugging
LOGFILE="/DataVolume/hotfix_restart_Odroid_N2_after_electricity_loss.log"

# Target IP addresses
IP1="x"
IP2="y"
# Timeout for curl request in seconds
URL1="http://x:314"
URL2="http://y:314"
CURL_TIMEOUT=3

# Tasmota IP address
TASMOTA_IP="z"

# Ping interval and duration
PING_INTERVAL=20
#PING_DURATION=120
PING_DURATION=90
PING_TIMEOUT=1  # Timeout for each ping request in seconds

# Function to log messages
log() {
	echo "$(date): $1"
    echo "$(date): $1" >> "$LOGFILE"
}

log "Script started."

# Check for responses from the target IP addresses
end_time=$((SECONDS + PING_DURATION))
while [ $SECONDS -lt $end_time ]; do
    #if ping -c 1 -W $PING_TIMEOUT "$IP1" > /dev/null 2>&1 || ping -c 1 -W $PING_TIMEOUT "$IP2" > /dev/null 2>&1; then
        #log "At least one device responded. No need to restart."
        #exit 0
    #fi
	if curl -s --max-time $CURL_TIMEOUT -o /dev/null $URL1 || curl -s --max-time $CURL_TIMEOUT -o /dev/null $URL2; then
    log "At least one URL responded. No need to restart."
    exit 0
	fi
    log "No response yet. Waiting for $PING_INTERVAL seconds."
    sleep $PING_INTERVAL
done

log "No response from both devices after $PING_DURATION seconds. Proceeding with power cycle."

# Turn off the Tasmota outlet
log "Sending Power Off command to Tasmota."
curl -s "http://$TASMOTA_IP/cm?cmnd=Power%20Off"

# Wait before turning it back on
SLEEP_DURATION=5
log "Waiting for $SLEEP_DURATION seconds before turning the power back on."
sleep $SLEEP_DURATION

# Turn on the Tasmota outlet
log "Sending Power On command to Tasmota."
curl -s "http://$TASMOTA_IP/cm?cmnd=Power%20On"

log "Script completed."
Only real-time test will show if it fixed the issue in 100% :)

And yes, I know that I need to protect the Tasmota device with password, so that people on WiFi can't turn off my Odroid, but it's for later :)

pierrehna
Posts: 4
Joined: Fri Jun 28, 2024 12:26 pm
languages_spoken: english
ODROIDs: Odroid n+
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by pierrehna »

Hi, I don't seem to have any version of petitboot bootload anymore for odroid N2+, and the links on the wiki.odroid.com (https://wiki.odroid.com/odroid-n2/os_images/petitboot) don't work (Ce site est inaccessibleppa.linuxfactory.or.kr a mis trop de temps à répondre. / This website is unavailable ppa.linuxfactory.or.kr took too long to respond.), does anyone still have a functionning odroid n2+ version of petitboot ? And how can I install it if I only have a microSD card ?

WondeRien
Posts: 1
Joined: Wed Sep 06, 2023 4:12 pm
languages_spoken: english
ODROIDs: Odroid HC4
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by WondeRien »

Having a lot of trouble to get the Odroid HC4 to boot into Debian.

Tried the installations process 3 times now, successfully installed it.
But then at the end of the process it asks me to reboot and talks about removing installation hardware, whichI shouldn't do since the Debian is installed on the brand new SD card in the Odroid, I assume?
Then I select proceed and it reboots in petitboot, without any drives at the top to select to boot into.

It's a brand new SD card, so shouldn't be an issue.
What could be the problem here?

User avatar
tobetter
Posts: 13404
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 1037 times
Been thanked: 2330 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

WondeRien wrote:
Tue Jul 02, 2024 9:56 pm
Having a lot of trouble to get the Odroid HC4 to boot into Debian.

Tried the installations process 3 times now, successfully installed it.
But then at the end of the process it asks me to reboot and talks about removing installation hardware, whichI shouldn't do since the Debian is installed on the brand new SD card in the Odroid, I assume?
Then I select proceed and it reboots in petitboot, without any drives at the top to select to boot into.

It's a brand new SD card, so shouldn't be an issue.
What could be the problem here?
I am able to boot up Debian 12 after fresh new installation to SD card through Netboot Installer. What's the vendor and model of your SD card?

If you still have the booting issue, please try to flash the images to your SD card and try again.
https://ppa.linuxfactory.or.kr/images/r ... /bullseye/
https://ppa.linuxfactory.or.kr/images/r ... /bookworm/

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 4 guests