freebsd-version: unable to locate kernel

IPTRACE

Well-Known Member

Reaction score: 24
Messages: 321

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?
 

poorandunlucky

Well-Known Member

Reaction score: 33
Messages: 372

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...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,962
Messages: 38,420

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.
 
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 24
Messages: 321

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.
 
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 24
Messages: 321

I've upgraded one of my system from 11.0p11 to 11.1p0 and the same problem occured.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,962
Messages: 38,420

That's one of my VM guest.
Is it bhyve? I have a test 11.0-RELEASE running on bhyve and I'm currently trying to upgrade it to 11.1-RELEASE to see what happens.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,962
Messages: 38,420

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?
 
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 24
Messages: 321

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,962
Messages: 38,420

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.
 
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 24
Messages: 321

Both files are world readable, so the unreadable file is somewhere deeper from this context.
 
Top