Solved Strange behavior during source upgrade (always boots into previous kernel version).

Hello.
I got a strange problem while upgrading my FreeBSD.
How it looks:
# cd /usr/src && git branch
* releng/14.0

# make buildkernel && make installkernel
# freebsd-version -kru
14.0-RELEASE-p6
13.3-STABLE
13.3-STABLE

, and after reboot:
# shutdown -r now
, I can see the same output of this command:
# freebsd-version -kru
14.0-RELEASE-p6
13.3-STABLE
13.3-STABLE


How can I boot into just installed, freshly built, 14.0 kernel?
 
What does sysctl -a | grep bootfile show? Is it booted off the file you are expecting?

I find the output of -kru/-ruk/-urk etc. confusing - worth trying each one separately to make 100% sure it's talking about the same thing you are. For example it doesn't matter the order you put the flags in, userland is always last displayed.
 
And that's got the timestamp you'd expect?

The build/install definitely worked?

The only time I see this is where I've got some geli-encryption-experiment I did and the boot kernel hands over to a different drive that gets updated when I use freebsd-update. So I have to remember to copy the updated kernal back to the boot device.

ZFS boot environments or using UFS?
 
And that's got the timestamp you'd expect?

The build/install definitely worked?

The only time I see this is where I've got some geli-encryption-experiment I did and the boot kernel hands over to a different drive that gets updated when I use freebsd-update. So I have to remember to copy the updated kernal back to the boot device.

ZFS boot environments or using UFS?
Timestamp of /boot/kernel/kernel is fresh - just installed kernel.

The build/install worked as usual.

Main disk is geli encrypted ZFS with UFS boot partition on external USB-drive, mounted on /boot, if that matters: ZFS root mounted with vfs.root.mountfrom in /boot/loader.conf.
Not so long time ago i did upgrade from 12 to 13 with same steps - no problems.

It's really strange problem - I have no understanding how can it be.
Where did it found the old kernel?
How can I inspect /boot/kernel/kernel?
Here I found interesting link https://forums.freebsd.org/threads/determining-the-version-of-freebsd.31324/post-174017
 
# objdump -sj .data /boot/kernel/kernel | tail -n 22
gives me ...FreeBSD..14.0-RELEASE-p6...
# objdump -sj .data /boot/kernel.old/kernel | tail -n 22
gives me ...FreeBSD..14.0-RELEASE-p6...
# find /boot/ -name kernel
gives me:
Code:
/boot/kernel
/boot/kernel/kernel
/boot/kernel.old/kernel
 
Is there a boot loader or something you need to update?

Maybe you've got an old boot loader pointing to the wrong place and that boots your old kernel?


There have been a number of improvements in the boot loaders, and upgrading the boot loader on the boot partition is recommended in most cases, in particular if the system boots via EFI. If the root is on a ZFS file system, updating the boot loader is mandatory if the pool is to be upgraded, and the boot loader update must be done first. Note that ZFS pool upgrades are not recommended for root file systems in most cases, but updating the boot loader can avoid making the system unbootable if the pool is upgraded in the future. The bootstrap update procedure depends on the boot method EFI or BIOS), and also on the disk partitioning scheme. The next several sections address each in turn.

(and a lot more after that part).

And that's why 12 to 13 worked, because there weren't any boot loader changes. Maybe.
 
A similar query is open re. 14.0 to 14.1 upgrade:

 
OK.
I've found the problem:
I have backup boot drive in MMC SD-card slot with same partition labels for ease of interchange. MMC SD-card can't be used for booting (laptop's BIOS limitation), but it can be booted by modern UEFI FreeBSD loader. So, booted kernel was taken by loader from MMC SD-card, but /boot partition was mounted from USB SD-card. It's strange loader behaviour.
Sorry for the false anxiety.
 
Last edited:
Back
Top