/ docs / pkg-upgrade.8
pkg-upgrade.8
  1  .\"
  2  .\" FreeBSD pkg - a next generation package for the installation and
  3  .\" maintenance of non-core utilities.
  4  .\"
  5  .\" Redistribution and use in source and binary forms, with or without
  6  .\" modification, are permitted provided that the following conditions
  7  .\" are met:
  8  .\" 1. Redistributions of source code must retain the above copyright
  9  .\"    notice, this list of conditions and the following disclaimer.
 10  .\" 2. Redistributions in binary form must reproduce the above copyright
 11  .\"    notice, this list of conditions and the following disclaimer in the
 12  .\"    documentation and/or other materials provided with the distribution.
 13  .\"
 14  .\"
 15  .\"     @(#)pkg.8
 16  .\"
 17  .Dd July 7, 2024
 18  .Dt PKG-UPGRADE 8
 19  .Os
 20  .Sh NAME
 21  .Nm "pkg upgrade"
 22  .Nd perform upgrades of package software distributions
 23  .Sh SYNOPSIS
 24  .Nm
 25  .Op Fl fInFqUy
 26  .Op Fl r Ar reponame ...
 27  .Op Fl Cgix
 28  .Op Ar <pkg-origin|pkg-name|pkg-name-version> ...
 29  .Pp
 30  .Nm
 31  .Op Cm --{force,no-scripts,dry-run,fetch-only,autoremove}
 32  .Op Cm --{quiet,no-repo-update,yes}
 33  .Op Cm --repository Ar reponame ...
 34  .Op Cm --{case-sensitive,glob,case-insensitive,regex}
 35  .Op Ar <pkg-origin|pkg-name|pkg-name-version> ...
 36  .Sh DESCRIPTION
 37  .Nm
 38  is used for upgrading packaged software distributions.
 39  .Pp
 40  .Nm
 41  compares the versions of all or specific packages installed on the system
 42  to what is available in the configured package repositories.
 43  Any out of date packages are added to a work list for processing.
 44  The difference to
 45  .Xr pkg-install 8
 46  is that
 47  .Nm
 48  tries to upgrade dependencies of packages matched as well while
 49  .Xr pkg-install 8
 50  is more conservative during dependencies upgrade.
 51  Moreover,
 52  .Nm
 53  will not install new packages, except as required to fulfil dependencies of
 54  the packages listed on the command line.
 55  A caller should ensure that patterns specified as arguments have installed
 56  candidates for matching.
 57  If the
 58  .Fl f
 59  (force) flag is given, all installed packages are added to the work
 60  list.
 61  .Pp
 62  The package metadata downloaded from the repositories is then examined
 63  for each of the packages in the work list, and any missing
 64  dependencies are added to the work list as install jobs.
 65  Such implicitly added packages are flagged as candidates for
 66  autoremoval.
 67  See
 68  .Xr pkg-autoremove 8
 69  for details.
 70  .Pp
 71  Autoremoval flags are sticky, and will persist over reinstallation or
 72  upgrade of the packages concerned, even if subsequently the packages
 73  are named explicitly on a command line.
 74  See
 75  .Xr pkg-query 8
 76  for finding the autoremoval status of a package, and
 77  .Xr pkg-set 8
 78  for modifying it.
 79  .Pp
 80  Where a package on the work list supplies a shared library, and that
 81  library has been updated, all packages requiring that shared library
 82  will also be added to the work list as reinstallation jobs.
 83  .Pp
 84  The work list is sorted into dependency order and
 85  .Nm
 86  will present it to the user for approval before proceeding, unless
 87  overridden by the
 88  .Fl y
 89  option or the
 90  .Cm ASSUME_ALWAYS_YES
 91  setting in
 92  .Pa pkg.conf .
 93  .Pp
 94  Packages are fetched from the repositories into the local package
 95  cache if they are not already present, or if the checksum of the
 96  cached package file differs from the one in the repository.
 97  Packages may be downloaded from any of the repositories mentioned
 98  in
 99  .Xr pkg.conf 5
