# kldload: can't load linux



## joilet (Dec 1, 2011)

Hi

This is my first post to the forum! I have been trying to install the linux_base-f10 port app. However the prerequisite is that the linux kernel module must be loaded first.

I'm using a modified 8.0 kernel which has been adapted to run on MS Xbox hardware. It would seem whilst this module exists in a standard build, it didn't on this kernel configuration.


```
kldstat -v | grep lin
```
does not show the kernel module to be running.

I attempted to load the module manually:


```
[root@freebsd /boot/kernel]# kldload linux
kldload: can't load linux: No such file or directory
```

The module is apparently missing so i check out /boot/kernel/ and linux.ko is definitely not present.

Next i find the source and build it:


```
cd /usr/src/sys/modules/linux
make
make install
make clean
```

Added startup to rc.conf

```
linux_enable="YES"
```

I check out /boot/kernel/ and i confirm linux.ko exists. It does - great! I don't wish to reboot (though i've since done this) so i try to load the module manually again:


```
[root@freebsd /boot/kernel]# kldload linux
kldload: can't load linux: No such file or directory
```

WTF, the module is there i see it! I start to think i'm referencing it incorrectly. I try:


```
[root@freebsd /boot/kernel]# kldload linux.ko
[root@freebsd /boot/kernel]# kldload ./linux.ko
[root@freebsd /boot/]# kldload kernel/linux
```

All unsuccessful: No such file or directory.

I also checked the environmental path (or equivelent) was referencing to the correct location:

```
[root@freebsd /boot/kernel]# sysctl kern.module_path
kern.module_path: /boot/kernel;/boot/modules
```

Yep!

What on earth is going on here?!? Is this a permissions issue... I'm not too familiar with unix style permissions yet so i might need some help here! I'm sure if i modify my kernel configuration and rebuild i'll be able to make use of the linux module. However surely there must be a simpler way? I've spent ages looking at this and i'm beginning to go round in circles!

I really would appreciate it if someone could cast a fresh set of eyes on this. I'm sure i've missed something obvious! I'm greatful for any help offered.


----------



## SirDice (Dec 1, 2011)

Do you have any settings in the kernel config, make.conf or src.conf that prevents loading modules?


----------



## wblock@ (Dec 1, 2011)

Or maybe a non-default securelevel?


----------



## joilet (Dec 3, 2011)

SirDice said:
			
		

> Do you have any settings in the kernel config, make.conf or src.conf that prevents loading modules?



I've checked my kernel conf and make.conf. There doesn't seem to be a src.conf, atleast not in /etc.

I can't see anything obvious that would prevent the loading of kernel modules. Would it help if I posted the contents here? I don't want to clutter the thread!



			
				wblock@ said:
			
		

> Or maybe a non-default securelevel?



I presume the securelevel setting is default:


```
[root@freebsd /etc]# sysctl kern.securelevel
kern.securelevel: -1
```

Having read the security documentation here: http://www.freebsd.org/doc/en/books/faq/security.html
Anything equal to or less than zero (0) disables limitations.

I really wish I could figure this out. I've been plagued by this in the past too if I recall. Hopefully with the suggestions being put forward we'll get to the bottom of this. Thanks everyone for your comments so far, keep em coming


----------



## jb_fvwm2 (Dec 3, 2011)

Load all 7 *_linux.ko using full paths? OR build them if they are not all there. (Just a guess).


----------



## joilet (Dec 3, 2011)

jb_fvwm2 said:
			
		

> Load all 7 *_linux.ko using full paths ? OR build them if they are not all there. (Just a guess).



Hi. Could you expand on what you mean by loading all 7? There is only the single module and its called linux.ko. Unless there are others associated with it?

There are 6 other modules named li* :

libalias
libiconv
libmbpool
libmchain
linprocfs
linsysfs

Though I suspect these are completely unrelated!

I just tried generating a new linker.hints file:
[cmd=]kldxref -R /boot[/cmd]

Attempting to edit the file does show all the modules that are loaded on boot, except for linux. This must be relevant?

Could a permission issue cause this behaviour? The error I receive when I try to load the module with kldload is:

```
can't load linux: No such file or directory
```

We KNOW the file exists, so what would cause this? Upon installing the module the following is run from MAKE:


```
install -o root -g wheel -m 555   linux.ko /boot/kernel
kldxref /boot/kernel
```

Is the permission 555 enough? I'm not entirely sure what this represents. As you can see it updates the linker.hints file. However it doesn't appear to have changed. I'm just going to clarify this further as I merely looked at it last time. This time I'll try again whilst properly observing it. It's like kldxref can't see linux.ko either?


----------



## jb_fvwm2 (Dec 3, 2011)

amr_linux.ko aac_linux.ko ipmi_linux.ko 3dfx_linux.ko mfi_linux.ko geom_linux_lvm.ko  I'm only guessing that those also need to be built; also just guessing that 
	
	



```
kldload /boot/kernel/linux.ko
```
 using the full paths might work (Both guesses maybe?)


----------



## wblock@ (Dec 3, 2011)

AFAIR kldload(8) is not very descriptive in error messages.  Maybe "not found" in this case means the Linux kernel module doesn't work on the XBox (Pentium 3) or XBox 360 (PowerPC).


----------



## joilet (Dec 3, 2011)

jb_fvwm2 said:
			
		

> amr_linux.ko aac_linux.ko ipmi_linux.ko 3dfx_linux.ko mfi_linux.ko geom_linux_lvm.ko  I'm only guessing that those also need to be built; also just guessing that
> 
> 
> 
> ...



Thanks for the clarification. I built and installed all of these modules in the hope they may have been required. Unfortunately not, it didn't make any difference 

I had tried using full and relative paths to load the module previously. It didn't work either. I tried loading other modules and they worked - just not this one. Cheers all the same though mate - your input is appreciated.


----------



## joilet (Dec 3, 2011)

wblock@ said:
			
		

> AFAIR kldload(8) is not very descriptive in error messages.  Maybe "not found" in this case means the Linux kernel module doesn't work on the XBox (Pentium 3) or XBox 360 (PowerPC).





			
				wblock@ said:
			
		

> AFAIR kldload(8) is not very descriptive in error messages.  Maybe "not found" in this case means the Linux kernel module doesn't work on the XBox (Pentium 3) or XBox 360 (PowerPC).



Not even when used with the verbose -v option. I had suspected there may be an issue in using this kernel module on the xbox hardware. Though i didn't want to admit it to be honest. It's beginning to look like this is the case.

That said perhaps the source only needs minor changes to make it compatible. If i recall there are timing issues with the xbox hardware. Such as it will not keep correct time. It's internal frequency crystal is different to standard kit. I am having to abuse NTP beyond its original intention to make it keep correct time. There were a number of 'issues' that were never quite worked out. Unfortunately there hasn't been any active development on the project for quite some time.

The xbox i'm very happy with. It uses around 15 watts of electricity and with only 64MB of RAM, it really is surprising how much it can handle. I would thoroughly recommend it to anyone who wants a power efficient FreeBSD server. You probably can't beat it in terms of initial outlay - they're plentyful at next to nothing!


----------

