.Dd September 27, 2026 .Dt DELPKG 8 .Os .Sh NAME .Nm delpkg .Nd remove an installed package .Sh SYNOPSIS .Nm .Op Fl f .Op Fl r Ar root .Ar package .Nm .Fl h | v .Sh DESCRIPTION .Nm removes the installed package named .Ar package . It must be run as root. .Pp It refuses to remove a package that owns the modules of the running kernel, .Pa lib/modules/ Ns Ar release , or the last package owning anything under .Pa lib/modules/ , since that would leave no bootable kernel. The first check is only made when the root is .Pa / . .Pp The removal runs these steps, in order: .Bl -enum -offset indent .It Read the package metadata. .It Disable the declared services: remove the .Pa /service/ Ns Ar name link, then stop the service with .Ic sv exit if it is running. .It Remove the package's files, deepest first. Files and directories that another package owns are kept. Leftover .Pa file.new copies of its configuration files are removed as well. .It Remove the now empty service directories under .Pa /etc/sv . .It Run .Xr ldconfig 8 and the triggers described in .Xr addpkg 8 . .It Remove the declared users, and the declared groups that no other installed package declares. Groups of the base system are never removed. .It Remove the package from the database. .El .Pp The options are as follows: .Bl -tag -width Ds .It Fl f Remove a kernel package despite the checks above. .It Fl h Print a usage summary. .It Fl r Ar root Remove from .Ar root instead of .Pa / . .It Fl v Print the version. .El .Sh ENVIRONMENT .Bl -tag -width PKG_DBDIR .It Ev PKG_ROOT Root if .Fl r is not given. .It Ev PKG_DBDIR Package database directory; see .Xr addpkg 8 . .El .Sh FILES .Bl -tag -width Ds -compact .It Pa /var/lib/pkg/db Package database. .It Pa /var/lib/pkg/meta/ Ns Ar name Package metadata. .El .Sh EXIT STATUS .Ex -std It fails if the files were removed but the database could not be written. .Sh SEE ALSO .Xr addpkg 8 , .Xr infopkg 8 , .Xr pkg 8