# panic: ufs_dirbad: /usr: bad dir ino ... after installing from ports



## jozze (Apr 30, 2013)

So I tried to install emulators/virtualbox-ose (from ports) and I got burned in return. I set one of the dependencies compile flag to create some additional modules. Suddenly, while compiling one of the dependencies (I don't know which one), my screen turned black. I didn't know how to respond, so I rebooted, thinking that the system just hanged, and all was well.

System then nearly finished rebooting, I managed to reach the login console entry, but after that, even before being able to type anything in it, I got an error message from the kernel:

```
...
panic: ufs_dirbad: /usr: bad dir ino 11235859 at offset 1536: mangled entry
cpuid = 3
KDB: stack backtrace:
....
```
Computer autoreboots 10 seconds after the message is displayed. Sometimes it's cpuid = 2.

I rebooted using the LiveCD and performed `# fsck -t ufs -y /dev/ada1p4` (well, that's my /usr partition right there), but it says the disk is OK. I don't know what to do.

It's not a kernel issue, since I've been trying to boot with different kernels (including GENERIC) but to no avail.

Something tells me that maybe just rebuilding the "world" would suffice, or maybe even just `# pkgdb -fu; portsdb -u` would do the trick, but I cannot, since I can only boot from my LiveCD (USB) and I cannot convince those utilities that /mnt is actually /. So I was thinking, is it possible to create a jail(8)(), mount my /usr in it and try to fix it from there, or would the problem persist, and the jail would in turn be unbootable due to that broken /usr partition?

Or can I actually use that ino 1123589 number to my advantage and fix it from there? If so, how can I do that (using the base utilities is the preferred method, since I cannot install anything on my LiveCD).

I searched on the web, changed my /etc/{rc.conf,fstab} files ... still no change.

I am very puzzled by all this, any suggestions would be more than welcome.


----------



## jozze (Apr 30, 2013)

Hmmm... that's funny 

I fixed it by running `# fsck -t ufs ...` again, and this time it didn't try to use journaled data, so it naturally found inconsistencies, asked me if I want them fixed (to which I gladly agreed). Aaaaand ... it's gone! (problems I mean).

So, despite the fact that by sheer luck I fixed this mess, I still don't know what to do with the fact that emulators/virtualbox-ose did this to me.


----------



## jozze (Apr 30, 2013)

OK, I know also now why the screen went dark during the emulators/virtualbox-ose installation: it was because of an Xorg driver problem I noticed before, but didn't bother yet to fix. So the system didn't actually hang. I have to change driver in /etc/X11/xorg.conf.


----------

