Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

after resolving repeated crashes on startup with fsck I noticed some files were removed, one of them was the sqlite pkg database, so now when I run for example pkg install somepackage I get this erro:

pkg: sqlite: file is encrypted or not a databse

So my question is actually two-fold:

  1. How do I get pkg running again
  2. Is there a way (logs?) to find out what file were removed with the fsck tool?
share|improve this question
    
I am not aware of any log file for fsck execution. –  Ouki May 3 at 1:58
    
When I think about it I realize that doing just fsck -y > fsck.log would've been enough. –  arul May 4 at 22:40

1 Answer 1

up vote 4 down vote accepted

The (sqlite) database used by pkg(ng) is corrupted.

You should be able to restore the pkg db file using its daily backup:

  • have a look at /var/backups/

    # ls -lrt /var/backups/pkg*
    -rw-r--r--  1 root  wheel  16462211 May  3 03:01 pkgdb.bak.tbz
    -rw-r--r--  1 root  wheel  16462853 Apr 16 03:01 pkgdb.bak.tbz.2
    -rw-r--r--  1 root  wheel  17824768 May  3 03:02 pkgng.db
    
  • move away your corrupted db file (you can remove it later):

    # mv /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.corrupted
    
  • use the latest backup to restore your pkg db file:

    # pkg backup -r /var/backups/pkgng.db
    
share|improve this answer
    
thanks, that worked, btw it was in /var/backups/ :) –  arul May 4 at 22:37
    
my bad: big fingers or bad sight ... –  Ouki May 4 at 23:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.