PKG-LOCK(8)
π pkg lock / pkg unlock β system manager's manual (PKG-LOCK(8))
okay so bestie, listen up β this is the manual page for pkg lock and pkg unlock, and it's literally the β¨ main character energy β¨ of package management on your system. no cap, if you've ever wanted to just freeze a package in place so nothing touches it, this is your moment. periodt.
πΈ NAME πΈ
pkg lock, pkg unlock β lock or unlock packages. that's it. that's the whole vibe. π
β¨ SYNOPSIS β¨
pkg lock [-lqy] [-a]
pkg lock [-lqy] [-Cgix] pkg-name ...
pkg unlock [-lqy] [-a]
pkg unlock [-lqy] [-Cgix] pkg-name ...
pkg lock [--{show-locked,quiet,yes}] [--all]
pkg lock --has-locked-packages
pkg lock [--{show-locked,quiet,yes}]
[--{case-sensitive,glob,case-insensitive,regex}] pkg-name ...
pkg unlock [--{show-locked,quiet,yes}] [--all]
pkg unlock [--{show-locked,quiet,yes}]
[--{case-sensitive,glob,case-insensitive,regex}] pkg-name ...
okay so that looks like a lot of brackets, but honestly it's giving "i have options and i'm not afraid to use them." π
π₯ DESCRIPTION π₯
pkg lock is the tool you use to lock packages against reinstallation, modification, or deletion. pkg unlock does the opposite β it unlocks the named packages. either variant only has an effect on currently installed packages. so real talk: you can't block installation of a brand-new package using this mechanism, unless that installation would imply updating a locked package. sorry bestie, that's just how it is. π
the impact of locking a package is wider than just "don't touch this one package." any operation that implies modification of the locked package will be blocked. and when i say any, i mean:
- attempts to reinstall, upgrade, downgrade, or delete the locked package itself. literally leave it alone. π«Ά
- installation, upgrade, or downgrade of a package where the resultant package would have a dependency on a different version of the locked package. yeah, dependencies are messy like that.
- deletion, upgrade, or downgrade of any package the locked package depends upon, either directly or as a consequence of installing or upgrading some third package. the whole tree gets protective energy. π³
β οΈ so basically, locking one package is giving "you shall not pass" to a whole chain of operations. plan accordingly, bestie.
π OPTIONS π
the following options are supported by pkg lock:
-a,--allβ lock or unlock all installed packages. all of them. every single one. no survivors. π-C,--case-sensitiveβ make the standard or the regular expression (-x) matching against pkg-name case sensitive. soFooandfooare NOT the same vibe. respect the case. π-g,--globβ treat pkg-name as a shell glob pattern. like*and?and all that jazz. β¨-i,--case-insensitiveβ make the standard or the regular expression (-x) matching against pkg-name case insensitive. this is the default, unless modified by settingCASE_SENSITIVE_MATCHto true inpkg.conf. so yeah,Fooandfooare besties by default. π«Ά-l,--show-lockedβ show a list of all locked packages. this can be used without locking or unlocking any packages, in which case privileged access to the package database is not required. otherwise it will be displayed after any lock or unlock operations. so you can peek at the locked list without sudo. iconic. π-q,--quietβ operate quietly: do not output anything other than confirmatory questions. so no extra chatter. just the essentials. π€«-x,--regexβ treat pkg-name as a regular expression according to the "modern" or "extended" syntax ofre_format(7). get your regex on. π£-y,--yesβ assume "yes" as the answer to all questions. no take-backs. no second thoughts. just yes. β--has-locked-packagesβ return0if at least one package is locked,1otherwise. perfect for scripting. exit status realness. π
π ENVIRONMENT π
the following environment variables affect the execution of pkg lock. see pkg.conf(5) for further description.
PKG_DBDIRDEFAULT_ALWAYS_YESASSUME_ALWAYS_YESCASE_SENSITIVE_MATCH
these are the vibes that influence how pkg lock behaves. iykyk. π§
π FILES π
see pkg.conf(5). that's where the file info lives. go check it out. π¦
β SEE ALSO β
pkg_create(3), pkg_printf(3), pkg_repo_create(3), pkg_repos(3), pkg-keywords(5), pkg-lua-script(5), pkg-repository(5), pkg-script(5), pkg-triggers(5), pkg.conf(5), pkg(8), pkg-add(8), pkg-alias(8), pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-check(8), pkg-clean(8), pkg-config(8), pkg-create(8), pkg-delete(8), pkg-fetch(8), pkg-help(8), pkg-info(8), pkg-install(8), pkg-key(8), pkg-plugins(8), pkg-query(8), pkg-register(8), pkg-repo(8), pkg-repositories(8), pkg-rquery(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-shlib(8), pkg-ssh(8), pkg-stats(8), pkg-triggers(8), pkg-unregister(8), pkg-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8), pkg-which(8)
like, that's a whole friend group of man pages. go say hi. π
π this page is from Debian, dated March 19, 2024. system manager's manual, PKG-LOCK(8). stay slay, stay locked, and don't let anyone touch your packages without permission. periodt. π β¨
π¦ where this page comes from
- nixos 26.05: pkg 2.7.5
- nixpkgs unstable: pkg 2.7.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms