Skip to content
Browse files

Implement ext4 dir_index on 64bit kernel from 32bit emulated userspac…

…e workarounds
  • Loading branch information
spanezz committed Nov 29, 2019
1 parent 2fccf8a commit 22cb86b52718fe4cbbc1034822f35c014dc1f3fc
Showing with 28 additions and 8 deletions.
  1. +28 −8 himblib/
@@ -242,17 +242,41 @@ def partition(self, dev: Dict[str, Any]):
raise Fail("SD media partition exFAT file system failed checks:"
" reset it with --write-image and rerun --partition")

def ext4_dir_index_workaround(self, part):
Temporarily disable dir_index of the ext4 filesystem to work around the
issue at
is_ext4 = part["fstype"] == "ext4"
if is_ext4:"Disabling dir_index on %s to workaround", part["path"])
run(["tune2fs", "-O", "^dir_index", part["path"]])

if is_ext4:"Reenabling dir_index on %s", part["path"])
run(["tune2fs", "-O", "dir_index", part["path"]])"Running e2fsck to reindex directories on %s", part["path"])
run(["e2fsck", "-f", part["path"]])

def mounted(self, label):
part = self.locate_partition(label)
if part["mountpoint"] is None:

if part["mountpoint"] is not None:
raise RuntimeError(f"please call this function while the {label} filesystem is unmounted")

with self.ext4_dir_index_workaround(part):"Mounting %s partition %s", label, part["path"])
run(["udisksctl", "mount", "-b", part["path"]], stdout=subprocess.DEVNULL)
part = self.locate_partition(label)

yield Chroot(part["mountpoint"])
yield Chroot(part["mountpoint"])

run(["udisksctl", "unmount", "-b", part["path"]], stdout=subprocess.DEVNULL)
run(["udisksctl", "unmount", "-b", part["path"]], stdout=subprocess.DEVNULL)

def setup_boot(self):
with self.mounted("boot") as chroot:
@@ -386,11 +410,7 @@ def setup_rootfs(self):

# This is needed otherwise okular and evince cannot show PDF files
# It is still unclear to me why it is not automatically ok in the
# raspbian system
if time.time() - chroot.getmtime("/usr/share/mime/mime.cache") > 86400:["update-mime-database", "/usr/share/mime"], check=True)
#["e2fsck", "-f", "/usr/share/mime"], check=True)


0 comments on commit 22cb86b

Please sign in to comment.
You can’t perform that action at this time.