# Accidentally deleted /var/db/ports... Now what?



## Bart_ (Nov 7, 2011)

Hi,

I've probably done something really silly. After having done an incorrect cvsup sync (sending stuff to /var/db and to /home, copied a cvsup server config.) I tried to clean up the mess, in that process I've also deleted /var/db/ports.

Afterwards I found out this was the place where info on installed ports was located. Long story short, I'm trying to fix this issue.

Things I've tried was first manually installing a few applications that I've installed using this command:

[cmd=]# make FORCE_PKG_REGISTER=1 install clean[/cmd]

And from there, since I use portupgrade, I've tried running this command to update everything/reinstall (and configure) ports:

[cmd=]# portupgrade -arRCf[/cmd]

The problem however is that dependencies weren't "upgraded/reinstalled" which means that I have a relatively short list of ports when I check portversion.

An example is that I've installed Nagios which comes with Apache as dependency, in my list Apache isn't shown as an installed port while it has been installed on the system.

Because of that I'm currently hanging on a few choices:


Find a way to rebuild /var/db/ports with all dependencies included
Reinstall the OS since I'm still at the beginning of configuring the server
This problem will fix itself over time so just continue configuring the server

Can anyone help me out with this choice? Is there a way to easily fix /var/db/ports or did I kind of break a few things that can't be fixed? Or will this fix itself over time?

Any insight would be much appreciated, thanks in advance.


Best regards,

Bart

p.s. I've learned my lesson and won't be doing this again, but I really hope theres a fix for this.


----------



## DutchDaemon (Nov 7, 2011)

In the big scheme of things, /var/db/ports is not very essential. All it contains are the options that were chosen during the installation of ports (the blue config screen (*make config*)). E.g. the options chosen for Apache will be in /var/db/ports/apache22/options. All installed ports will continue to work normally. When reinstalling them you should get the config screens again. Hopefully you remember which were the correct options again, if you even deviated from the defaults for any of them, that is. Another hopeful message would be: *make backups*! And whatever you do, make sure you don't delete /var/db/pkg, because that would really hurt much more than this.


----------



## sk8harddiefast (Nov 7, 2011)

> make sure you don't delete /var/db/pkg, because that would really hurt much more than this.


I have made this mistake before.... And never do it again!!!!! From then

```
cd /var/db/
cp -R pkg/ pkg.back/
```


----------



## gkontos (Nov 7, 2011)

A friendly reminder, the default periodic scripts backup /var/db/pkg/, aliases, group and master.passwd to /var/backups.


----------



## Bart_ (Nov 7, 2011)

Thanks for the reply's, I have to confess that I was initially assuming that /var/db/ports was the culprit but (shame on me) in the process of "cleaning up the mess" I've also rid myself of /var/db/ports. . .

Since I have a more clear direction to look for now I've tried "rebuilding" this using pkgdb, hopefully it will work. If not then I might as well reinstall the server, troubleshooting is costing me too much time where a reinstall would take allot less time.

After it's all working properly I'll make sure that the back-ups are working and that I don't forget /var/db.

Thanks for all the help.


----------



## graudeejs (Nov 7, 2011)

Bart_ said:
			
		

> I have to confess that I was initially assuming that /var/db/ports was the culprit but (shame on me) in the process of "cleaning up the mess" I've also rid myself of /var/db/ports. . .



hier(7)


----------

