How to tell what pkgs are installed

Is there some way of being able to detect which pkgs have been installed on a disk which is mounted but not booted from?

ie can you create a list by checking a mounted var/cache/pkg or perhaps you can use pkg-info() redirected to mount point, or via chroot...
 
Is there some way of being able to detect which pkgs have been installed on a disk which is mounted but not booted from?
You can access the /var/db/pkg/local.sqlite database with sqlite3(1). It's just a database file.
ie can you create a list by checking a mounted var/cache/pkg
Not that worthwhile to look at, if they're like me it's going to be empty most of the time (I run pkg clean -a regularly).
 
You can use chroot(8), or use pkg(8):

pkg -c /mnt info
I was trying to find which pkgs had been installed in a jail. Here is what I got:-

Code:
# pkg -c /mnt/nas/iocage/jails/server/root/var/db/pkg info
pkg: Unable to determine the ABI

pkg: Unable to determine the ABI

pkg: Unable to determine ABI
pkg: Cannot parse configuration file!

Need to find some other way.
 
# pkg -c /mnt/nas/iocage/jails/server/root/var/db/pkg info
That can't work. You are chrooting pkg into directory /mnt/nas/iocage/jails/server/root/var/db/pkg. pkg needs to chrooted into the root directory, wherever root is, jail or otherwise.

It should be:
# pkg -c /mnt/nas/iocage/jails/server/root info or

# pkg -c /mnt/nas/iocage/jails/server info Not sure why you have a root directory there.
 
Thanks the former works. The 'root' directory is something which FreeNAS uses when creating a jail.
 
Back
Top