# freebsd-version: unable to locate kernel



## IPTRACE (Jul 15, 2017)

WAS:
	
	



```
freebsd-version -u -> 11.0-FreeBSD-p10
freebsd-version -k -> 11.0-FreeBSD-p9
```
AFTER:
	
	



```
freebsd-update [world src]
```
IS:
	
	



```
freebsd-version -u -> 11.0-FreeBSD-p11
freebsd-version -k -> unable to locate kernel
```
Did somebody have similar problem?


----------



## poorandunlucky (Jul 16, 2017)

I just installed 11.0-REL, ran freebsd-update, and it's normal, I think...


```
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 (Jul 19, 2017)

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.


----------



## IPTRACE (Jul 25, 2017)

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.


----------



## IPTRACE (Jul 26, 2017)

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


----------



## SirDice (Jul 26, 2017)

IPTRACE said:


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


----------



## IPTRACE (Jul 26, 2017)

Yes, bhyve.


----------



## SirDice (Jul 26, 2017)

After the first `freebsd-update install` I rebooted the VM:

```
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?


----------



## IPTRACE (Jul 26, 2017)

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 
	
	



```
/bin/freebsd-version
```
 to my visudo file.
Everything works as expected.


----------



## SirDice (Jul 26, 2017)

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.


----------



## IPTRACE (Jul 26, 2017)

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


----------

