# Cannot identify running kernel



## nORKy (Nov 19, 2013)

Hi,

I run a FreeBSD 9.1 server with a GENERIC server (no jail) but*:*

```
# freebsd-update fetch
Cannot identify running kernel
```

I don't know what to do.


```
# uname -a
FreeBSD sa.my.domain 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
```

Can you help me? Thank you.


----------



## usdmatt (Nov 19, 2013)

Hmm, freebsd-update seems to just run `sysctl -n kern.bootfile` to get the current kernel, then pull the directory path from this. If it can't retrieve this directory, it outputs the error you display above.

So what happens if you try and run `sysctl -n kern.bootfile` directly on the command line?


----------



## nORKy (Nov 20, 2013)

```
# sysctl -n kern.bootfile
/boot/kernel/kernel
```
What to do with this*?*


----------



## junovitch@ (Nov 24, 2013)

It says you are running a GENERIC kernel but can't seem to find it.  What is in /boot/kernel?  Does `ls -l /boot/kernel/kernel` actually show the kernel as being there?  Was there anything non-standard done about your installation?


----------



## Deleted member 9563 (Nov 24, 2013)

My installation also has a file named kernel.


```
% ls -l kernel
-r-xr-xr-x  2 root  wheel  20524007 Sep 26 15:50 kernel
```
Perhaps freebsd-update establishes identity in some other way.


----------



## junovitch@ (Nov 24, 2013)

This is the bit from /usr/sbin/freebsd-update.  There's really no ambiguity to it.  It takes the output of that sysctl sans the kernel file, then quits if that directory doesn't exist.  Do you have a /boot/kernel directory?

```
BOOTFILE=`sysctl -n kern.bootfile`
KERNELDIR=${BOOTFILE%/kernel}
if ! [ -d ${KERNELDIR} ]; then
        echo "Cannot identify running kernel"
        exit 1
fi
```


----------

