# How much memory is needed for i386 FreeBSD 9.1-RELEASE?



## zav (Dec 14, 2012)

Hello,
I'm having problem with upgrading to FreeBSD 9.1-RELEASE on i386 machines with less then 192MB of RAM installed. I can't boot GENERIC kernel with less then ~96/128Mb (i.e 64) of RAM installed having the following kernel panic message:

```
panic: kmem_malloc(4194304): kmem_map too small: 24428544 total allocated
```
With 128Mb I can start installation process, but having a kernel panic again, when installer extracts base.txz distribution archive. With 192Mb RAM I can boot and install 9.1, but having same kernel panic when trying to do something, for example having nis and nfs clients, and trying to extract portsnap snapshot first time.

I have a copy of the distribution taken from the ftp site: 
ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.1/

My Kernel is:

```
FreeBSD 9.1-RELEASE #0 r243826: Tue Dec 4 06:55:39 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
```


----------



## zav (Dec 14, 2012)

I'm sorry, i forgot to mention that i'm upgrading from previous 9.0-RELEASE, where i had no similar issues with same hardware... PC's with which i have trouble is: couple of QEMU vm's and bunch of P-II K6-2 boxes.

Please, can anyone guide me on how to avoid such limitation?


----------



## zav (Dec 15, 2012)

I also noticed significant changes in vm.kmem_map_* sysctl values:

```
9.0-RELEASE i386 (128MB)
vm.kmem_map_free: 32661504
vm.kmem_map_size: 5378048
```


```
9.1-RELEASE i386 (128MB)
vm.kmem_map_free: 5074944
vm.kmem_map_size: 32944128
```


----------



## morbit (Dec 15, 2012)

This looks serious, maybe -stable would yield some answers.


----------



## zav (Dec 16, 2012)

morbit said:
			
		

> This looks serious, maybe -stable would yield some answers.


Thank you for replying. 

Yesterday, when i tried to make a tar>bz2 backup of my /home partition, after 2.5 days of uptime yet another machine went reboot with same kernel panic message, it was a PIII with 320MB of RAM. Unfortunately, my weekend comes to end, so i have a lack of free time to spend on exploring the issue more deeply...
For now, i'm switching back to previous release, restoring from backups, etc. Despite the trouble with "legacy stuff", i still have a ISC BIND nameserver running on 9.1(amd64), so i'll keep an eye on it


----------



## mlsemon (Dec 20, 2012)

*Build from a PC with more memory*

Maybe play with the kmem variables a bit...and keep trying!  However, I *think* (not sure) that I didn't use the kmem variables in my final solution.

My experience was that I could not boot GENERIC with 64 MB of RAM, after I put two chips into an old PC and thinking that they were 128MB chips when in fact they were 32MB chips.  Oops!  I thought it did fine in 160MB of RAM, though.

Don't do anything important without some form of swap enabled, at least not until you get the memory usage down.

I found myself using a stronger PC to make a FreeBSD 9.1 installation from source, then installing that to a disk to use for the weaker PC.  It boots in 64MB of RAM with 22MB free at boot, but it runs ntpd, syslogd, and not much else.  Also, I had to comment out lot of commented-out entries in my kernel for GENERIC.  Both systems were old 733-MHz Pentium III PCs.


----------



## mlsemon (Dec 20, 2012)

Er, comment out regular entries from the GENERIC configuration file.  Sorry.


----------



## spork (Dec 23, 2012)

For future google searchers, there is a thread here on -stable that references this issue:

http://freebsd.1045724.n5.nabble.com/9-1-minimal-ram-requirements-td5771583.html

Short explanation, a new CAM-related device is allocating a large amount of memory, disabling it should help the situation:



> This (i.e. the "kmem_map too small" message seen with kernel memory shortage) could be due to CAM CTL ('device ctl' added in 9.1), which is quite a big kernel memory consumer. Try to disable CTL in loader with kern.cam.ctl.disable=1 to finish boot. A longer term workaround could be to postpone those memory allocations until the first call to CTL.



Ironic, given the recent bikeshed thread about needing to keep the dmesg buffer so tiny.


----------



## derekschrock (Dec 26, 2012)

spork said:
			
		

> For future google searchers, there is a thread here on -stable that references this issue:
> 
> http://freebsd.1045724.n5.nabble.com/9-1-minimal-ram-requirements-td5771583.html
> 
> ...



I can confirm this works with a 128MB RAM VM in VirtualBox.


----------

