pop-os / popsicle

Multiple USB File Flasher
MIT License
626 stars 77 forks source link

Creating bootable USB devices from Windows 10 ISOs #67

Open mmstick opened 5 years ago

mmstick commented 5 years ago

There's a request from time to time for the ability to flash USB devices with a Windows 10 ISO. Yet since Windows 10 ISOs are not hybrid, they require special setup.

  1. Wipe the labels on the device
  2. Format the device as NTFS
  3. Mount the newly-formatted device
  4. Mount the ISO
  5. Decompress & extract the ISO's contents to the mounted USB device
eduncan911 commented 4 years ago

I might be able to find time for this one. Have to find a Windows machine first though...

I've scripted DISKPART multiple times to do this at many other companies. I blogged the commands some time ago just so I could remember/script them:

https://eduncan911.com/blog/archives/create-a-bootable-usb-drive-with-windows.html

Only dangerous part is selecting the proper drive FIRST. So, some script funsies is needed to detect removable drives and present options to the user as READLINE first.

How do you see a solution to this? Would it be a BAT file the user would download and run? Or, a copy-n-paste set of commands? Maybe something the Installer would kick off? (meaning, it needs to output some format for the GUI to be able to render options for, such as which flash drive to wipe/use)

mmstick commented 4 years ago

@eduncan911 There's no need for a Windows machine. You only need to verify that the flash drives are bootable once they've been written.

The steps listed above are what needs to be done. We can switch Popsicle to a Windows-flashing mode by mounting the ISO and checking if its contents are what's expected of a Windows ISO.

The Windows-flashing mode would differ from the regular mode by copying files in parallel to NTFS-partitioned, temporarily-mounted mount points, rather than writing bytes in parallel directly to the block devices.

We already have a crate for handling mounts of block devices and ISOs: sys-mount

eduncan911 commented 4 years ago

Why NTFS? Are there any files larger than 4GB that far32 couldn't support?

That way you don't have to worry about NTFS drivers.

moriel5 commented 4 years ago

I forget, however I think that boot.wim may have gotten close to that size.

But I think that the issue is that Windows nowadays requires the main partition to be NTFS.

olback commented 4 years ago

To make this work, systems would need ntfs-3g installed? I might be wrong about this though and all that is needed is just a rust library that implements support for the NTFS filesystem.

mmstick commented 4 years ago

It could be added as an optional dependency, and the support enabled when this functionality is supported on the system (Does /bin/ntfs-3g exist?).

ids1024 commented 4 years ago

I forget, however I think that boot.wim may have gotten close to that size.

According to the documentation from Windows, it should be possible to boot the Windows installer from fat32. If install.wim is too large, it can be split into multiple files.

So that seems to be an option, if it proves easier.

Edit: Though, this also depends on exactly what Dism /Split-Image does; if that's complicated to reimplement, this just shifts the problem elsewhere.

eduncan911 commented 4 years ago

I'm confused. Are we talking about making a Windows 10 bootable USB?

I thought this request was to create a Pop_OS boot USB from within windows to install Pop_OS?

Why are we talking about install.win? That's only for installing Windows.

Maybe I misunderstood this whole issue... Lol

Because a Pop_OS installer doesn't have any files larger than 4GB (or does it?). That's what I asked earlier. Hence, no need for NTFS. Just use built-in fat32.

ids1024 commented 4 years ago

Maybe I misunderstood this whole issue... Lol

Seems so :wink:. As the title and description say, this is about "Windows 10 ISOs".

I thought this request was to create a Pop_OS boot USB from within windows to install Pop_OS?

Support for running under Windows could be a good feature to add, but it is separate from what this is asking for.

eduncan911 commented 4 years ago

Title says:

Creating bootable USB devices from Windows 10 ISOs

It doesn't say, "Creating bootable Windows 10 USB devices."

Why would Pop_OS even care about creating a Windows 10 USB stick to boot? Even more confused now. LOL

Plenty of articles out there for that. Heck, I even posted my 6+ year old article on that at the first of this thread.

(Btw, I've done extensive mods to Windows ISOs with WinPE, and yes it does require a Windows machine or VM to pass USB through to).

eduncan911 commented 4 years ago

Wait wait wait... Are we talking about some script or app that runs from DE, e.g. Gnome, that can create Windows USB boot devices?

Ah... I think I finally get it. I guess I didn't understand what "Popsicle" was. (I thought it was to install Pop_os)

So sorry for all the confusion!


If this is a scripting/binary/python/go/ruby thing, then yeah I can still do it.

If this is an App thing, someone else needs to as I have zero app dev experience on Linux/gnome - outside of console UI that is. (E.g. VLC's CLI UX)

ids1024 commented 4 years ago

Ah... I think I finally get it. I guess I didn't understand what "Popsicle" was. (I thought it was to install Pop_os)

It's the program that appears under the name "USB Flasher", which comes with Pop!_OS.

If this is a scripting/binary/python/go/ruby thing, then yeah I can still do it.

If this is an App thing, someone else needs to as I have zero app dev experience on Linux/gnome - outside of console UI that is. (E.g. VLC's CLI UX)

Take a look at the repo this issue is posted on. It's written in Rust, split into a library, with both a CLI and GTK frontend. So maybe not your choice of language, but the key part of implementing this is probably adding code to the library; not the GUI.

TeamLinux01 commented 3 years ago

A little off topic, but I figured it was related. I have been using a program call Ventoy for all my Linux/Windows booting needs now.

https://ventoy.net/en/index.html

Don't know if something like this would be the route to go in the future.

ids1024 commented 3 years ago

Based in part on this tutorial, I've written a script that does this in Python with dbus calls to UDisks.

It seems to work, though some of the UDisks calls can fail/timeout for reasons that are not entirely obvious. Some tweaks are needed there. After running the script successfully, it seems to boot fine, though I've not tested it thoroughly (i.e. I don't actually have anything I intend to install Windows on currently).

This would need to be ported to Rust for use in Popsicle, and then there would need to be some kind of code to detect the iso is Windows. And the flashing code would need to be able to copy files and display a progress bar for that, instead of doing a block level write.

Should be doable, but a bit of a pain to implement and make it work smoothly.

mmstick commented 3 years ago

@ids1024 Have you tried setting the dbus timeout to 0x7fffffff? It's the magic number for disabling the timeout altogether.

ids1024 commented 3 years ago

It's the magic number for disabling the timeout altogether.

Ah, so they do have a magic number that does that? Good (as long as it actual does eventually finish).

ibnYusrat commented 3 years ago

So.. does popsicle support Flashing Windows ISOs by now?

Heroofthenexus commented 3 years ago

I hope this feature will be added in soon, it's sorely needed.

techguy16 commented 1 year ago

Hi, have a look at the 'windows-iso' branch. This branch adds support for flashing Windows ISOs from Popsicle. The branch has existed for about a year so thr version of Popsicle is a little bit old but it still works.