Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target partition filesystem already mounted #110

Open
Diomeh opened this issue Sep 21, 2022 · 2 comments
Open

Target partition filesystem already mounted #110

Diomeh opened this issue Sep 21, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@Diomeh
Copy link

Diomeh commented Sep 21, 2022

Describe the bug

Executing WoeUSB fails to flash ISO image with the message

mkdosfs: /dev/sda1 contains a mounted filesystem.
ERROR: The command ""${command_mkdosfs}" -F 32 -n "${filesystem_label}" "${target_partition}"" failed with exit status "1", program is prematurely aborted

To Reproduce

Steps to reproduce the behavior:

Execute WoeUSB normally

sudo ./woeusb-5.2.4.bash --device Win10_21H2_Spanish_x64.iso /dev/sda

In my case, I'm using a Windows 10 ISO image downloaded directly from Microsoft and the target partition is located at /dev/sda

Expected behavior

WoeUSB should flash the ISO image to the target partition

Teminal output

WoeUSB v5.2.4
==============================
Info: Mounting source filesystem...
Info: Wiping all existing partition table and filesystem signatures in /dev/sda...
/dev/sda: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sda: calling ioctl to re-read partition table: Success
Info: Ensure that /dev/sda is really wiped...
Info: Creating new partition table on /dev/sda...
Info: Creating target partition...
Info: Making system realize that partition table has changed...
Info: Wait 3 seconds for block device nodes to populate...
mkfs.fat 4.2 (2021-01-31)
mkdosfs: /dev/sda1 contains a mounted filesystem.
ERROR: The command ""${command_mkdosfs}" -F 32 -n "${filesystem_label}" "${target_partition}"" failed with exit status "1", program is prematurely aborted
Info: Unmounting and removing "/tmp/woeusb-source-20220921-094402-Wednesday.AP7vAI"...
Warning: Target device is busy, please make sure you unmount all filesystems on target device or shutdown the computer before detaching it.

Environment

  • OS: Ubuntu 22.04.1 LTS
  • Bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
  • WoeUSB: 5.2.4
@Diomeh Diomeh added the bug Something isn't working label Sep 21, 2022
@Diomeh
Copy link
Author

Diomeh commented Sep 21, 2022

So, after digging through the bash script a bit I found the failing call at line 1304.

# Format target partition's filesystem
case "${filesystem_type}" in
    FS_FAT)
        #########################
        # This call will fail if target partition is already mounted
        #########################
        "${command_mkdosfs}" \
            -F 32 \
            -n "${filesystem_label}" \
            "${target_partition}"
        ;;

I managed to work around this problem by making sure that the target partition is unmounted before the call

# Format target partition's filesystem
case "${filesystem_type}" in
    FS_FAT)
        #########################
        # unmount target partition
        #########################
        umount \
            "${target_partition}" \
            || true

        "${command_mkdosfs}" \
            -F 32 \
            -n "${filesystem_label}" \
            "${target_partition}"
        ;;

@floscher
Copy link

@Diomeh This was probably caused by new partitions being auto-mounted as soon as they are detected (as described in #101).

A workaround would be to temporarily (until reboot) stop this service:

systemctl stop udisks2.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants