Mistakenly deleted some contents of OS sub-directory

Not every records would be preserved, but all info about "what was installed at the moment you missingly deleted /usr/local" should be kept at least at the moment.
Hi T-Aoki

One favour please, a pointer towards where i can find the information related to the installed packages for the very moment the issue happened.

Just producing a list would suffice in my case.

Thanks
rraj
 
Just reinstall everything with,

pkg install -f $(pkg info -ao | awk '{print $2}')

Or if you just want the list,

pkg info -ao | awk '{print $2}'

Redirect it to some file if needed.
 
pkg info -ao | awk '{print $2}'
No need for awk or any kind of parsing; pkg query -a '%o'

Code:
     -a, --all
               Match all packages from the database
Code:
     %o  Origin of the matched package
pkg-query(8)

Or getting just the name of the package (without the version): pkg query -a '%n'
What pkg info -ao outputs; pkg query -a '%n-%v %o' | column -t
 
One favour please, a pointer towards where i can find the information related to the installed packages for the very moment the issue happened.
How you can produced the list you want is already poited out.
So the hint for which directory to backup would be /var/db/pkg/.
This is where pkg stores its records by default.

Note that the parent directory, /var/db/, is worth backed up on critical operations.

For example, if you're building ports having options locally and changed any of the options, your choices are stored in per-ports subdirectories under /var/db/ports/ like /var/db/ports/devel_dbus/options for devel/dbus by default.
 
OK, lets do it step by step.
First are you the root user and in the /root directory? You should be if you did su - first.
Do
su -
enter root password and check who and where you are with
whoami; pwd
If output is
root
/root
Then check that you are using sh shell
echo $SHELL
Output should be
/bin/sh
Then do
pkg query -e '%a = 0' '%n'
You should see bunch of packages listed in the console. If that works, do
pkg query -e '%a = 0' '%n' > pkg-list.txt
ls
If pkg-list.txt is there, do
cat pkg-list.txt
Output should be same as just pkg query without redirection.
Then make variable with a contest of that file:
pkglist=$(cat pkg-list.txt)
check that variable has right content with
echo $pkglist
If you see number of packages printed in one long line, proceed with
pkg install -f $pkglist
Hi

The last command leaves output: pkg No Packages <Package-Name> have been found in repositories.

No package install takes place therein.


Thanks
rraj
 
Hi

The last command leaves output: pkg No Packages <Package-Name> have been found in repositories.

No package install takes place therein.


Thanks
rraj
What was your output of pkg query -e '%a = 0' '%n'?
I said:
Then do
pkg query -e '%a = 0' '%n'
You should see bunch of packages listed in the console. If that works, do
If this worked, you probably mistyped something in the steps after that I recommended, but if you didn't see list of pkgs after this command, all commands after that are pointless and it looks like you nuked far more than your /usr/local/.

At this point maybe best thing to do will be to copy /home/<your_user_name>/ somewhere (if you have anything of importance there) and reinstall FreeBSD from scratch.
 
What was your output of pkg query -e '%a = 0' '%n'?
I said:

If this worked, you probably mistyped something in the steps after that I recommended, but if you didn't see list of pkgs after this command, all commands after that are pointless and it looks like you nuked far more than your /usr/local/.

At this point maybe best thing to do will be to copy /home/<your_user_name>/ somewhere (if you have anything of importance there) and reinstall FreeBSD from scratch.
Hi vmisev

The output can be found.

root@localhost:/ # pkg query -e '%a = 0' '%n' | nc termbin.com 9999



Thanks
rraj
 
That's great! Now please read again #16 carefully and try it again step by step, making sure that you type everything correctly.

And please, don't add full stop ( . ) to the end of termbin links.
 
That's great! Now please read again #16 carefully and try it again step by step, making sure that you type everything correctly.

And please, don't add full stop ( . ) to the end of termbin links.
Hi

Everything went as normal. But the ending remains as previously in #34.

Thanks
rraj
 
What is the output of pkg update -f ?
Hi

The requested output in previous post is:
Code:
[rraj@localhost ~]$ doas pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01    
Fetching data.pkg: 100%   10 MiB 864.0kB/s    00:12    
Processing entries: 100%
Fetching provides database: 100%   20 MiB 724.6kB/s    00:29    
Extracting database....success
FreeBSD repository update completed. 35671 packages processed.
Updating FreeBSD-kmods repository catalogue...
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01    
Fetching data.pkg: 100%   30 KiB  30.7kB/s    00:01    
Processing entries: 100%
The provides database is up-to-date.
FreeBSD-kmods repository update completed. 210 packages processed.
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01    
Fetching data.pkg: 100%   48 KiB  49.2kB/s    00:01    
Processing entries: 100%
The provides database is up-to-date.
FreeBSD-base repository update completed. 525 packages processed.
All repositories are up to date.
Thanks
rraj
 
Great! Now just doas pkg upgrade -f

P.S. Hm, how that doas is working when you said that you deleted all in /usr/local ?
 
Great! Now just doas pkg upgrade -f

P.S. Hm, how that doas is working when you said that you deleted all in /usr/local ?
Hi

pkg upgrade -f deinstalled deleted & then reinstalled everything along with newer packages.

Thanks
rraj
 
Back
Top