For system with lot of packages execution of:
https://github.com/xaque208/puppet-pkgng/blob/2.1.1/lib/facter/pkg_updates.rb#L8:
50338 1 S 0:00.01 /usr/sbin/pkg version -ql<
50339 1 D 0:00.12 /usr/sbin/pkg version -ql<
for pkg_has_updates facts always lock pkg for a long time and user can do anything with pkg. The problem is the slow 'pkg version' execution when ports not installed (and fetchindex not performed).
For example, on a PC with desktop role (KDE5) and 1746 packages this operation may take ~ 20 minutes (no ssd, one hdd).
More details: freebsd/pkg#1739
it would be nice to regulate this behavior and be able to turn off. Or try to find another solution, for example pkg dry-run:
pkg upgrade -Unq
or
pkg version -RU