Mounted root does not match boot loader environment

Hi Everyone,

I’m relatively new here and have been unable to find a solution in previous posts, or maybe I’m just not grasping them fully.

I’m currently working with a Raspberry Pi 4 running Yocto (scartchgap release) and Mender for OTA updates. I’ve been trying to run an update locally and encountering errors during the commit phase. Running in a Raspberry Pi 4 Compute Module.

Issue: When I attempt to install and commit a locally stored update package using the following commands:

sudo mender-update install update.mender
sudo mender-update commit

I receive these errors:

raspberrypi4-64:/data$ sudo mender-update commit                                                               
record_id=1 severity=info time="2024-Sep-02 15:04:43.366397" name="Global" msg="Update Module output (stderr): Mounted root does not match boot loader environment (/dev/mmcblk0p3)!" 
record_id=2 severity=error time="2024-Sep-02 15:04:43.367122" name="Global" msg="Commit failed: Process returned non-zero exit status: ArtifactCommit: Process exited with status 1" 
Installation failed. Rolled back modifications.

The partition layout is as follows:

raspberrypi4-64:~$ lsblk 
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0      179:0    0 14.6G  0 disk 
|-mmcblk0p1  179:1    0  256M  0 part /uboot
|-mmcblk0p2  179:2    0  2.5G  0 part /
|-mmcblk0p3  179:3    0  2.5G  0 part 
`-mmcblk0p4  179:4    0  9.3G  0 part /data
mmcblk0boot0 179:32   0    4M  1 disk 
mmcblk0boot1 179:64   0    4M  1 disk 

My Local.config

#INHERIT += "rm_work"

# TODO: Check if that's ok
LICENSE_FLAGS_ACCEPTED += "synaptics-killswitch"

MACHINE ??= "raspberrypi4-64"

# From fleet provisioning video
DISABLE_VC4GRAPHICS = "1"


# Parallelism Options
BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count() - 2}"
PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count() - 2}"

PACKAGE_CLASSES ?= "package_deb"

PACKAGECONFIG:append:pn-qemu-system-native = " sdl"

EXTRA_IMAGE_FEATURES ?= "ssh-server-openssh"


# RASPBERRY CONFIG
RPI_USE_U_BOOT = "1"

do_image_sdimg[depends] += " rpi-bootfiles:do_populate_sysroot"

IMAGE_INSTALL:append = " kernel-image kernel-devicetree"
IMAGE_INSTALL:append = " raspi-gpio"
IMAGE_FSTYPES:remove = " rpi-sdimg"


RPI_KERNEL_DEVICETREE_OVERLAYS:append = " overlays/uart0.dtbo"
RPI_KERNEL_DEVICETREE_OVERLAYS:append = " overlays/uart3.dtbo"
RPI_KERNEL_DEVICETREE_OVERLAYS:append = " overlays/uart4.dtbo"
RPI_KERNEL_DEVICETREE_OVERLAYS:append = " overlays/uart5.dtbo"

ENABLE_UART = "1"
RPI_EXTRA_CONFIG = '\n\
# Config to enable ports/usb for the \n\
# CM4-ETH-RS485-BASE-B \n\
\n\
# Disable Bluetooth \n\
dtoverlay=disable-bt \n\
# Configuring uart=0 \n\
dtoverlay=uart0 \n\
# Configuring uart=2 \n\
# needs to be done to disable fan \n\
force_eeprom_read=0 \n\
disable_poe_fan=1 \n\
# Configuring uart=1 \n\
dtoverlay=uart1 \n\
# Configuring uart=3 \n\
dtoverlay=uart3 \n\
# Configuring uart=4 \n\
dtoverlay=uart4 \n\
# Configuring uart=5 \n\
dtoverlay=uart5 \n\
\n\
# Enable USB for Waveshare \n\
#dtoverlay=dwc2 \n\
#dr_mode=host \n\
'

USER_CLASSES ?= "buildstats"


# DOCKER CONFIG

# needed for docker
DISTRO_FEATURES:append = " virtualization"
IMAGE_INSTALL:append = " docker docker-compose"


# MENDER CONFIG

# The name of the disk image and Artifact that will be built.
# This is what the device will report that it is running, and different updates must have different names
# because Mender will skip installation of an Artifact if it is already installed.
MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"

IMAGE_INSTALL:append = " bash"
IMAGE_INSTALL:append = " curl"
IMAGE_INSTALL:append = " python3"
IMAGE_INSTALL:append = " python3-pip"
IMAGE_INSTALL:append = " python3-venv"
IMAGE_INSTALL:append = " python3-boto3"
IMAGE_INSTALL:append = " java-11"


# The following settings to enable systemd are needed for all Yocto
# releases sumo and older.  Newer releases have these settings conditionally
# based on the MENDER_FEATURES settings and the inherit of mender-full above.
INIT_MANAGER = "systemd"

DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

ARTIFACTIMG_FSTYPE = "ext4"

MENDER_STORAGE_TOTAL_SIZE_MB="5760"
# BOOT
MENDER_BOOT_PART_SIZE_MB="256"
# DATA
MENDER_DATA_PART_SIZE_MB="384"

DISTRO ?= "poky"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"

# By default disable interactive patch resolution (tasks will just fail instead):
PATCHRESOLVE = "noop"

BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    HALT,${TMPDIR},100M,1K \
    HALT,${DL_DIR},100M,1K \
    HALT,${SSTATE_DIR},100M,1K \
    HALT,/tmp,10M,1K"

CONF_VERSION = "2"

Attempts to Resolve:

I’ve verified the U-Boot environment settings but might be missing something crucial.
The system correctly identifies the /dev/mmcblk0p2 as the active root partition after boot, but during the Mender commit phase, it expects /dev/mmcblk0p3.

I suspect the problem might be related to how the bootloader environment is configured or how partitions are being mounted during the boot process.

Any insights, suggestions, or guidance would be greatly appreciated. Thanks.

Solved, reboot system before commit. :man_facepalming: The output of the install command is not clear that you have to reboot before commit.