On 2024-12-14, Maxim <glok...@kuzdra.org> wrote: > During the rc startup sequence, fsck fails to check this one ext2 > partition (known as /dev/sd0i and a7e6ed0a30d39bcc.i). I had to > disable fsck in fstab (set last field fs_passno to 0) to get the system > up. The partition looks good: I can mount and work with it just fine. > I also ran "fsck -f" against it and it was okay too. ... > What may be the problem here?
> a7e6ed0a30d39bcc.i /data/cargopod ext2fs rw,nodev,nosuid,noexec 0 0 # > last 0 was 3 fsck_ext2fs doesn't use opendev() so it can't handle DUIDs. This diff may fix it. I don't have any handy devices with ext2fs that I can add to an OpenBSD system to try it. Index: Makefile =================================================================== RCS file: /cvs/src/sbin/fsck_ext2fs/Makefile,v diff -u -p -r1.8 Makefile --- Makefile 18 Sep 2001 13:31:29 -0000 1.8 +++ Makefile 16 Dec 2024 17:12:24 -0000 @@ -1,10 +1,12 @@ # $OpenBSD: Makefile,v 1.8 2001/09/18 13:31:29 art Exp $ PROG= fsck_ext2fs -MAN= fsck_ext2fs.8 +MAN= fsck_ext2fs.8 SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ pass5.c fsutil.c setup.c utilities.c ext2fs_bswap.c .PATH: ${.CURDIR}/../../sys/ufs/ext2fs ${.CURDIR}/../fsck CFLAGS+= -I${.CURDIR}/../fsck +DPADD+= ${LIBUTIL} +LDADD+= -lutil .include <bsd.prog.mk> Index: setup.c =================================================================== RCS file: /cvs/src/sbin/fsck_ext2fs/setup.c,v diff -u -p -r1.34 setup.c --- setup.c 15 Jul 2024 13:32:50 -0000 1.34 +++ setup.c 16 Dec 2024 17:12:24 -0000 @@ -46,6 +46,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <util.h> #include <string.h> #include <ctype.h> #include <err.h> @@ -70,28 +71,31 @@ setup(char *dev) off_t sizepb; struct stat statb; struct m_ext2fs proto; + char *realdev; int doskipclean; u_int64_t maxfilesize; havesb = 0; fswritefd = -1; doskipclean = skipclean; - if (stat(dev, &statb) == -1) { - printf("Can't stat %s: %s\n", dev, strerror(errno)); + if ((fsreadfd = opendev(dev, O_RDONLY, 0, &realdev)) == -1) { + printf("Can't open %s: %s\n", dev, strerror(errno)); + return (0); + } + if (fstat(fsreadfd, &statb) == -1) { + printf("Can't stat %s: %s\n", realdev, strerror(errno)); return (0); } if (!S_ISCHR(statb.st_mode)) { - pfatal("%s is not a character device", dev); - if (reply("CONTINUE") == 0) + pfatal("%s is not a character device", realdev); + if (reply("CONTINUE") == 0) { + close(fsreadfd); return (0); - } - if ((fsreadfd = open(dev, O_RDONLY)) == -1) { - printf("Can't open %s: %s\n", dev, strerror(errno)); - return (0); + } } if (preen == 0) - printf("** %s", dev); - if (nflag || (fswritefd = open(dev, O_WRONLY)) == -1) { + printf("** %s", realdev); + if (nflag || (fswritefd = opendev(dev, O_WRONLY, 0, NULL)) == -1) { fswritefd = -1; if (preen) pfatal("NO WRITE ACCESS"); @@ -126,7 +130,7 @@ setup(char *dev) * Read in the superblock, looking for alternates if necessary */ if (readsb(1) == 0) { - if (bflag || preen || calcsb(dev, fsreadfd, &proto, lp) == 0) + if (bflag || preen || calcsb(realdev, fsreadfd, &proto, lp) == 0) return(0); if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) return (0); -- Please keep replies on the mailing list.