# freebsd-update fetch returns "Cannot identify running kernel" (possible Bug?)



## subnetspider (Dec 19, 2022)

Hello everyone,

I was trying to run `freebsd-update fetch` on two of my FreeBSD 13.1-RELEASE VMs but it wouldn't work, only telling me that it "Cannot identify running kernel".

However, `freebsd-version -ur` would return:

```
13.1-RELEASE-p3
13.1-RELEASE-p5
```

and `uname -a` would return:

```
FreeBSD localhost 13.1-RELEASE-p3 FreeBSD 13.1-RELEASE-p3 GENERIC amd64
```

So there definitely *is* a kernel and FreeBSD *can* find it.

I dug a little deeper and found that `freebsd-update` checks the location of the kernel with the command `sysctl -n kern.bootfile` (https://reviews.freebsd.org/D21892).

When I ran the command on my two struggling VMs, it returned the following:

```
/boot/kernel/INS@sRpPOI
```

On another working VM, it returned the following instead:

```
/boot/kernel/kernel
```

I was able to correct this by running `sysctl kern.bootfile=/boot/kernel/kernel`, after that I was again able to run `freebsd-update fetch` like normal.

I also checked the template VM I cloned the two struggling VMs from, and there exists the same problem.
This VM was originally 13.1-RELEASE and was manually updated to 13.1-RELEASE-p1, 13.1-RELEASE-p2, 13.1-RELEASE-p3 and so on.


Now my question would be how did this happen in the first place and how I can stop this from occurring in the future?
And is this incident something where writing a Bug report would make sense (if this is a bug at all)?

Cheers


----------



## Emrion (Dec 19, 2022)

I don't think it's time to fill a PR.

Look into /etc/sysctl.conf and /boot/loader.conf for some clues.
Is the file /boot/kernel/INS@sRpPOI actually exists?


----------



## subnetspider (Dec 19, 2022)

Emrion said:


> Look into /etc/sysctl.conf and /boot/loader.conf for some clues.


Everything in /etc/sysctl.conf looks normal (haven't touched it) and /boot/loader.conf looks as expected (I manually limited the zfs arc).


Emrion said:


> Is the file /boot/kernel/INS@sRpPOI actually exists?


Yes, the file /boot/kernel/INS@sRpPOI does exist, it was created on the same day I last updated my FreeBSD template VM.
And the file /boot/kernel/kernel with the exact same size also exists, only difference is that it was created 3 minutes later.

I'm just a little surprised why the kernel is called "INS@sRpPOI" - all I can say is that `kldstat` also displays "INS@sRpPOI" instead of "kernel".


----------



## Emrion (Dec 20, 2022)

subnetspider said:


> I'm just a little surprised why the kernel is called "INS@sRpPOI" - all I can say is that `kldstat` also displays "INS@sRpPOI" instead of "kernel".



If this is the current loaded kernel, there is somewhere a config file that indicate to load it.
For example, you have: /boot/defaults/loader.conf and /boot/loader.conf.local.

You should try to use `rgrep` in order to find where "INS@sRpPOI" is writed.


----------



## subnetspider (Dec 20, 2022)

Emrion said:


> You should try to use `rgrep` in order to find where "INS@sRpPOI" is writed.


The only place `rgrep` could find a mention of "INS@sRpPOI" was /boot/kernel/linker.hints and /boot/kernel.old/linker.hints.


----------



## Emrion (Dec 20, 2022)

Weird, because /boot/kernel/linker.hints has nothing to do with the file to load as kernel.
See: kldxref(8)

What is the boot method? Legacy BIOS or EFI?
If it's EFI, give us the output of: `efibootmgr -v`


----------



## subnetspider (Dec 20, 2022)

Emrion said:


> What is the boot method? Legacy BIOS or EFI?


The boot method is BIOS.


----------

