freebsd-version: unable to locate kernel

WAS:
Code:
freebsd-version -u -> 11.0-FreeBSD-p10
freebsd-version -k -> 11.0-FreeBSD-p9
AFTER:
Code:
freebsd-update [world src]
IS:
Code:
freebsd-version -u -> 11.0-FreeBSD-p11
freebsd-version -k -> unable to locate kernel
Did somebody have similar problem?
 
I just installed 11.0-REL, ran freebsd-update, and it's normal, I think...

Code:
root@00:/home/poorandunlucky # freebsd-version -u
11.0-RELEASE-p11
root@00:/home/poorandunlucky # freebsd-version -k
11.0-RELEASE-p9
root@00:/home/poorandunlucky #

It's probably not a generalized issue with the update script...
 
Are you using Grub by any chance? Apparently this appears to happen with a slightly wrong configuration of Grub. I can't remember the specifics but there should be a few threads about it.
 
No, I'm not. That's one of my VM guest. And this OS has that problem.
Generally, all VM are the same in kernel configuration.
 
After the first freebsd-update install I rebooted the VM:
Code:
root@fbsdtest:~ # freebsd-version -k
11.1-RELEASE
root@fbsdtest:~ # freebsd-version -u
11.0-RELEASE-p11
This is to be expected, after the first install run only the kernel is updated. Are you getting the issue at this point? Or does it happen later on in the process? And are you using extra tools like sysutils/vm-bhyve for example?
 
I found the problem and solution for that.
The problem was the freebsd-version tries to read a file with specific information.
Some time ago I set umask to 027, so others can not read new files.
I've added
Code:
/bin/freebsd-version
to my visudo file.
Everything works as expected.
 
freebsd-version(1) is just a shell script. So it's relatively easy to see what it does. Looking through the code I see it tries to get the exact kernel file from various loader.conf files. Then it simply reads the kernel as a file and searches for a specific string. In your case it may have problems reading /boot/loader.conf and/or /boot/defaults/loader.conf.
 
Back
Top