# Kernel error



## Nokobon (May 11, 2009)

Hello,
after learning how to log the error
here it is.

I tried to build a custom kernel but got the following error

```
linking kernel.debug
nlm_advlock.o(.text+0x11a8): In function `nlm_advlock_internal':
/usr/src/sys/nlm/nlm_advlock.c:225: undefined reference to `nfs_vinvalbuf'
nlm_advlock.o(.text+0x1243):/usr/src/sys/nlm/nlm_advlock.c:236: undefined reference to `nfs_ticks'
nlm_prot_impl.o(.text+0x2b20): In function `nlm_syscall':
/usr/src/sys/nlm/nlm_prot_impl.c:1543: undefined reference to `nfs_advlock_p'
nlm_prot_impl.o(.text+0x2b26):/usr/src/sys/nlm/nlm_prot_impl.c:1544: undefined reference to `nfs_advlock_p'
nlm_prot_impl.o(.text+0x2b30):/usr/src/sys/nlm/nlm_prot_impl.c:1545: undefined reference to `nfs_reclaim_p'
nlm_prot_impl.o(.text+0x2b36):/usr/src/sys/nlm/nlm_prot_impl.c:1546: undefined reference to `nfs_reclaim_p'
nlm_prot_impl.o(.text+0x2b4e):/usr/src/sys/nlm/nlm_prot_impl.c:1551: undefined reference to `nfs_advlock_p'
nlm_prot_impl.o(.text+0x2b54):/usr/src/sys/nlm/nlm_prot_impl.c:1552: undefined reference to `nfs_reclaim_p'
*** Error code 1

Stop in /usr/obj/usr/src/sys/MYKERNEL.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```
It's the first time I try to build a custom kernel therefore I have no idea what is causing the error.

I read the thread Custom Kernel Error. It didn't help me that much, as I can't find any entry that requires another missing one.
And because I can't find words like "nlm" or "advlock" in my kernel, I hope to get some advice from you...

In the attachement there is my modified kernel.

Thanks.


----------



## DutchDaemon (May 11, 2009)

My guess: you have


```
options 	NFSLOCKD
```

but you do not have one (or both) of these:


```
options         NFSCLIENT
options         NFSSERVER
```

If you don't need NFS at all (which is what I gather from the absence of those options), remove that NFSLOCKD as well. Remember to clean out /usr/obj before building again -- `# rm -rf /usr/obj` is fine.

Aside: I remember that SCTP needed INET6, but I'm sot sure if that's still the case. I'd suggest either using both, or removing both.


----------



## Nokobon (May 12, 2009)

DutchDaemon said:
			
		

> My guess: you have
> 
> 
> ```
> ...


Thank you for your help.
Commenting the NFSLOCKD-entry out solved the problem. I have no idea why I didn't do that before...
For just a webserver with Apache I don't need any NFS, do I?



			
				DutchDaemon said:
			
		

> Aside: I remember that SCTP needed INET6, but I'm sot sure if that's still the case. I'd suggest either using both, or removing both.


Well I don't really understand whats SCTP for but I think it doesn't require INET6.



			
				DutchDaemon said:
			
		

> Remember to clean out /usr/obj before building again -- `# rm -rf /usr/obj` is fine.



Ok, I cleaned it up before building the kernel.
But what is that directory for?


----------



## SirDice (May 12, 2009)

Nokobon said:
			
		

> Ok, I cleaned it up before building the kernel.
> But what is that directory for?


It's where your build world and kernel ends up. It'll be installed from there.


----------



## DutchDaemon (May 12, 2009)

Nokobon said:
			
		

> Well I don't really understand whats SCTP for but I think it doesn't require INET6.



Well, not too long ago (in the 7 era certainly) the kernel refused to build with SCTP and without INET6. I had to add the latter, or remove the former.


----------



## DutchDaemon (May 12, 2009)

SirDice said:
			
		

> It's where your build world and kernel ends up. It'll be installed from there.



And not removing it before a fresh build may result in already built code being reused (and failing again for that reason).


----------



## Nokobon (May 12, 2009)

SirDice said:
			
		

> It's where your build world and kernel ends up. It'll be installed from there.





			
				DutchDaemon said:
			
		

> And not removing it before a fresh build may result in already built code being reused (and failing again for that reason).


Okay, so everything in /usr/obj is just important for the build of a kernel and after this I can(or even should) delete it?

Thank you for your explainations


----------



## SirDice (May 13, 2009)

Once you're done installing world and kernel /usr/obj can be safely removed.

I have /usr/src/ and /usr/obj/ nfs exported read-only. That way I can build on my fast machine and just mount them on the slower machines to do the install.


----------



## Nokobon (May 13, 2009)

SirDice said:
			
		

> Once you're done installing world and kernel /usr/obj can be safely removed.
> 
> I have /usr/src/ and /usr/obj/ nfs exported read-only. That way I can build on my fast machine and just mount them on the slower machines to do the install.



Okay, thank you.

I have only one testing machine with FreeBSD so exporting the directories is no option for me...


----------

