After successfully integrating RockyOS with Mender to be able to deploy in an A/B fashion, I’m facing an issue: I’ve got the two partitions, they’re both defined in the /etc/mender/mender.conf and everything seems to be fine. I deploy a rootfs update, it is getting correctly written on the correct partition but, on reboot, it seems to randomly boot, from one partition or the other. What am I missing? Shouldn’t the “new” version be marked as OK on boot?
Weirdly enough, the deployment is successful. It just won’t “lock” the new version in place.
I’m just wondering now if it’s because of some files that need to be shared across the two OSes?
My partitioning layout is the following:
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 50329599 47001600 22.4G Linux filesystem
/dev/sda4 50329600 67106815 16777216 8G Linux filesystem
/dev/sda5 67106816 83884031 16777216 8G Linux filesystem
While the /etc/fstab looks like this:
# /dev/sda5 - rootfsA
UUID=374b51e7-91f1-4597-82f6-3a9a4f4a015a / ext4 defaults 1 1
# /dev/sda2
UUID=b089311f-0cb1-47db-95e9-7265b5060abb /boot ext4 defaults 1 2
# /dev/sda1
UUID=3B4C-3C39 /boot/efi vfat umask=0077,shortname=winnt 0 2
# /dev/sda3 - data partition
UUID=16757c3a-fd9c-4e1b-b0ac-1102b5b5f672 /data ext4 defaults 1 2
# Bind mount used to share mender data across OSes
/data/mender /etc/mender none defaults,bind 0 0
Do I need to also share the /var/lib/mender, by any chance?
Yes, /var/lib/mender needs to be a symlink to /data/mender.
I would not recommend bind mounting /data/mender to /etc/mender. Mender already has support for loading from both locations, so you can just put mender.conf in /data/mender and is should work as long as /var/lib/mender is symlinked to it. But in general as few configuration options as possible should be kept in /data/mender/mender.conf because it makes it harder to update configuration options.
This should mean that it will boot using /dev/sda5 (/dev/sda is the designated root disk), right? The weird thing is that it booted using /dev/sda4 as the rootfs…? Any clue as of why?
I canceled the bind mount, as you suggested. Nothing changed unfortunately
Hmm, can you check that mender_rootfsa_part and mender_rootfsb_part are set correctly in your grub.cfg file? Where this file resides depends on your setup, but it’s usually in either /boot/efi/BOOT/grub.cfg or, if that file is a minimal stub, it might be in /boot/grub-mender-grubenv.cfg.
It seems I was missing a grub.cfg created by mender. I fixed that, now I have /boot/grub and /boot/grub2 which are symlinks to /boot/efi/grub-mender-grubenv, which hold a grub.cfg file having the correct
# Partition index of root filesystem A
mender_rootfsa_part=4
# Partition index of root filesystem B
mender_rootfsb_part=5
# Device file corresponding to the root filesystem partitions, without index.
mender_kernel_root_base=/dev/sda
Still, the system boots from one partition or the other, randomly it seems. Any ideas what I can check next?
Are you sure that the bootloader is loading variables from the same place as the command line tools? Maybe adding a few debug prints around the boot script might give some insight into what is happening there. Especially around here might be interesting. I recommend using sleep <SECONDS> also, since messages tend to flash by pretty quickly.
Unfortunately, I am getting nothing.
I have edited the /etc/grubd.d/00_04_mender_setup_env_functions_grub, added a few echos and a sleep instruction, generated the new grub.cfg, but I cannot see any echo.
I see the Proxmox “boot menu”, I see it waiting for those 15 sec I’ve set but I see no echoes. Then grub2 seems to be loading, no message in between. After grub, obviously, the OS starts to load and that’s it. None of my echos show up
What am I missing?