/ docs / pkg-check.8
pkg-check.8
  1  .\"
  2  .\" FreeBSD pkg - a next generation package for the installation and maintenance
  3  .\" 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 May 2, 2024
 18  .Dt PKG-CHECK 8
 19  .Os
 20  .Sh NAME
 21  .Nm "pkg check"
 22  .Nd sanity check installed packages
 23  .Sh SYNOPSIS
 24  .Nm
 25  .Sm off
 26  .Fl d | Fl s | Fl m
 27  .Sm on
 28  .Op Fl nqvy
 29  .Fl a
 30  .Nm
 31  .Sm off
 32  .Fl d | Fl s | Fl m
 33  .Sm on
 34  .Op Fl nqvy
 35  .Op Fl Cgix
 36  .Ar pattern
 37  .Pp
 38  .Nm
 39  .Fl -{dependencies,checksums,metadata}
 40  .Op Fl -{dry-run,quiet,verbose,yes}
 41  .Fl -all
 42  .Nm
 43  .Fl -{dependencies,checksums,metadata}
 44  .Op Fl -{dry-run,quiet,verbose,yes}
 45  .Op Fl -{case-sensitive,glob,case-insensitive,regex}
 46  .Ar pattern
 47  .Sh DESCRIPTION
 48  .Nm
 49  .Fl d
 50  or
 51  .Nm
 52  .Fl -dependencies
 53  checks for and installs missing dependencies.
 54  .Pp
 55  .Nm
 56  .Fl m
 57  or
 58  .Nm
 59  .Fl -metadata
 60  checks for metadata discrepancies between the recorded state in pkgdb and the filesystem.
 61  .Pp
 62  .Nm
 63  .Fl s
 64  or
 65  .Nm
 66  .Fl -checksums
 67  detects installed packages with invalid checksums.
 68  An invalid checksum can be caused by data corruption or tampering.
 69  .Sh OPTIONS
 70  These options are supported by
 71  .Nm :
 72  .Bl -tag -width dependencies
 73  .It Fl a , Fl -all
 74  Process all packages.
 75  .It Fl C , Fl -case-sensitive
 76  Use case sensitive standard or regular expression
 77  .Fl ( x )
 78  matching with
 79  .Ar pattern .
 80  .It Fl d , Fl -dependencies
 81  Checks for and installs missing dependencies
 82  .It Fl g , Fl -glob
 83  Treat
 84  .Ar pattern
 85  as a shell glob pattern.
 86  .It Fl i , Fl -case-insensitive
 87  Use case insensitive standard or regular expression
 88  .Fl ( x )
 89  matching with
 90  .Ar pattern .
 91  This is the default unless
 92  .Ev CASE_SENSITIVE_MATCH
 93  has been set to true in
 94  .Pa pkg.conf .
 95  .It Fl m , Fl -metadata
 96  Checks for metadata discrepancies between the recorded state in pkgdb and the filesystem.
 97  .It Fl n , Fl -dry-run
 98  Only check for missing dependencies, do not install them.
 99  .It Fl s , Fl -checksums
100  Detects installed packages with invalid checksums
101  .It Fl v , Fl -verbose
102  Be verbose.
103  .It Fl q , Fl -quiet
104  Suppress most output, except for error messages and data that the
105  command explicitly requests.
106  This is primarily intended for scripting use.
107  .It Fl x , Fl -regex
108  Treat
109  .Ar pattern
110  as a regular expression, using the "modern" or "extended" syntax
111  described in
112  .Xr re_format 7 .
113  .It Fl y , Fl -yes
114  Assume "yes" when asked for confirmation before installing missing
115  dependencies.
116  .El
117  .Sh ENVIRONMENT
118  These environment variables affect the execution of
119  .Nm .
120  See
121  .Xr pkg.conf 5
122  for additional information.
123  .Bl -tag -width ".Ev NO_DESCRIPTIONS"
124  .It Ev PKG_DBDIR
125  .It Ev CASE_SENSITIVE_MATCH
126  .El
127  .Sh FILES
128  See
129  .Xr pkg.conf 5 .
130  .Sh EXAMPLES
131  Test for missing dependencies needed by nano, installing any that are
132  missing:
133  .Bd -literal -offset indent
134  pkg check -d nano
135  .Ed
136  .Pp
137  Test the checksums of all installed packages to make sure none are
138  corrupted:
139  .Bd -literal -offset indent
140  pkg check -sa
141  .Ed
142  .Pp
143  If corrupted packages are found, they can be reinstalled using:
144  .Bd -literal -offset indent
145  pkg install -f <package-name>
146  .Ed
147  .Sh SEE ALSO
148  .Xr pkg_create 3 ,
149  .Xr pkg_printf 3 ,
150  .Xr pkg_repo_create 3 ,
151  .Xr pkg_repos 3 ,
152  .Xr pkg-keywords 5 ,
153  .Xr pkg-lua-script 5 ,
154  .Xr pkg-repository 5 ,
155  .Xr pkg-script 5 ,
156  .Xr pkg-triggers 5 ,
157  .Xr pkg.conf 5 ,
158  .Xr pkg 8 ,
159  .Xr pkg-add 8 ,
160  .Xr pkg-alias 8 ,
161  .Xr pkg-annotate 8 ,
162  .Xr pkg-audit 8 ,
163  .Xr pkg-autoremove 8 ,
164  .Xr pkg-clean 8 ,
165  .Xr pkg-config 8 ,
166  .Xr pkg-create 8 ,
167  .Xr pkg-delete 8 ,
168  .Xr pkg-fetch 8 ,
169  .Xr pkg-help 8 ,
170  .Xr pkg-info 8 ,
171  .Xr pkg-install 8 ,
172  .Xr pkg-key 8 ,
173  .Xr pkg-lock 8 ,
174  .Xr pkg-plugins 8 ,
175  .Xr pkg-query 8 ,
176  .Xr pkg-register 8 ,
177  .Xr pkg-repo 8 ,
178  .Xr pkg-repositories 8 ,
179  .Xr pkg-rquery 8 ,
180  .Xr pkg-search 8 ,
181  .Xr pkg-set 8 ,
182  .Xr pkg-shell 8 ,
183  .Xr pkg-shlib 8 ,
184  .Xr pkg-ssh 8 ,
185  .Xr pkg-stats 8 ,
186  .Xr pkg-triggers 8 ,
187  .Xr pkg-unregister 8 ,
188  .Xr pkg-update 8 ,
189  .Xr pkg-updating 8 ,
190  .Xr pkg-upgrade 8 ,
191  .Xr pkg-version 8 ,
192  .Xr pkg-which 8