# remove /usr/ports; device busy



## Sivan! (May 22, 2022)

DutchDaemon said:


> ```
> rm /var/db/portsnap/tag
> rm -rf /var/db/portsnap/files
> rm -rf /usr/ports
> ...



I tried to find `dig, icmpaddrmask and host` in the ports tree, these ports were not found. Then I ran:

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

and after that
`portsnap fetch extract`



> rm: /usr/ports: Device busy



There are no other terminal windows and no other commands running. Is there something wrong?


----------



## SirDice (May 22, 2022)

Is this perhaps a ZFS system? In that case /usr/ports is a separate dataset. If you try to remove the whole directory (`rm -rf /usr/ports`) it's going to complain. You can't remove the /usr/ports directory, you have to destroy the dataset to do that. 

That said, don't destroy the dataset, just remove the _contents_ of that directory and leave the directory itself alone; `rm -rf /usr/ports/* /usr/ports/.[^.]*`


----------



## ayleid96 (May 22, 2022)

SirDice said:


> Is this perhaps a ZFS system? In that case /usr/ports is a separate dataset. If you try to remove the whole directory (`rm -rf /usr/ports`) it's going to complain. You can't remove the /usr/ports directory, you have to destroy the dataset to do that.
> 
> That said, don't destroy the dataset, just remove the _contents_ of that directory and leave the directory itself alone; `rm -rf /usr/ports/* /usr/ports/.[^.]*`


I second that, on my installation by running `rm -rf /usr/ports/*` everything is fine.


----------



## Sivan! (May 22, 2022)

SirDice said:


> Is this perhaps a ZFS system? In that case /usr/ports is a separate dataset. If you try to remove the whole directory (`rm -rf /usr/ports`) it's going to complain. You can't remove the /usr/ports directory, you have to destroy the dataset to do that.
> 
> That said, don't destroy the dataset, just remove the _contents_ of that directory and leave the directory itself alone; `rm -rf /usr/ports/* /usr/ports/.[^.]*`



Thank you. It worked. Now running `portsnap fetch extract`.  Working well. 

I understand that working with ports and packages at the same time gives rise to some problems. I prefer to stay with the ports method at all times, but recently I used `pkg install` once or twice, is there something to be done to undo anything that `pkg install` has done, and stay with ports ever after?

Thank you.


----------

