b66e what if /var/db/pkg is deleted? - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Ports & Packages > Installation and Maintenance of FreeBSD Ports or Packages

Installation and Maintenance of FreeBSD Ports or Packages Installing and maintaining the FreeBSD Ports Collection or FreeBSD Packages (i.e. third party software).

Reply
 
Thread Tools Display Modes
  #1  
Old June 21st, 2012, 11:41
fluca1978 fluca1978 is offline
Member
 
Join Date: May 2010
Posts: 661
Thanks: 27
Thanked 60 Times in 57 Posts
Default what if /var/db/pkg is deleted?

This could sound trivial, but as far as I get it the pkg_ tools use the /var/db/pkg directory to see the installed packages information. If this is true, supposing that the above directory is emptied due to an error, is there a way to rebuild it and to delete installed packages?
Reply With Quote
  #2  
Old June 21st, 2012, 12:11
jb_fvwm2 jb_fvwm2 is offline
Senior Member
 
Join Date: Nov 2008
Posts: 1,385
Thanks: 60
Thanked 145 Times in 130 Posts
Default

If you meant "reinstall" to re-register the packages, some thing like
Code:
# requires /usr/ports/ports-mgmt/pkg pre-installed... on
# the problematic computer or one with the same [ or same AND additional ]
# ports installed, from which to copy the local.sqlite file.
# (see additional conditions below...)
cd /usr/local/sbin
find . -type f -exec pkg which {} \; | awk '{print $6}' | uniq | sort | uniq | tee -a /tmp/pkgs_to_reinstall_from_ports_or_portmasterPP.log
# repeat for /usr/local/bin, then check the large (firefox, etc) pkgs reinstalled.
#or, 
make missing
# from the /usr/ports/www/firefox which "exist" (run) but are not registered.
or combine both methods.

One could place the pkg database file on the computer from another one if it was built on a machine where the machine to repair has a lesser subset of ports. [No time to check the above for typos'...] BTW that file local.sqlite should be backed up somewhere on every machine if one is wise, /var/db/pkg also contains it. [I had to actually use that method because /var had to be reinstalled due to part[!!] of the hard disk being unusable.]

Last edited by jb_fvwm2; June 22nd, 2012 at 01:08. Reason: pkg
Reply With Quote
  #3  
Old June 21st, 2012, 12:18
gkontos's Avatar
gkontos gkontos is offline
Senior Member
 
Join Date: Dec 2009
Location: Polidendri, GR
Posts: 1,263
Thanks: 42
Thanked 218 Times in 164 Posts
Default

Default periodic scripts also create a backup under /var/backups
__________________
Powered by BareBSD
Reply With Quote
  #4  
Old June 21st, 2012, 15:55
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

Quote:
Originally Posted by jb_fvwm2 View Post
If you meant "reinstall" to re-register the packages, some thing like
Code:
cd /usr/local/sbin
find . -type f -exec pkg which {} \; ...
That's pkgng, which is not out for general use yet.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] /var/db/pkg deleted sk8harddiefast Installation and Maintenance of FreeBSD Ports or Packages 9 March 20th, 2011 21:04
[Solved] Port deleted folivora Installation and Maintenance of FreeBSD Ports or Packages 11 October 8th, 2010 20:35
I deleted all files from /etc accidentally sk8harddiefast General 20 September 12th, 2010 20:39
Electricsheep: why was deleted? zeiz Installation and Maintenance of FreeBSD Ports or Packages 4 December 15th, 2009 23:40
Am I really lost if I've just deleted /var/db/pkg/* by mistake? toomadd Installation and Maintenance of FreeBSD Ports or Packages 3 March 9th, 2009 23:01


All times are GMT +1. The time now is 03:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0