Created attachment 228616 [details] First boot from FreeBSD-13.0-RELEASE-amd64.vhd <https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/amd64/Latest/> ▼ FreeBSD-13.0-RELEASE-amd64.vhd.xz Bug first observed yesterday <https://forums.freebsd.org/posts/536326> with a FreeBSD 14.0-CURRENT host: > inode 11021 in cg 0 Reproduced this morning <https://i.imgur.com/0dsd45V.png> with a Windows 10 host: > inode 7 in cg 0 Reproducible with a third installation, at first boot of the guest. Screenshot attached: > inode 11021 in cg 0 ---- Not reproducible with FreeBSD-12.2-RELEASE-amd64.vhd.xz
Created attachment 228638 [details] First boot from FreeBSD-13.0-STABLE-amd64.vhd Reproducible with stable/13. FreeBSD-13.0-STABLE-amd64.vhd extracted from FreeBSD-13.0-STABLE-amd64.vhd.xz (2021-10-07 04:54)
Created attachment 228640 [details] free BLK count(s) wrong in SUPERBLK, salvaged Incidentally, also at first boot: > FREE BLK COUNT(S) WRONG IN SUPERBLK – I assume that it's negligible, in the context of this bug.
(In reply to Graham Perrin from comment #2) To clarify: > FREE BLK COUNT(S) WRONG IN SUPERBLK – this appears to result from the failed attempt to enable soft update journaling, i.e. (in single user mode): tunefs -j enable /
I have been able to reproduce the problem and will look into it.
Created attachment 229232 [details] Screenshot: FreeBSD-12.3-PRERELEASE-amd64.vhd OK (In reply to Graham Perrin from comment #0) > Not reproducible with FreeBSD-12.2-RELEASE-amd64.vhd.xz Similarly, not reproducible with recent FreeBSD-12.3-PRERELEASE-amd64.vhd.xz – screenshot attached. (In reply to Kirk McKusick from comment #4) Thanks.
Reproducible with: FreeBSD-13.1-BETA2-amd64.vhd
Tried it on my RPI2 with FreeBSD generic 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC arm remounted R/O and ran: root@generic:/home/freebsd # tunefs -j enable / Using inode 4872 in cg 0 for 33554432 byte journal tunefs: Failed to write updated cg: Bad file descriptor tunefs: soft updates journaling cannot be enabled tunefs: file system reloaded
Tried also on FreeBSD 13.0-p11 (binary update from 12) to enable journaling on a secondary filesystem but I got 'using inode 6 in cg 0 for ..... byte journal' and 'failed to write updated cg: bad file descriptor'. The machine is on a virtio storage VPS (on a KVM cloud provider). Thus I have to wait almost 30 minutes for an FSCK on this 400GB partition.
I have used the FreeBSD 12.0 Live CD to boot this system, and enabled successfully the soft updates+journaling on the large filesystems. Definettly, there is something wrong in the FreeBSD 13.0 function to enable this functionality.
Please try this patch and see if it helps: diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 11956f946ff5..bad31512daab 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -312,6 +312,8 @@ main(int argc, char *argv[]) on = special = argv[0]; if (ufs_disk_fillout(&disk, special) == -1) goto err; + if (ufs_disk_write(&disk) == -1) + goto err; /* * Check for unclean filesystem. */
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7ba6bdf83fda82cce70f384e2ec8218f13002e commit 5c7ba6bdf83fda82cce70f384e2ec8218f13002e Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2022-11-12 23:36:07 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2022-11-12 23:37:27 +0000 Fix for tunefs(8) unable to add a UFS/FFS soft update journal. The reported bug is UFS: bad file descriptor: soft update journaling can not be enabled on some FreeBSD-provided disk images – failed to write updated cg. The UFS library (libufs(3)) failed to reopen its disk descriptor when first attempting to update a cylinder group. The error only occurred when trying to add journaling to a filesystem whose first cylinder group was too full to hold the journal. PR: 259090 MFC after: 1 week Sponsored by: The FreeBSD Foundation lib/libufs/cgroup.c | 4 ++++ 1 file changed, 4 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=bca262f0f351e3881d478b7a9764c91ccb83c260 commit bca262f0f351e3881d478b7a9764c91ccb83c260 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2022-11-12 23:36:07 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2022-11-20 17:13:49 +0000 Fix for tunefs(8) unable to add a UFS/FFS soft update journal. The reported bug is UFS: bad file descriptor: soft update journaling can not be enabled on some FreeBSD-provided disk images – failed to write updated cg. The UFS library (libufs(3)) failed to reopen its disk descriptor when first attempting to update a cylinder group. The error only occurred when trying to add journaling to a filesystem whose first cylinder group was too full to hold the journal. PR: 259090 MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 5c7ba6bdf83fda82cce70f384e2ec8218f13002e) lib/libufs/cgroup.c | 4 ++++ 1 file changed, 4 insertions(+)
Has been MFC'ed to 13. Not relevant to 12.