MediaWriter icon indicating copy to clipboard operation
MediaWriter copied to clipboard

Fedora Media Writer pauses when second USB drive is inserted

Open silverhadch opened this issue 10 months ago • 2 comments

Summary:
When writing to a USB drive using Fedora Media Writer, inserting another USB drive causes the writing process to pause without any warning. The process resumes only after removing the newly inserted USB drive.

Steps to Reproduce:

  1. Insert a USB drive into the system.
  2. Open Fedora Media Writer (latest Flatpak version) and select the USB drive as the target.
  3. Start the writing process.
  4. While the writing process is ongoing, insert another USB drive (any model/type).
  5. Observe that the writing process pauses without notification.
  6. Remove the newly inserted USB drive.
  7. Observe that the writing process resumes automatically.

Expected Behavior:

  • Fedora Media Writer should continue writing regardless of another USB being inserted.
  • If there's an issue with multiple drives, a clear warning should be displayed instead of silently pausing.

Actual Behavior:

  • The writing process pauses immediately when a second USB drive is inserted.
  • No error message or indication is given.
  • The process resumes only after removing the newly inserted USB drive.

System Information:

  • OS: KDE Linux x86_64
  • Fedora Media Writer Version: Latest Flatpak 5.2.3
  • USB Drive Models: Happens with multiple different USB drives, including SanDisk Cruzer Blade 15.3 GB.
  • System Hardware: S6445 MD61489 (5.13_VEB_1AUOK026)

Additional Notes:

  • This issue appears to be a general problem and is not limited to identical USB drives.
  • Identification via /dev/ remains unique (e.g., sda and sdb stay distinct), so this appears to be a logic bug where Fedora Media Writer may rely on the same label or another non-unique identifier despite different device nodes.
  • Further testing with different USB brands/models confirms that the issue occurs with any USB drive.

Would appreciate any insights or fixes for this issue. Thanks!

silverhadch avatar Mar 09 '25 13:03 silverhadch

Suggestion, change the issue title to:

Fedora Media Writer pauses when second USB drive is inserted

since mediawriter is never writing to the second drive; it doesn't have the ability to write to two drives.

In testing, I AM able to reproduce this, after a fashion.

What's actually happening is that the Media Writer isn't pausing (that is, the write process continues), but it does completely lose its progress display while the newly-inserted device is present. Once that second drive is removed, everything goes back to normal and the progress bar begins showing the write progress once again.

Here's how I determined that the write continued in the background.

Preparation

  1. Build the current development code for mediawriter from source in .../_build
  2. Run .../_build/app/mediawriter&
  3. Start writing an image to an available USB device
  4. Insert a second USB device, of any type

At this point, the progress bar disappears in the active Media Writer window.

Examine helper

Now we want to find the helper process that's doing the USB writing

# find mediawriter

$ pgrep mediawriter
2244377

# find child processes started by mediawriter

$ pgrep -P $(pgrep mediawriter)
2244623

# Examine the filehandles open by the helper

$ ls -l /proc/$(pgrep -P $(pgrep mediawriter))/fd
total 0
lr-x------. 1 ferd ferd 64 Jun 23 02:36 0 -> pipe:[7244105]
l-wx------. 1 ferd ferd 64 Jun 23 02:36 1 -> pipe:[7244106]
l-wx------. 1 ferd ferd 64 Jun 23 02:36 2 -> pipe:[7244107]
l-wx------. 1 ferd ferd 64 Jun 23 02:36 26 -> /home/ferd/Documents/FedoraMediaWriter.log
lrwx------. 1 ferd ferd 64 Jun 23 02:36 3 -> anon_inode:[eventfd]
lr-x------. 1 ferd ferd 64 Jun 23 02:36 4 -> anon_inode:inotify
lrwx------. 1 ferd ferd 64 Jun 23 02:36 5 -> anon_inode:[eventfd]
lrwx------. 1 ferd ferd 64 Jun 23 02:36 6 -> socket:[7245994]
lr-x------. 1 ferd ferd 64 Jun 23 02:36 7 -> /home/ferd/Downloads/ubuntu-24.04-latest-desktop-amd64.iso
lrwx------. 1 ferd ferd 64 Jun 23 02:36 8 -> /dev/sdb

# We want the handle the corresponds to the drive being written.
# That's filehandle 8, in my case

# Examine the current stream position of that filehandle

$ cat /proc/$(pgrep -P $(pgrep mediawriter))/fdinfo/8
pos:	1547698176
flags:	06150002
mnt_id:	36
ino:	1088

$ cat /proc/$(pgrep -P $(pgrep mediawriter))/fdinfo/8
pos:	1577058304
flags:	06150002
mnt_id:	36
ino:	1088

$ cat /proc/$(pgrep -P $(pgrep mediawriter))/fdinfo/8
pos:	1598029824
flags:	06150002
mnt_id:	36
ino:	1088

$ cat /proc/$(pgrep -P $(pgrep mediawriter))/fdinfo/8
pos:	1614807040
flags:	06150002
mnt_id:	36
ino:	1088

Results

Because the pos value (the current write position) is continuing to increase, we know that the helper is still doing its thing. MediaWriter just isn't watching it at the moment.

Unplugging the second USB drive causes the progress bar to reappear, showing the progress of the write operation. (Which, depending how long the other USB drive was inserted, may be significantly farther along than it was before.)

So, actually an even better title for the issue would be:

Write progress doesn't display if second USB drive is inserted during write

But it appears to be just a display issue, though I have no idea why it's happening.

ferdnyc avatar Jun 23 '25 06:06 ferdnyc

MediaWriter has other issues with device updates, beyond the progress thing. Like:

  1. Start the application with two USB drives inserted. (So, it shows a dropbox with two items to choose from, for "USB Drive", on the Write Options screen.)
  2. Before starting a write, remove one of the drives

Result:

Both drives disappear from MediaWriter, and it decides that there are no USB devices available to write to.

Quitting and relaunching the application will cause it to discover the remaining drive (the one that's been inserted the whole time), and it can once again be targeted for writing.

ferdnyc avatar Jun 23 '25 06:06 ferdnyc