[Bug 256712] UFS: kernel panic: ffs_blk free_cg: freeing free frag – in response to pkg-delete(8) soon after login

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 19 Jun 2021 10:39:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256712

            Bug ID: 256712
           Summary: UFS: kernel panic: ffs_blkfree_cg: freeing free frag –
                    in response to pkg-delete(8) soon after login
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: grahamperrin@gmail.com

I began with a fresh installation of FreeBSD 13.0 to UFS, then (in a nutshell): 

1. single user mode
2. tunefs -n disable
3. ee /etc/fstab
4. ee /etc/sysctl.conf
5. shutdown -r now
5. an update to the OS
6. shutdown -r now
7. /etc/pkg/FreeBSD.conf set to latest
8. tests for file system resilience. 

----

# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/ada0s1a    /               ufs     rw,sync 1       1
/dev/ada0s1b    none            swap    sw      0       0

----

kern.filedelay=10
kern.dirdelay=9
kern.metadelay=8

hw.acpi.power_button_state="NONE"

----

Tests typically involved pressing and holding the power button whilst
installing packages: 

* specifically, timing the press for interruption to occur 
  during or immediately after extraction of devel/gdb

– most, if not all, results were OK. Dozens of tests yesterday and this
morning. 

----

For just one test, after-effects were remarkable: 

pkg: sqlite error while executing INSERT INTO files (path, sha256, package_id)
VALUES (?1, ?2, ?3) in file pkgdb.c:1825: database disk image is malformed

<https://forums.freebsd.org/threads/80925/> – the broken local.sqlite was no
surprise, given the nature of the tests and honestly, I'm not certain that the
breakage was a _direct_ consequence. I mention this incident solely as a point
of reference; unless advised otherwise, I'll treat it as negligible. 

======================================================================

For a next round, this morning (with the file system reportedly clean) I
_enabled_ soft updates then tested in much the same way – observing automated
file system checks and repairs at startup time. 

Shortly after a login, I ran: 

pkg delete -fy python38 gdb

The system crashed. I awaited completion of the dump, suppressed automatic
reboot and took a photograph of the backtrace. 

The round of testing that led to this situation was very brief – maybe only two
or three tests (interruptions) – so I hope to make things reproducible with not
too much difficulty.

-- 
You are receiving this mail because:
You are the assignee for the bug.