Re: No longer single-user on unclean fs?

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sun, 24 Aug 2025 15:03:37 UTC
On Sun, 24 Aug 2025, Warner Losh wrote:

> On Sun, Aug 24, 2025 at 8:32 AM Bjoern A. Zeeb <
> bzeeb-lists@lists.zabbadoz.net> wrote:
>
>> Hi,
>>
>> I just updated a bhyve file system and forgot to unmount it on the host;
>> starting the guest I am surprised to see Login: and not press enter for
>> /bin/sh from init ...
>>
>
>
> There's two issues. First, /etc/rc output only goes to the primary console.
> It wouldn't have prompted you or shown you a single user shell here anyway.

This was on the primary (serial) console.  On a clean shutdown I do see
the rc output here and did again so after stopping bhyve, umounting,
starting bhyve again.

> Second, we've never dropped to single user mode solely for unclean
> shutdown. Only for filesystems that couldn't be fixed. These could be fixed
> with fsck, so no single user.
>
>  Unclean shutdown only prevents read-write
> mounting of a filesystem. It's cleared when the filesystem checks out a
> good with fsck (or fsck is able to fix safe to fix things). You'll only
> drop to single user if fsck can't fix it in 'preen' mode.

Is your behaviour described by background fsck on or a ZFS thing?

I've gone through this certainly 15 times this year before and every
time I got the prompt to /bin/sh so I could run fsck myself.  And the
same applied for about the past 3-4 years.


I just shutdown bhyve again, made a copy of the FS image, and mounted
the original, and then started bhyve again and this time it worked as I
would expect it;  the only difference to the one before is that I had
just done a full installworld/installkernel, while now it was a clean
shutdown before and the r/w mount to make it "dirsty":

...
pass0: Command Queueing enabled
GEOM: new disk ada0
Trying to mount root from ufs:/dev/ada0p4 [rw]...
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: / was not properly dismounted
efirtc0: providing initial system time
Dual Console: Serial Primary, Video Secondary
start_init: trying /sbin/init
Setting hostuuid: bb5124b5-ee6c-9a36-8f93-dc96714d32c4.
Setting hostid: 0xb390e5ed.
Starting file system checks:
mount: /dev/ada0p4: R/W mount of / denied. Filesystem is not clean - run fsck. Forced mount will invalidate journal contents: Operation not permitted
Mounting root filesystem rw failed, startup aborted
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
2025-08-24T14:59:43.859965+00:00 - init 1 - - /bin/sh on /etc/rc terminated abnormally, going to single user mode
Enter full pathname of shell or RETURN for /bin/sh:

Whatever happend before is not what should have...  which concerns me...

-- 
Bjoern A. Zeeb                                                     r15:7