From owner-freebsd-questions@FreeBSD.ORG Sat Aug 8 11:02:06 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF91C1065670 for ; Sat, 8 Aug 2009 11:02:06 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-ew0-f206.google.com (mail-ew0-f206.google.com [209.85.219.206]) by mx1.freebsd.org (Postfix) with ESMTP id 4EA548FC08 for ; Sat, 8 Aug 2009 11:02:05 +0000 (UTC) Received: by ewy2 with SMTP id 2so2049386ewy.43 for ; Sat, 08 Aug 2009 04:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qYn56nNjvzdpMdt/0PvdA6xn4zs5cgp8+l/ATJC2ZIM=; b=M7rVnc4odO8DHNJi0xZ24tV9ZeXgbZNvc4OtJxziamjXAyy85Y0T7WQfV4ldzbCUmN 4vwR9LuTTAR3BncbUW8B5vn3rXMOCg7W5vrMrCkWFpLrsqUIV1mFvTgFnIIhEAocg9j0 jV2Ym4EEXQXBdnnl0f0OW/llXVnD2rq97Y4PA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=QsV3OV+mQOhHbf1W1kNF3raKayBKr4VFZvCJuWQxZMWjYESYGOuWE7KNDaOD5D873G 9y1oACLied8QwzqN80D+1LJI6fNajRSumhZO1ncUP4Dufx5DPjP4BVkRKm8/nB2j19lA fwBRX8SW/+BwRqTYyJuPxXxth7bWK44iPUBGw= MIME-Version: 1.0 Received: by 10.216.30.19 with SMTP id j19mr446665wea.46.1249729325198; Sat, 08 Aug 2009 04:02:05 -0700 (PDT) Date: Sat, 8 Aug 2009 11:02:05 +0000 Message-ID: From: "b. f." To: freebsd-questions@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Volodymyr Kostyrko Subject: Re: Recovering loss of /var/db/pkg ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Aug 2009 11:02:07 -0000 >There are a lot of common places the files would be installed such as >bin, sbin, lib, libexec under %%PREFIX%%. You can use `find dir -type f >| xargs -n1 -Ifoo sh -c "echo -n foo:; pkg_which foo"` to obtain the >list of known files (pkg_which is part of ports-mgmt/portsupgrade). >After that you can reinstall all packages that provide files with >missing origin. I bet you should use the same /usr/ports you have last >time when /var/db/pkg was full, just to be very close to pkg-plist. Er, except that pkg_which uses the portupgrade package database which is installed by default in -- you guessed it -- /var/db/pkg. So if you don't have it backed up somewhere, or don't have PKG_DBDIR defined to a non-default location, you're out of luck. And if it is still intact, __back it up__ before calling any of the pkgtools -- or you may wipe it out as pkg_which does an automatic update of the pkgdb after seeing that /var/db/pkg has been modified more recently than the database. Just use pkg_glob -qOa -- no need to use pkg_which. If you don't have it, you can: 1) use data recovery tools to try to read the names of the subdirectories of /var/db/pkg from the disk; or 2) write a script to get the names of all files that belonged to ports and swing through a ports tree, associating the files with ports via the pkg-plist and PLIST_FILES variables; or 3) rip out all the old junk, and try to start afresh. b.