Skip to content

Pass -t to mount() call when filesystem type is known or can be determined - #3095

Merged
Conan-Kudo merged 1 commit into
OSInside:mainfrom
rajibade:main
Oct 19, 2026
Merged

Conan-Kudo merged 1 commit into
OSInside:mainfrom
rajibade:main

Conversation

@rajibade

Copy link
Copy Markdown
Contributor

This allows mounting not to depend on probe order, on libblkid's result or on whether the device happens to be mounted elsewhere already.

Fixes #3093

…mined

This allows mounting not to depend on probe order, on libblkid's result
or on whether the device happens to be mounted elsewhere already.

Fixes OSInside#3093
@rajibade

rajibade commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Since this is technically a fix to a race condition, trying to run builds consecutively, might not yield much. I wrote this script to test this out. Needs util-linux v2.42 and udevd is active

#!/bin/bash

truncate -s 256M esp.img
sgdisk -n 1:0:+100M -c 1:p.UEFI esp.img
losetup -P /dev/loop0 esp.img
udevadm settle

udevadm control --stop-exec-queue
mkfs.vfat -F 16 /dev/loop0p1
mkdir -p /mnt/a /mnt/b

python3 -c "
from kiwi.mount_manager import MountManager
MountManager(device='/dev/loop0p1', mountpoint='/mnt/a').mount()
MountManager(device='/dev/loop0p1', mountpoint='/mnt/b').mount()
print('second mount ok')
"

udevadm control --start-exec-queue
umount /mnt/b /mnt/a
losetup -d /dev/loop0
rm esp.img

Without patch

sudo ./mount-type.sh
...
[ DEBUG   ]: 11:14:56 | EXEC: [mount /dev/loop0p1 /mnt/b]
[ DEBUG   ]: 11:14:56 | EXEC: Failed with stderr: mount: /mnt/b: fsconfig() failed: /dev/loop0p1: Can't open blockdev.
       dmesg(1) may have more information after failed mount system call.
, stdout: (no output on stdout)
Traceback (most recent call last):
  File "<string>", line 4, in <module>
    MountManager(device='/dev/loop0p1', mountpoint='/mnt/b').mount()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/kiwi/mount_manager.py", line 127, in mount
    Command.run(
    ~~~~~~~~~~~^
        ['mount'] + type_list + option_list + [self.device, self.mountpoint]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.14/site-packages/kiwi/command.py", line 160, in run
    raise KiwiCommandError(
    ...<3 lines>...
    )
kiwi.exceptions.KiwiCommandError: mount: stderr: mount: /mnt/b: fsconfig() failed: /dev/loop0p1: Can't open blockdev.
       dmesg(1) may have more information after failed mount system call.
, stdout: (no output on stdout)
umount: /mnt/b: not mounted.

With patch

sudo ./mount-type.sh
Creating new GPT entries in memory.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
mkfs.fat 4.2 (2021-01-31)
[ DEBUG   ]: 11:24:13 | Creating directory /mnt/a
[ DEBUG   ]: 11:24:13 | Looking for mountpoint in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [mountpoint -q /mnt/a]
[ DEBUG   ]: 11:24:13 | Looking for blkid in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [blkid /dev/loop0p1 -s TYPE -o value]
[ DEBUG   ]: 11:24:13 | Looking for mount in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [mount -t vfat /dev/loop0p1 /mnt/a]
[ DEBUG   ]: 11:24:13 | Creating directory /mnt/b
[ DEBUG   ]: 11:24:13 | Looking for mountpoint in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [mountpoint -q /mnt/b]
[ DEBUG   ]: 11:24:13 | Looking for blkid in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [blkid /dev/loop0p1 -s TYPE -o value]
[ DEBUG   ]: 11:24:13 | Looking for mount in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
[ DEBUG   ]: 11:24:13 | EXEC: [mount -t vfat /dev/loop0p1 /mnt/b]
second mount ok

@rajibade

Copy link
Copy Markdown
Contributor Author

@schaefi I think this is good. For testing, I think f45/rawhide is the only one affected at the moment.

@Conan-Kudo
Conan-Kudo merged commit 51a8d66 into OSInside:main Oct 19, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MountManager.mount() does not pass -t: intermittent ESP mount failure on util-linux >= 2.39

2 participants