# pkgdb problem



## xwwu (Jan 14, 2012)

The problem is:


```
[Updating the pkgdb <format:dbm_hash> in /var/db/pkg ... Inappropriate
file type or format - /var/db/pkg/pkgdb; rebuild needed] [Rebuilding
the pkgdb <format:dbm_hash> in /var/db/pkg ... - 254 packages found (-0 +254)
.......................................................................
.............................100.......................................
.............................................................200.......
...............................................done]
/usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:215:in `origin': /var/db/pkg/pkgdb.db 
: unexpected file type or format -- Invalid argument (PkgDB::DBError)
        from /usr/local/lib/ruby/site_ruby/1.8/pkginfo.rb:202:in `origin'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:226:in `config_include?'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:196:in `config_ignore_moved?'
        from /usr/local/sbin/portupgrade:938:in `do_upgrade'
        from /usr/local/sbin/portupgrade:814:in `main'
        from /usr/local/sbin/portupgrade:810:in `each'
        from /usr/local/sbin/portupgrade:810:in `main'
        from /usr/local/lib/ruby/1.8/optparse.rb:791:in `initialize'
        from /usr/local/sbin/portupgrade:231:in `new'
        from /usr/local/sbin/portupgrade:231:in `main'
        from /usr/local/sbin/portupgrade:2219
```

Thanks for your help.


----------



## t0ken (Jan 14, 2012)

Looks like a corrupt pkgdb.db file to me.  Saw this on one of my boxes the other day.


```
rm -/var/db/pkg/pkgdb.db
pkgdb -Ffuv
```

That forces a rebuild of pkgdb and should resolve the problem mentioned...


----------



## xwwu (Jan 14, 2012)

Thanks! good idea!


----------



## MarcoB (Jan 19, 2012)

I'm having this problem too. Annoying thing is that when doing a *portupgrade -fa*, the upgrade process stops right there, and the upgrade has to start all over again.

I've spent all day just to make firefox work again, and it still doesn't work because of errors like this.


----------



## wblock@ (Jan 19, 2012)

One solution is to stop using portupgrade.  ports-mgmt/portmaster works.


----------



## MarcoB (Jan 20, 2012)

Sorry but portmaster made it even worse. After lots of attempts to reinstall all ports, I tried the portmaster method of reinstalling all of them. Now this process stops with lang/gcc34 because it is deprecated. Now all my ports are gone and there is no way to reinstall the ports I had.


----------



## DutchDaemon (Jan 20, 2012)

portmaster prints a summary of what it was about to do. Use that line, and add -x gcc34 to the command. None of this is portmaster's fault anyway.


----------

