Re: PKGBASE Removes FreeBSD Base System Feature

From: vermaden <vermaden_at_interia.pl>
Date: Fri, 08 Aug 2025 22:12:30 UTC
After that PKGBASE deletion I was not able to stop that 'now empty' Jail.

Solution was to 'fill' it with content from ANY Jail to allow stop scripts to function.

    # rsync-delete.sh /jail/fbsdjail /jail/bsdinstalljail

The 'rsync-delete.sh' script is here:
- https://github.com/vermaden/scripts/blob/master/rsync-delete.sh

After that I was able to stop it with 'typical' commands.

Hope that helps.

Regards,
vermaden









Temat: Re: PKGBASE Removes FreeBSD Base System Feature
Data: 2025-08-08 17:03
Nadawca: "vermaden" &lt;vermaden@interia.pl>
Adresat: "Dag-Erling Smørgrav" &lt;des@FreeBSD.org>; "sthaug@nethelp.no" &lt;sthaug@nethelp.no>; 
DW: "freebsd-current@freebsd.org" &lt;freebsd-current@freebsd.org>; "freebsd-stable@freebsd.org" &lt;freebsd-stable@freebsd.org>; freebsd-pkgbase@FreeBSD.org; 

> 
> > Current 'vital' thing does NOTHING to protect FreeBSD Base
System.
> 
> I literally just wiped one of my Jails because of this 'vital'
protection.
> 
> That 'vital' thing is useless in current state after issuing this
command:
> 
> # pkg delete -af
> 
> Log below.
> 
> Unbootable and unusable FreeBSD left after the command that only
removed packages without PKGBASE and with PKGBASE you are left with dust.
> 
> Even /rescue is gone.
> 
> root@bsdinstalljail:/ # pkg info
> FreeBSD-acct-14.1p1            System Accounting Utilities
> FreeBSD-acct-man-14.1          System Accounting Utilities (Manual
Pages)
> FreeBSD-acpi-14.1              ACPI Utilities
> (...)
> FreeBSD-zfs-dev-14.1p1         ZFS Libraries and Utilities
(Development Files)
> FreeBSD-zfs-man-14.1           ZFS Libraries and Utilities (Manual
Pages)
> FreeBSD-zoneinfo-14.1p7        zoneinfo package
> beadm-1.3.5_1                  Solaris-like utility to manage Boot
Environments on ZFS
> pkg-2.2.1                      Package manager
> 
> root@bsdinstalljail:/ # pkg delete -af
> Checking integrity... done (0 conflicting)
> Deinstallation has been requested for the following 271 packages (of 0
packages in the universe):
> 
> Installed packages to be REMOVED:
>         FreeBSD-acct: 14.1p1
>         FreeBSD-acct-man: 14.1
>         FreeBSD-acpi: 14.1
> (...)
> [bsdinstalljail.lab.org] [268/271] Deleting files for
FreeBSD-zfs-man-14.1: 100%
> [bsdinstalljail.lab.org] [269/271] Deinstalling
FreeBSD-zoneinfo-14.1p7...
> [bsdinstalljail.lab.org] [269/271] Deleting files for
FreeBSD-zoneinfo-14.1p7: 100%
> [bsdinstalljail.lab.org] [270/271] Deinstalling beadm-1.3.5_1...
> [bsdinstalljail.lab.org] [270/271] Deleting files for beadm-1.3.5_1:
100%
> [bsdinstalljail.lab.org] [271/271] Deinstalling pkg-2.2.1...
> [bsdinstalljail.lab.org] [271/271] Deleting files for pkg-2.2.1: 100%
> pkg: Cannot runscript POST-DEINSTALL:No such file or directory
> You may need to manually remove /usr/local/etc/pkg.conf if it is no
longer needed.
> 
> root@bsdinstalljail:/ # ls
> /bin/sh: ls: not found
> 
> root@bsdinstalljail:/ # vi
> /bin/sh: vi: not found
> 
> root@bsdinstalljail:/ # pkg
> /bin/sh: pkg: not found
> 
> root@bsdinstalljail:/ # pkg-static
> /bin/sh: pkg-static: not found
> 
> root@bsdinstalljail:/ # reboot
> /bin/sh: reboot: not found
> 
> root@bsdinstalljail:/ # goodbye
> /bin/sh: goodbye: not found
> 
> root@bsdinstalljail:/ # /rescue/ls /rescue
> /bin/sh: /rescue/ls: not found
> 
> root@bsdinstalljail:/ # /rescue/ls.pkgsave /rescue
> rescue: ls.pkgsave not compiled in
> usage: rescue   ..., where  is one of:
>  cat chflags chio chmod cp date dd df echo ed red expr getfacl
hostname kenv
>  kill ln link ls mkdir mv pkill pgrep ps pwd realpath rm unlink rmdir
setfacl
>  sh -sh sleep stty sync test [ csh -csh tcsh -tcsh camcontrol clri
devfs dmesg
>  dump rdump dumpfs dumpon fsck fsck_ffs fsck_4.2bsd fsck_ufs
fsck_msdosfs fsdb
>  fsirand gbde geom glabel gpart ifconfig init kldconfig kldload
kldstat
>  kldunload ldconfig md5 mdconfig mdmfs mknod mount mount_cd9660
mount_msdosfs
>  mount_nfs mount_nullfs mount_udf mount_unionfs newfs newfs_msdos
nos-tun
>  reboot fastboot halt fasthalt restore rrestore rcorder route savecore
shutdown
>  poweroff swapon sysctl tunefs umount ccdconfig ping ping6 rtsol ipf
routed
>  rtquery bectl zfs zpool bsdlabel disklabel fdisk dhclient head mt sed
tail tee
>  gzip gunzip gzcat zcat bzip2 bunzip2 bzcat less more xz unxz lzma
unlzma xzcat
>  lzcat zstd unzstd zstdcat zstdmt fetch tar nc vi ex id groups whoami
iscsictl
>  zdb chroot chown chgrp iscsid rescue
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Temat: Re: PKGBASE Removes FreeBSD Base System Feature
> Data: 2025-08-08 10:31
> Nadawca: "Dag-Erling Smørgrav" &lt;des@FreeBSD.org>
> Adresat: sthaug@nethelp.no; 
> DW: freebsd-current@freebsd.org; freebsd-stable@freebsd.org; 
> 
>> 
>>> sthaug@nethelp.no writes:
>>> - It's important to have a clean separation between the base system
>>> (whether that is installed using the package system or not) and the
>>> rest. An easy way to list "these are the base system packages" is
>>> absolutely needed.
>> 
>> You can easily create an alias for this:
>> 
>>     pkg query -e '%o = base' %n
>> 
>> If you want something closer to `pkg info`, try:
>> 
>>     pkg query -e '%o = base' '%n-%v %c' | column -tl 2
>> 
>>> - Maybe there should be an extra step if you try to delete packages
>>> from the base system?
>> 
>> There already is:
>> 
>>     % sudo pkg delete FreeBSD-clibs
>>     Checking integrity... done (0 conflicting)
>>     The following package(s) are locked or vital and may not be
> removed:
>>     
>>             FreeBSD-clibs
>>     
>>     1 packages requested for removal: 1 locked, 0 missing
>> 
>> The only matter that remains to be settled is which packages should
be
>> marked vital:
>> 
>>     % pkg query -e '%V = 1' %n
>>     FreeBSD-clibs
>>     FreeBSD-runtime
>> 
>> DES
>> -- 
>> Dag-Erling Smørgrav - des@FreeBSD.org
>> 
>> 
>> 
> 
>