100  or in the files in
101  .Pa /usr/local/etc/pkg/repo .
102  See
103  .Xr pkg-repository 5
104  for details.
105  .Pp
106  Package repository catalogues will be automatically updated whenever
107  .Nm
108  is run by a user ID with write access to the package database,
109  unless disabled by the
110  .Fl U
111  flag or setting
112  .Cm REPO_AUTOUPDATE
113  to
114  .Sy NO
115  in
116  .Xr pkg.conf 5 .
117  .Pp
118  Finally, the work list is executed in dependency order.
119  Package reinstall or update jobs are processed by removing the currently
120  installed package and immediately installing the replacement.
121  New dependencies are processed as installation jobs as part of the
122  work list.
123  .Sh OPTIONS
124  The following options are supported by
125  .Nm :
126  .Bl -tag -width repository
127  .It Fl C , Cm --case-sensitive
128  Make the standard or the regular expression
129  .Fl ( x )
130  matching against
131  .Ar pkg-name
132  case sensitive.
133  .It Fl F , Cm --fetch-only
134  Do not perform installation of packages, merely fetch packages that should be
135  upgraded and detect possible conflicts.
136  .It Fl f , Cm --force
137  Force the reinstallation or upgrade of the whole set of packages.
138  To reinstall a single specific package, prefer using
139  .Nm pkg install Fl f
140  instead.
141  See
142  .Xr pkg-install 8 .
143  .It Fl g , Cm --glob
144  Treat the package names as shell glob patterns.
145  .It Fl I , Cm --no-scripts
146  If any installation scripts (pre-install or post-install) or deinstallation
147  scripts (pre-deinstall or post-deinstall) exist for a given package, do not
148  execute them.
149  .It Fl i , Cm --case-insensitive
150  Make the standard or the regular expression
151  .Fl ( x )
152  matching against
153  .Ar pkg-name
154  case insensitive.
155  This is the default, unless modified by setting
156  .Ev CASE_SENSITIVE_MATCH
157  to true in
158  .Pa pkg.conf .
159  .It Fl n , Cm --dry-run
160  Dry-run mode: show what packages have updates available, but do not perform
161  any upgrades.
162  Repository catalogues will be updated as usual unless the
163  .Fl U
164  option is also given.
165  .It Fl q , Cm --quiet
166  Force quiet output, except when
167  .Fl n
168  is used, where a summary of the work list is always displayed.
169  .It Fl r Ar reponame , Cm --repository Ar reponame
170  Install packages from only the named repository.
171  This option can be specified multiple times to use several repositories.
172  Packages will be fetched from the named repositories only, irrespective of the configured
173  .Dq enabled
174  status from
175  .Pa repo.conf .
176  .It Fl U , Cm --no-repo-update
177  Suppress the automatic update of the local copy of the repository catalogue
178  from remote.
179  Automatic repository catalogue updates are only attempted when the
180  effective UID of the process has write access to the package database.
181  Otherwise they are silently ignored.
182  .It Fl v , Cm --vulnerable
183  Upgrade packages which are known to be vulnerable.
184  See
185  .Xr pkg-audit 8
186  for more details.
187  .It Fl x , Cm --regex
188  Treat the package names as regular expressions according to the
189  "modern" or "extended" syntax of
190  .Xr re_format 7 .
191  .It Fl y , Cm --yes
192  Assume yes when asked for confirmation before package installation.
193  .It Cm --autoremove
194  After upgrading the requested packages, automatically remove any orphaned
195  packages that were installed as dependencies and are no longer required.
196  This is equivalent to running
197  .Xr pkg-autoremove 8
198  after the upgrade.
199  Can also be enabled permanently via the
200  .Cm AUTOREMOVE
201  option in
202  .Xr pkg.conf 5 .
203  .It Cm --script-no-exec
204  Do not execute the pre-install, post-install, pre-deinstall, or post-deinstall
205  scripts but still log the scripts in the package database for future reference.
206  Unlike
207  .Fl I ,
208  which prevents scripts from both running and being recorded,
209  .Cm --script-no-exec
210  only suppresses execution.
211  .El
212  .Sh ENVIRONMENT
213  The following environment variables affect the execution of
214  .Nm .
215  See
216  .Xr pkg.conf 5
217  for further description.
218  .Bl -tag -width ".Ev NO_DESCRIPTIONS"
219  .It Ev DEFAULT_ALWAYS_YES
220  .It Ev ASSUME_ALWAYS_YES
221  .It Ev HANDLE_RC_SCRIPTS
222  .It Ev PKG_CACHEDIR
223  .It Ev PKG_DBDIR
224  .It Ev REPO_AUTOUPDATE
225  .El
226  .Sh FILES
227  See
228  .Xr pkg.conf 5 .
229  .Sh SEE ALSO
230  .Xr pkg_create 3 ,
231  .Xr pkg_printf 3 ,
232  .Xr pkg_repo_create 3 ,
233  .Xr pkg_repos 3 ,
234  .Xr pkg-keywords 5 ,
235  .Xr pkg-lua-script 5 ,
236  .Xr pkg-repository 5 ,
237  .Xr pkg-script 5 ,
238  .Xr pkg-triggers 5 ,
239  .Xr pkg.conf 5 ,
240  .Xr pkg 8 ,
241  .Xr pkg-add 8 ,
242  .Xr pkg-alias 8 ,
243  .Xr pkg-annotate 8 ,
244  .Xr pkg-audit 8 ,
245  .Xr pkg-autoremove 8 ,
246  .Xr pkg-check 8 ,
247  .Xr pkg-clean 8 ,
248  .Xr pkg-config 8 ,
249  .Xr pkg-create 8 ,
250  .Xr pkg-delete 8 ,
251  .Xr pkg-fetch 8 ,
252  .Xr pkg-help 8 ,
253  .Xr pkg-info 8 ,
254  .Xr pkg-install 8 ,
255  .Xr pkg-key 8 ,
256  .Xr pkg-lock 8 ,
257  .Xr pkg-plugins 8 ,
258  .Xr pkg-query 8 ,
259  .Xr pkg-register 8 ,
260  .Xr pkg-repo 8 ,
261  .Xr pkg-repositories 8 ,
262  .Xr pkg-rquery 8 ,
263  .Xr pkg-search 8 ,
264  .Xr pkg-set 8 ,
265  .Xr pkg-shell 8 ,
266  .Xr pkg-shlib 8 ,
267  .Xr pkg-ssh 8 ,
268  .Xr pkg-stats 8 ,
269  .Xr pkg-triggers 8 ,
270  .Xr pkg-unregister 8 ,
271  .Xr pkg-update 8 ,
272  .Xr pkg-updating 8 ,
273  .Xr pkg-version 8 ,
274  .Xr pkg-which 8