# Having issues with FreeBSD Kernel Panics



## skitzot (Jan 31, 2012)

Hey gys,

Just switched my mediatomb/file server to FreeBSD and I'm loving it with the exception of some kernel panics.

I'm wondering how I can track down what's at fault.

I could attach a screenshot the next time it locks up, but I'd rather not wait.  Isn't there a core dump or another type of file?  /var/log/messages stops populating at the freeze and starts up again when the system is powered back on.

The screen contains some kernel timing errors, some stuff about ZFS (memory dumps perhaps), and says it will automatically be rebooting in 15 seconds, only it never does.

I have ZFS installed as my root:



```
solidserver# zpool status
  pool: rpool
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p3  ONLINE       0     0     0
            ada1p3  ONLINE       0     0     0

errors: No known data errors

  pool: rpool2
 state: ONLINE
 scan: none requested
config:

        NAME           STATE     READ WRITE CKSUM
        rpool2         ONLINE       0     0     0
          mirror-0     ONLINE       0     0     0
            gpt/disk2  ONLINE       0     0     0
            gpt/disk3  ONLINE       0     0     0

errors: No known data errors
```

Super, just decided to run a scrub and found this:



```
pool: rpool2
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
        attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
        using 'zpool clear' or replace the device with 'zpool replace'.
   see: [url]http://www.sun.com/msg/ZFS-8000-9P[/url]
 scan: scrub in progress since Mon Jan 30 21:46:15 2012
    1.53G scanned out of 404G at 78.5M/s, 1h27m to go
    384K repaired, 0.38% done
config:

        NAME           STATE     READ WRITE CKSUM
        rpool2         ONLINE       0     0     0
          mirror-0     ONLINE       0     0     0
            gpt/disk2  ONLINE       0     0     3  (repairing)
            gpt/disk3  ONLINE       0     0     0

errors: No known data errors
```

Will check rpool1 after this.

Still wondering if there's a way to check after a freebsd FreeBSD crash to see what went wrong?

Looks like I need to run scrub on my 2 zpools.

Still wondering how I can figure out why FreeBSD is kernel panicking.


----------



## kpa (Jan 31, 2012)

What version of FreeBSD? AMD64 or i386? You may need to do some tuning for ZFS depending on the version and architecture, on i386 there few things you must do to get the system stable:

http://wiki.freebsd.org/ZFSTuningGuide


----------



## skitzot (Feb 1, 2012)

Sorry, it's AMD64.

I scrubbed my root pools but it still tanked again. Seems to do it every 18-24 hrs regardless of if it's idle or streaming media with mediatomb.


----------



## throAU (Feb 1, 2012)

What make/model are the drives, out of interest?


----------



## skitzot (Feb 1, 2012)

I uploaded the screen shots of the last kernel panic:

http://imgur.com/a/eHn9P

Any help would be appreciated!


----------



## skitzot (Feb 1, 2012)

throAU said:
			
		

> What make/model are the drives, out of interest?



4 x Seagate 1.5TB Drives in 2 mirrored zpool arrays.

They are refurbs due to the originals dieing from the firmware bug Seagate had awhile ago.


----------



## kpa (Feb 1, 2012)

You may be running out of memory, ZFS uses memory in pretty aggressive way for ARC cache and sometimes it overdoes the allocation.

Try limiting the maximum size of the ARC cache with this setting in /boot/loader.conf, for starters set the amount to about 2/3 of the physical memory you have (in my example the amount is 1GB).


```
vfs.zfs.arc_max="1024M"
```


----------



## skitzot (Feb 1, 2012)

kpa said:
			
		

> You may be running out of memory, ZFS uses memory in pretty aggressive way for ARC cache and sometimes it overdoes the allocation.
> 
> Try limiting the maximum size of the ARC cache with this setting in /boot/loader.conf, for starters set the amount to about 2/3 of the physical memory you have (in my example the amount is 1GB).
> 
> ...



Thanks man, giving it a shot.

For some reason, at least prior to this change, it kept locking up about once every 15 or so mins...  Hopefully this does it, I really like freebsd/zfs and would hate to switch back to linux, again..


----------



## skitzot (Feb 1, 2012)

kpa said:
			
		

> You may be running out of memory, ZFS uses memory in pretty aggressive way for ARC cache and sometimes it overdoes the allocation.
> 
> Try limiting the maximum size of the ARC cache with this setting in /boot/loader.conf, for starters set the amount to about 2/3 of the physical memory you have (in my example the amount is 1GB).
> 
> ...



Thanks, giving that a shot.

So far so good.  Not sure why but it started crashing every 15mins or so after I ran another zpool scrub. That's before I set ARC max, so hopefully that fixed it.  Uptime is at 30mins so better? lol


----------



## skitzot (Feb 3, 2012)

kpa said:
			
		

> You may be running out of memory, ZFS uses memory in pretty aggressive way for ARC cache and sometimes it overdoes the allocation.
> 
> Try limiting the maximum size of the ARC cache with this setting in /boot/loader.conf, for starters set the amount to about 2/3 of the physical memory you have (in my example the amount is 1GB).
> 
> ...



Wow, that seemed to do it, 24 +hrs of uptime and not only that by my mediatomb performance is better, before some of the higher res videos would chunk up a bit but now it's all crystal clear.

Thanks!


----------

