# Accidentally removed lots of ports



## astralfx (May 31, 2011)

I was really pissed of trying to remove devel/bcc. Because I can't install VirtualBox with networking, loaded all the modules etc, with the delay between those 2 modules. However it never works, so I removed the virtualbox package and tried to install it myself from ports. But I ran into an error, which I googled and the developer said to someone else deinstall devel/bcc.

So I tried:
[cmd=]pkg_delete -r bcc\*[/cmd]

And I couldn't get it to work, and I accidentally did (thinking a confirmation message would come up, showing all the b.. packages.):
[cmd=]pkg_delete -r b\*[/cmd]

However it started removing packages, and it didn't show up what it was deleting. (I ctrl+c after a few secs, noticing it deleting stuff without telling me).

And now I can't *startx*, and get errors 

```
No such file: /usr/local/bin/X
```
 And I confirmed, that file no longer exists..

How do I check what pkg_delete deleted? And what shall I do now (reinstalling the OS is not an option, I need a fix)?


----------



## jrm@ (May 31, 2011)

You can try to find out what dependencies are missing and reinstall only those.  For example if you use portmaster you can do `% portmaster --check-depends`.


----------



## wblock@ (May 31, 2011)

astralfx said:
			
		

> ```
> pkg_delete -r b\*
> ```



That would delete everything that starts with "b", and everything that depends on those packages.



> And what shall I do now (reinstalling the OS is not an option, I need a fix)?



Reinstalling the OS wouldn't fix the problem anyway.


```
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
# rehash
# portmaster -a
```

That should do it (but I'm not going to delete all my packages that start with "b" to test).  portmaster checks for everything that is needed and installs what's missing.

An alternative is portupgrade's pkgdb:

```
# cd /usr/ports/ports-mgmt/portupgrade-devel
# make install clean
# rehash
# pkgdb -Ff
```
There will be an interactive session where it will ask about installing dependencies, and you'll need to make sure it's not mistaking already installed ports for the missing dependencies.  Takes a long time, too.  I'd try portmaster first.


----------



## astralfx (May 31, 2011)

I tried, both those methods.. However they didn't fix the /usr/local/bin/X  which is deleted. How shall I go about reinstalling X?


----------



## UNIXgod (May 31, 2011)

astralfx said:
			
		

> I tried, both those methods.. However they didn't fix the /usr/local/bin/X  which is deleted. How shall I go about reinstalling X?



You can use portmaster or portupgrade to force reinstall in place. read the man pages to find out how.


----------



## astralfx (Jun 1, 2011)

Ok, I recompiled x11/xorg. And have a working Xserver, but there are still so many issues, tab completion doesn't work anymore in the WIBOX menu bar WIN+R however it works in terminal? I get a load of errors when  I *startx* (but at least it shows the screen). Also I get errors, as soon as it gets to LOGIN screen. How can I show errors, *dmesg* only shows boot?

How has SLIM been removed, I can't find the package, I though that *pkg_del b\** only deleted packages that start with "b".


----------



## SirDice (Jun 1, 2011)

astralfx said:
			
		

> I though that pkg_del b\* only delete packages that start with "b".


It does but you did a pkg_delete -r which also deletes any packages that depend on the packages that begin with the letter B.


----------



## astralfx (Jun 1, 2011)

Hi, I found these errors.


Here is the error, which I noticed as I startx, something like:

```
xauth: file /home/Astral/.Xuthority does not exist
bad display name :0
```
And it's correct, I have no ~/.Xuthority. So what do I do?

Also how does *pkg_delete -r* delete stuff, I might be taking a wild guess but does it start from the end e.g. Z, and start deleting then working its ways to A (because that would make sense, it removed Xorg since one of the last char packages, and SLIM was dependent on Xorg right?) .. And I can't notice any other packages missing?


----------



## SirDice (Jun 1, 2011)

astralfx said:
			
		

> And it's correct, I have no ~/.Xuthority


Neither do I or anybody else for that matter. The file is called ~/.Xauthority.



> Also how does *pkg_delete -r* delete stuff, I might be taking a wild guess but does it start from the end e.g. Z, and start deleting then working its ways to A (because that would make sense, it removed Xorg since one of the last char packages, and SLIM was dependent on Xorg right?) .. And I can't notice any other packages missing?


It's been explained twice now.


----------



## astralfx (Jun 1, 2011)

Ok minor spelling mistake? ~/.Xauthority

So how do I fix the errors?

Let me restart the PC, and take a pic of error:

```
..(I missed these errors, some above)
xauth: file /home/Astral/.Xauthority does not exist
xauth: (stdin):1: bad display name ":0" in "add" command

xauth: file /home/Astral/.Xauthority does not exist
xauth: (argv):1: bad display name ":0" in "list" command

xauth: file /home/Astral/.Xauthority does not exist
xauth: (stdin):1: bad display name ":0" in "add" command
```


And how do I find out this "b" package that removed (Xorg, SLIM and who knows what else..). I've done all these fix dependencies stuff, is it possible to find out?


----------



## DutchDaemon (Jun 1, 2011)

I'd take previously given advice and use ports-mgmt/portmaster to rebuild you current ports installation, which will most likely pull in all the stuff you deleted by accident.

See the "Using portmaster to do a complete reinstallation of all your ports" section near the end of portmaster(8). Note the 'in place' option if you're not willing/brave enough to delete all ports and start over.


----------



## astralfx (Jun 1, 2011)

Thanks DutchDaemon, your "awesome".

I don't want to reinstall everything, it seems too risky.. However I noticed:

```
portmaster --list-origins
```

And it printed all the ports/pkgs installed, and I simply reinstalled the one's I thought were causing the problems.

```
x11/xorg
x11/xauth
x11-wm/awesome
```

Now most errors are fixed, and tab competition works again )

However the Xauth, problem still remains. It doesn't matter too much, since the error doesn't really affect me while I'm using the OS, it might just be nice to not have  bunch of errors when I shutdown relating to Xauth. It's odd, since I reinstalled x11/xauth successfully.

There is one thing I tried which I'm not sure works. If before I *startx*, I touch /home/Astral/.Xauthority I get no errors, when I login, however as soon as I login the file deletes also.. And when I shutdown the same errors as previously show up.


----------

