pkg-list-sets(1)
NAME
pkg-list-sets - list installed package sets, or every set in the chain
SYNOPSIS
pkg list-sets [--all]
DESCRIPTION
A set is a named list of packages, like +console or +xfce. Install one and pkg remembers the set itself, not just the packages it expanded to. That's what makes it a selection root: when the set changes upstream, the next upgrade follows it. See pkg-sets(7).
With no options, pkg list-sets lists the sets this machine is rooted on: the set roots recorded in /var/lib/pkg/roots.toml.
With --all, it lists every set published across the repository chain as well, and says for each one whether it's installed.
What about a set that vanished?
An installed root the chain no longer defines is listed either way. A set that disappeared upstream is exactly the thing you need to see, so it's never silently dropped. It shows - for a member count, and a note saying why it didn't resolve.
How is this different from pkg list?
This command asks how much of each set is installed. pkg list --collapse sets asks the same roots the other way round: how much of what's installed each set explains, and it folds the listing accordingly. See pkg-list(1).
pkg set list is an older spelling of pkg list-sets --all.
Does it need the network?
Not without --all. The set definitions come from the metadata pkg has already verified and cached, the same way pkg-list(1) reads them, so this works offline. With --all, it lists the chain, which means asking the repositories, and it fails if they can't be reached.
OPTIONS
--all- List every set published in the chain, not just the installed ones.
All global options apply; see pkg(1).
STATE HANDLING
Listing the installed sets is a question about installed state, so a state database that can't be read is fatal there.
Under --all the chain is the answer, and the installed state only annotates it. So an unreadable state, which is the normal case when you're not root, just gets a warning. The state column drops out, and the member count shows the total alone.
OUTPUT
Installed only:
set members description +console 22/22 Standard console tools
With --all, there's a state column:
set state members description +archive available 0/13 Archive and compression format tools +console installed 22/22 Standard console tools +xfce available 0/36 XFCE desktop environment
The member count is installed/total. It's just total when the installed state is unknown, and - for a set that doesn't expand, with the reason in place of the description.
When there's nothing to show, it's one of:
(no sets installed) (no sets published in the chain)
JSON
{ "ok": true, "source": "installed" | "chain", "sets": [ { "name":..., "description":..., "installed": true|false|null, "member_count":..., "members_total":..., "members_installed":..., "unresolved": null } ] }
member_count counts the direct members. members_total counts them after nested set references are expanded. installed and members_installed are null when the installed state couldn't be read. unresolved carries the reason when a set couldn't be expanded.
EXAMPLES
What is this machine rooted on?
pkg list-sets
What could it be rooted on?
pkg list-sets --all pkg set list
Before installing a set
Look at what's there, look inside the one you want, then install it:
pkg list-sets --all pkg set show +xfce pkg install +xfce
Sets that are partially installed
pkg --json list-sets --all \ | jq -r '.sets[] | select(.members_installed > 0 and .members_installed < .members_total) | "(.name) (.members_installed)/(.members_total)"'
A partially installed set that isn't a root is just a coincidence of dependencies. A partially installed set that is a root means members are held; see pkg-upgrade(1).
Sets that no longer resolve
pkg --json list-sets | jq -r '.sets[] | select(.unresolved) | .name'
A root in this state holds up the orphan sweep; see pkg-autoremove(1). Either fix the chain or drop the root:
pkg repo list --all pkg remove +stale-set
Just the names
pkg --json list-sets --all | jq -r '.sets[].name'
On a mounted image
pkg --state-root /mnt/image/var/lib/pkg list-sets
EXIT STATUS
0 on success, including an empty list. 1 when the installed state can't be read and --all wasn't given.
SEE ALSO
pkg(1), pkg-list(1), pkg-set(1), pkg-install(1), pkg-remove(1), pkg-autoremove(1), pkg-state(5), pkg-sets(7), pkg-chain(7)
docs/design/package-sets.md