How to tell what pkgs are installed

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,612
Messages: 37,944

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).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,612
Messages: 37,944

Same answers too, I like the consistency :)
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Well, at my age, memory is getting weaker....;)
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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.
 

T-Daemon

Daemon

Reaction score: 789
Messages: 1,626

# 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.
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Thanks the former works. The 'root' directory is something which FreeNAS uses when creating a jail.
 
Top