wic: imager/direct: passno is set to 0 for all entries in the fstab
PATCH RESEND 1/1 wic: imager/direct: passno is set to 0 for all entries in the fstab
Hi,
I looked into periodic file system checks for ext* partitions, in order to increase robustness for systems that use those file systems and was surprised that the fstab that wic generates that 0 hard coded as the passno parameter [1]. This prevents for instance systemd-fsck@(8) [2] from running checks on those file systems.
It seems that wic/mic generated a fstab with passno=0 from the beginning [3]. What is the reason for that? Was it a conscious decision to do that, or just copy&paste for a different project?
How would a way forward look like? Should a patch that changes passno from 0 to 2 be enough, or do we rather have this parameter configurable somehow?
regards,
Claudius Heine
[1] https://git.openembedded.org/openembedded-core/tree/scripts/lib/wic/plugins/imager/direct.py?id=a59c246be05ca284fa27df87b5db09a70f527cc2#n141
[2] https://manpages.debian.org/stretch/systemd/[email protected]
[3] https://git.openembedded.org/openembedded-core/tree/scripts/lib/mic/imager/direct.py?id=f87acc5e59d3c2c39ff171b5557977dab4c8f4a6#n110
Signature · 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected] PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153 Keyserver: hkp://pool.sks-keyservers.net
Quoted 6 lines · Claudius Heine
I looked into periodic file system checks for ext* partitions, in order to increase robustness for systems that use those file systems and was surprised that the fstab that wic generates that
0hard coded as the passno parameter [1]. This prevents for instance systemd-fsck@(8) [2] from running checks on those file systems.
Quoted 8 lines
It seems that wic/mic generated a fstab with passno=0 from the beginning
[3]. What is the reason for that? Was it a conscious decision to do that, or just copy&paste for a different project?How would a way forward look like? Should a patch that changes passno from 0 to 2 be enough, or do we rather have this parameter configurable somehow?
I suspect changing things so fsck was run at every boot would upset existing use cases, particularly on ext2/3 systems without a journal. The only option would therefore me to make it configurable.
Cheers,
Richard
PATCH 1/1 wic: added fspassno parameter to partition
The fspassno parameter allows to overwrite the value of the last column (fs_passno) in the /etc/fstab of the target root file system. This allows to have periodic file system checks.
--- scripts/lib/wic/help.py | 6 ++++++ scripts/lib/wic/ksparser.py | 1 + scripts/lib/wic/partition.py | 1 + scripts/lib/wic/plugins/imager/direct.py | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-)
scripts/lib/wic/help.py +6 -0
@@ -939,6 +939,12 @@ DESCRIPTION quotes. If not specified, the default string is "defaults". + --fspassno: Specifies the order in which filesystem checks are done + at boot time by fsck. See fs_passno parameter of + fstab(5). This parameter will be copied into the + /etc/fstab file of the installed system. If not + specified the default value of "0" will be used. + --label label: Specifies the label to give to the filesystem to be made on the partition. If the given label is already in use by another filesystem,
scripts/lib/wic/ksparser.py +1 -0
@@ -155,6 +155,7 @@ class KickStart(): part.add_argument('--change-directory') part.add_argument("--extra-space", type=sizetype("M")) part.add_argument('--fsoptions', dest='fsopts') + part.add_argument('--fspassno', dest='fspassno') part.add_argument('--fstype', default='vfat', choices=('ext2', 'ext3', 'ext4', 'btrfs', 'squashfs', 'vfat', 'msdos', 'swap'))
scripts/lib/wic/partition.py +1 -0
@@ -33,6 +33,7 @@ class Partition(): self.include_path = args.include_path self.change_directory = args.change_directory self.fsopts = args.fsopts + self.fspassno = args.fspassno self.fstype = args.fstype self.label = args.label self.use_label = args.use_label
scripts/lib/wic/plugins/imager/direct.py +2 -1
@@ -138,8 +138,9 @@ class DirectPlugin(ImagerPlugin): device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum) opts = part.fsopts if part.fsopts else "defaults" + passno = part.fspassno if part.fspassno else "0" line = "\t".join([device_name, part.mountpoint, part.fstype, - opts, "0", "0"]) + "\n" + opts, "0", passno]) + "\n" fstab_lines.append(line) updated = True
Signature · 1 line
2.20.1
Re: [PATCH] wic: added fspassno parameter to partition
Was this ever looked at? ping
regards,
Henning
Am Fri, 6 Nov 2020 11:27:22 +0100
schrieb Claudius Heine <[email protected]>:
Quoted 72 lines
The
fspassnoparameter allows to overwrite the value of the last column (fs_passno) in the/etc/fstabof the target root file system. This allows to have periodic file system checks.Signed-off-by Claudius Heine <[email protected]>--- scripts/lib/wic/help.py | 6 ++++++ scripts/lib/wic/ksparser.py | 1 + scripts/lib/wic/partition.py | 1 + scripts/lib/wic/plugins/imager/direct.py | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-)scripts/lib/wic/help.py +0
-0@@ -939,6 +939,12 @@ DESCRIPTION quotes. If not specified, the default stringis "defaults".
+ --fspassno: Specifies the order in which filesystem checks
are done
+ at boot time by fsck. Seefs_passnoparameter
of
+ fstab(5). This parameter will be copied into
thescripts/lib/wic/help.py +3
-0+ /etc/fstab file of the installed system. If not + specified the default value of "0" will be used. + --label label: Specifies the label to give to the filesystem to be made on the partition. If the given label is already in use by anotherfilesystem, diff --git
a/scripts/lib/wic/ksparser.pyb/scripts/lib/wic/ksparser.pyindex913e3283dc..b1ade01ed4100644scripts/lib/wic/ksparser.py +1
-0@@ -155,6 +155,7 @@ class KickStart(): part.add_argument('--change-directory') part.add_argument("--extra-space", type=sizetype("M")) part.add_argument('--fsoptions', dest='fsopts') + part.add_argument('--fspassno', dest='fspassno') part.add_argument('--fstype', default='vfat', choices=('ext2', 'ext3', 'ext4', 'btrfs', 'squashfs', 'vfat', 'msdos','swap')) diff --git
a/scripts/lib/wic/partition.pyb/scripts/lib/wic/partition.pyindexebe250b00d..44b17b5bd7100644scripts/lib/wic/partition.py +1
-0@@ -33,6 +33,7 @@ class Partition(): self.include_path = args.include_path self.change_directory = args.change_directory self.fsopts = args.fsopts + self.fspassno = args.fspassno self.fstype = args.fstype self.label = args.label self.use_label = args.use_label(quoted diff) +0
-0
b/scripts/lib/wic/plugins/imager/direct.pyindex55db826e93..c2225ba067100644 ---a/scripts/lib/wic/plugins/imager/direct.py+++b/scripts/lib/wic/plugins/imager/direct.py@@ -138,8 +138,9 @@ class DirectPlugin(ImagerPlugin):device_name= "/dev/%s%s%d" % (part.disk, prefix, part.realnum)
opts = part.fsopts if part.fsopts else "defaults"
+ passno = part.fspassno if part.fspassno else "0"
line = "\t".join([device_name, part.mountpoint,
part.fstype,scripts/lib/wic/plugins/imager/direct.py +1
-1- opts, "0", "0"]) + "\n" + opts, "0", passno]) + "\n" fstab_lines.append(line) updated = True
PATCH v2 1/1 wic: added fspassno parameter to partition
From: Claudius Heine <[email protected]>
The fspassno parameter allows to overwrite the value of the last column (fs_passno) in the /etc/fstab of the target root file system. This allows to have periodic file system checks.
--- scripts/lib/wic/help.py | 6 ++++++ scripts/lib/wic/ksparser.py | 1 + scripts/lib/wic/partition.py | 1 + scripts/lib/wic/plugins/imager/direct.py | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-)
scripts/lib/wic/help.py +6 -0
@@ -940,6 +940,12 @@ DESCRIPTION quotes. If not specified, the default string is "defaults". + --fspassno: Specifies the order in which filesystem checks are done + at boot time by fsck. See fs_passno parameter of + fstab(5). This parameter will be copied into the + /etc/fstab file of the installed system. If not + specified the default value of "0" will be used. + --label label: Specifies the label to give to the filesystem to be made on the partition. If the given label is already in use by another filesystem,
scripts/lib/wic/ksparser.py +1 -0
@@ -155,6 +155,7 @@ class KickStart(): part.add_argument('--change-directory') part.add_argument("--extra-space", type=sizetype("M")) part.add_argument('--fsoptions', dest='fsopts') + part.add_argument('--fspassno', dest='fspassno') part.add_argument('--fstype', default='vfat', choices=('ext2', 'ext3', 'ext4', 'btrfs', 'squashfs', 'vfat', 'msdos', 'erofs',
scripts/lib/wic/partition.py +1 -0
@@ -33,6 +33,7 @@ class Partition(): self.include_path = args.include_path self.change_directory = args.change_directory self.fsopts = args.fsopts + self.fspassno = args.fspassno self.fstype = args.fstype self.label = args.label self.use_label = args.use_label
scripts/lib/wic/plugins/imager/direct.py +2 -1
@@ -138,8 +138,9 @@ class DirectPlugin(ImagerPlugin): device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum) opts = part.fsopts if part.fsopts else "defaults" + passno = part.fspassno if part.fspassno else "0" line = "\t".join([device_name, part.mountpoint, part.fstype, - opts, "0", "0"]) + "\n" + opts, "0", passno]) + "\n" fstab_lines.append(line) updated = True
Signature · 1 line
2.25.1
Re: [PATCH v2] wic: added fspassno parameter to partition
Hi all,
Quoted 7 lines · Vijaikumar
From: Claudius Heine <[email protected]>
The
fspassnoparameter allows to overwrite the value of the last column (fs_passno) in the/etc/fstabof the target root file system. This allows to have periodic file system checks.
I've found this to be ineffective for /, as the fstab update is explicitly omitted in scripts/lib/wic/plugins/imager/direct.py:120:
```
for part in self.parts:
if not part.realnum or not part.mountpoint \
or part.mountpoint == "/" or not part.mountpoint.startswith('/'):
^^^^^^^^^^^^^^^^^^^^^^^^^
continue
```I've created a patch, originally for different reasons, that will also address this issue.
Kind regards,
Tobias
RE: [PATCH v2] wic: added fspassno parameter to partition
Quoted 11 lines
-----Original Message-----
From: Schmidl, Tobias (T CED SES-DE) <[email protected]>
Sent: 17 May 2022 23:46
To: [email protected]; Kanagarajan, Vijaikumar <[email protected]>
Cc: [email protected]; Schild, Henning (T CED SES-DE) <[email protected]>
Subject: Re: [PATCH v2] wic: added fspassno parameter to partition
Hi Tobias,
Quoted 6 lines
Hi all,
Quoted 3 lines · Vijaikumar
From: Claudius Heine <[email protected]>
Quoted 7 lines
Quoted 4 lines
The
fspassnoparameter allows to overwrite the value of the last column (fs_passno) in the/etc/fstabof the target root file system. This allows to have periodic file system checks.I've found this to be ineffective for
/, as the fstab update is explicitly omitted inscripts/lib/wic/plugins/imager/direct.py:120:
I believe wic has changed much since the first appearance of this patch.
Quoted 11 lines
``` for part in self.parts: if not part.realnum or not part.mountpoint \ or part.mountpoint == "/" or not part.mountpoint.startswith('/'): ^^^^^^^^^^^^^^^^^^^^^^^^^ continue ```I've created a patch, originally for different reasons, that will also address this issue.
If you can send that, we can drop this patch in favour of it.
Thanks,
Vijai Kumar K
Quoted 4 lines
Kind regards,
Tobias
Re: [PATCH v2] wic: added fspassno parameter to partition
Am Tue, 17 May 2022 18:21:27 +0000
schrieb "Kanagarajan, Vijaikumar" <[email protected]>:
Quoted 22 lines
Quoted 9 lines
-----Original Message-----
From: Schmidl, Tobias (T CED SES-DE) <[email protected]>
Sent: 17 May 2022 23:46
To: [email protected]; Kanagarajan, Vijaikumar <[email protected]>
Cc: [email protected]; Schild, Henning (T CED SES-DE) <[email protected]>
Subject: Re: [PATCH v2] wic: added fspassno parameter to partitionHi Tobias,
Quoted 11 lines
Hi all,
Quoted 7 lines · Vijaikumar
From: Claudius Heine <[email protected]>
The
fspassnoparameter allows to overwrite the value of the last column (fs_passno) in the/etc/fstabof the target root file system. This allows to have periodic file system checks.
Quoted 6 lines
Quoted 3 lines
I've found this to be ineffective for
/, as the fstab update is explicitly omitted inscripts/lib/wic/plugins/imager/direct.py:120:I believe wic has changed much since the first appearance of this patch.
Yes, some bits have changed but i also do not recall all the details.
Quoted 9 lines
Quoted 9 lines
``` for part in self.parts: if not part.realnum or not part.mountpoint \ or part.mountpoint == "/" or not part.mountpoint.startswith('/'): ^^^^^^^^^^^^^^^^^^^^^^^^^ continue ```
Quoted 4 lines
Quoted 2 lines
I've created a patch, originally for different reasons, that will also address this issue.
If you can send that, we can drop this patch in favour of it.
AFAIK Tobias will be aiming at allowing wic to create fstab lines for /, so it will not replace but instead boil down to merge order.
I can only assume that / might for some people for sure be a prime target for --fspassno.
regards,
Henning
Quoted 8 lines
Thanks,
Vijai Kumar KQuoted 4 lines
Kind regards,
Tobias
Re: [PATCH] wic: added fspassno parameter to partition
In reply to Henning SchildJust sent a V2. Rebased on laster master.
https://lists.openembedded.org/g/openembedded-core/message/165597