# Ports says there's no ports installed.. but there is.



## k1piee (Nov 23, 2009)

Hi!

A couple of days ago the disk-space ran out on my /var partition so I panicked and deleted some files somewhere in /var/db/portsnap/, and maybe somewhere else, because they took up alot of space, and I just thought that they where some old .tgz files that hadn't been deleted.
But anyway, after that I couldn't update my ports tree because of some error just like in this thread: http://forums.freebsd.org/showthread.php?t=3341

So I did as the guy answered:

```
rm /var/db/portsnap/tag
rm -rf /var/db/portsnap/files
rm -rf /usr/ports
portsnap fetch extract
```

And I could update my ports tree just fine.
BUT, now it won't update any ports and it doesn't "remember" any installed ports either...
If i run pkg_info i get:

```
pkg_info: no packages installed
```

I'm guessing I deleted some list of the installed ports..
Can I somehow fix this so it will recognize that I have installed the ports and update them?
Or would I have to reinstall FreeBSD to get it to work?

Please help!


----------



## graudeejs (Nov 23, 2009)

you deleted /var/db/pkg

Simply install all packages/ports again....
This will recreate your /var/db/pkg

or reinstall system and don't do it again


----------



## k1piee (Nov 23, 2009)

Well that suck 

But I was checking around in the /vad/db directory and found in /var/db/ports that there where directorys of all the ports I had installed with distfiles and options -files in them.
Can't I make a complete /vad/db/pkg with them somehow?


----------



## graudeejs (Nov 23, 2009)

Port configuration (when you run make config) is saved in /var/db/ports.
As long as you have that directory, you won't need to reconfigure your ports again 


also in /var/db/ports you only have directories of ports that had configuration.
For example on my system I have tmux installed, but there isn't /var/db/ports/tmux directory, because tmux doesn't have port configuration options


EDIT:
also use same method for reinstalling as you installed


----------



## jb_fvwm2 (Nov 23, 2009)

Later, one might want to copy
/var/db/pkg somewhere

```
mkdir -p /var/vvar_db_backup
cp -vRp /var/db /var/vvar_db_backup
```


----------



## graudeejs (Nov 23, 2009)

I simply zfs snapshot


----------



## k1piee (Nov 24, 2009)

Thanks for all the help!
You learn from every mistake so I guess this was a good thing somehow cause now I will keep a backup of my /var/db


----------



## CodeBlock (Nov 24, 2009)

Not sure, but would remaking the ports index help? (i.e. [CMD="cd /usr/ports;"] make index[/CMD])

Just something to try, not sure if it will help.


----------

