One (only one) machine always needs manual fsck after unclean shutdown

cracauer@

Developer
What could cause this?

Among my many FreeBSD machines there is one and only one that always enters single user mode and wants a fsck of /. There never is any problem with that fsck, it goes through and all is fine until the next unclean shutdown.

Last kernel messages:
Code:
WARNING: / was not properly dismounted
WARNING: /: mount pending error: blocks 8, files 1

Userland/rc messages:
Code:
mount: /dev/label/xc3roota: R/W mount of / denied.
Filesystem is not clean, run fsck.
Forced mount will invalidate journal contents: Operation not permitted.
 
Crazy idea (since you probably know more about the sane ideas than I do, I'll just throw out crazy ones):

Maybe the storage is set up such that during shutdown, the root block device becomes unwriteable (read-only, or inaccessible), before the root file system is unmounted. With something crazy like "root on iSCSI" this might happen, if the iSCSI client is taken down too early.
 
I have a vague memory of something like this.... I think I brought up the system in single user, mount -u / and ran fsck -y a couple of times but don't know the root cause. I assume "dumpfs / | grep update" returns "flags soft-updates+journal"?
 
I think the problem is that fsck doesn't run in the first place.
The error is written to be displayed as "run fsck".
I guess that's not what you're asking.
/usr/src/sys/ufs/ffs/ffs_vfsops.c
Code:
                        if (fs->fs_clean == 0) {
                                fs->fs_flags |= FS_UNCLEAN;
                                if ((mp->mnt_flag & MNT_FORCE) ||
                                    ((fs->fs_flags &
                                     (FS_SUJ | FS_NEEDSFSCK)) == 0 &&
                                     (fs->fs_flags & FS_DOSOFTDEP))) {
                                        printf("WARNING: %s was not properly "
                                           "dismounted\n",
                                           mp->mnt_stat.f_mntonname);
                                } else {
                                        vfs_mount_error(mp,
                                           "R/W mount of %s denied. %s.%s",
                                           mp->mnt_stat.f_mntonname,
                                           "Filesystem is not clean - run fsck",
                                           (fs->fs_flags & FS_SUJ) == 0 ? "" :
                                           " Forced mount will invalidate"
                                           " journal contents");
                                        return (EPERM);
                                }
                        }
Code:
                if (ronly || (mp->mnt_flag & MNT_FORCE) ||
                    ((fs->fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == 0 &&
                     (fs->fs_flags & FS_DOSOFTDEP))) {
                        printf("WARNING: %s was not properly dismounted\n",
                            mp->mnt_stat.f_mntonname);
                } else {
                        vfs_mount_error(mp, "R/W mount on %s denied. "
                            "Filesystem is not clean - run fsck.%s",
                            mp->mnt_stat.f_mntonname,
                            (fs->fs_flags & FS_SUJ) == 0 ? "" :
                            " Forced mount will invalidate journal contents");
                        error = EPERM;
                        goto out;
                }
 
fsck is always necessary after unclean shutdown. That much is normal.

Question is
- why does the machine not just do it rightaway?
- why isn't it delayed and backgrounded like usual?

There is a bunch of options in /etc/defaults/rc.conf to get the desired behaviour (something changed?). And backgrounded fsck requires soft updates (enabled?)
 
Just a guess: Does tunefs -p /dev/ada.p. give different journal-related settings for that particular disk?
 
fsck_ffs(8)
Code:
     -B      A check is done on the specified and possibly active file system.
             The set of corrections that can be done is limited to those done
             when running in preen mode (see the -p flag).  If unexpected
             errors are found, the file system is marked as needing a
             foreground check and fsck_ffs exits without attempting any
             further cleaning.
If there is an error in the suj journal information, background fsck would not be performed.
/usr/src/sbin/fsck_ffs/suj.c
Code:
/*
 * When hit a fatal error in journalling check, print out
 * the error and then offer to fallback to normal fsck.
 */
 
Back
Top