Giter Site home page Giter Site logo

woeusb / woeusb Goto Github PK

View Code? Open in Web Editor NEW
2.1K 23.0 118.0 317 KB

A Microsoft Windows® USB installation media preparer for GNU+Linux

Home Page: https://github.com/WoeUSB/WoeUSB

Shell 96.28% Roff 3.72%
windows bootable-usb winusb linux command-line-tool command-line-app woeusb gnu-linux

woeusb's Introduction

WoeUSB

https://github.com/WoeUSB/WoeUSB

A Microsoft Windows® USB installation media preparer for GNU+Linux

Continuous Integration(CI) Status Badge REUSE status

WoeUSB logo

Features

  • Support Legacy PC/UEFI booting
  • Support FAT32 and NTFS filesystems
  • Support using physical installation disc or disk image as source

Supported Windows® installation images

  • Windows Vista and later
  • Any language or edition variants
  • Windows PE

NOTE: Non official installation media may be supported, but not guaranteed

Dependencies

The following are the dependencies that WoeUSB requires, in one way or another. Refer the wiki for distro-specific information.

Required

WoeUSB will not be able to function without these software installed in their proper locations:

  • GNU Bash
    For interpreting and executing the program logic
    Requires >= 4.3
  • The GNU Core Utilities(Coreutils)
    For common Unix utilities necessary for basic operations
  • util-linux
    For low-level utilities interacting with storage devices, etc
  • GNU Grep and Gawk
    For parsing necessary information out from a command output
  • The GNU Find Utilities
    For enumerating files required for operation
  • GNU GRUB
    For installing the bootstrap code used in a Legacy PC boot
    We specifically requires modules of the i386-pc architecture, for Debian-based distributions these are provided via the grub-pc-bin package
  • GNU Parted
    For manipulating disk partition table and partitions
  • GNU Wget
    For acquiring Pete Batard's UEFI:NTFS UEFI bootloader
  • dosfstools
    For creating FAT filesystem in --device creation method
  • NTFS-3G
    For creating NTFS filesystem in --device creation method
  • wimlib
    For splitting install.wim Windows Imaging (WIM) archive so that archives over 4GiB can be fit in an FAT32 filesystem

Optional

Without the following dependencies WoeUSB will still able to run, but some functionalities will be unavailable:

  • p7zip
    For workaround the problem where the Windows 7 installation media doesn't ship their UEFI bootloader in the proper location
  • Pete Batard's UEFI:NTFS UEFI bootloader
    For supporting NTFS filesystems in the target USB key
  • GNU gettext
    For supporting message internationalization(I18N)

Installation

To be addressed. For now refer Run from source.

Run from source

WoeUSB is a program that can be run without installation(excluding its dependencies):

  1. Download the program(woeusb-N.N.N.bash) from the Releases page
  2. Fix the missing executable file permission (chmod +x path/to/woeusb-N.N.N.bash)
  3. Launch a terminal application and run the program via the appropriate path(sudo path/to/woeusb-N.N.N.bash --help)

Usage

Environment variables

The following are the environment variables that may change WoeUSB's runtime behavior:

Variable name Usage
RUFUS_UEFI_NTFS_VERSION The release tag/revision of the Rufus source tree to fetch the UEFI:NTFS image from, will use a tested version by default

License

WoeUSB is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

WoeUSB is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with WoeUSB. If not, see http://www.gnu.org/licenses/.

Identify otherwise specified licenses applicable to a certain product/development asset

If the asset is in plaintext format:

  1. Check the SPDX-License-Identifier tag in the file's header
  2. Check the .reuse/dep5 file from the source tree/release tree directory

If the asset is not in plaintext format:

Check the .reuse/dep5 file from the source tree/release tree directory

Credits

woeusb's People

Contributors

brlin-tw avatar challs avatar jonnytech avatar philenotfound avatar przemyslaw-szustak avatar rsplwe avatar waxymocha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

woeusb's Issues

line 2063: script_name: unbound variable

Describe the bug

When trying to run woeusb-5.0.4.bash , the following error is given:

./woeusb-5.0.4.bash: line 2063: script_name: unbound variable

Environment

  • OS: centOS 7
  • Bash: GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
  • WoeUSB: 5.0.4

Many error messages are printed to stdout instead of stderr

Describe the bug

WoeUSB/sbin/woeusb

Lines 150 to 155 in 69af694

if ! mount_source_filesystem \
"${source_media}" \
"${source_fs_mountpoint}"; then
echo_with_color red 'Error: Unable to mount source filesystem'
exit 1
fi

WoeUSB/sbin/woeusb

Lines 189 to 195 in 69af694

if ! mount_target_filesystem \
"${target_partition}" \
"${target_fs_mountpoint}" \
"${target_filesystem_type}"; then
echo_with_color red 'Error: Unable to mount target filesystem'
exit 1
fi

WoeUSB/sbin/woeusb

Lines 387 to 392 in 69af694

if [ "${#parameters[@]}" -lt 2 ]; then
echo_with_color \
red \
"${FUNCNAME[0]}: Error: --partition option requires 2 arguments!"
return 1
fi

WoeUSB/sbin/woeusb

Lines 405 to 410 in 69af694

if [ "${#parameters[@]}" -lt 2 ]; then
echo_with_color \
red \
"${FUNCNAME[0]}: Error: --device option requires 2 arguments!"
return 1
fi

WoeUSB/sbin/woeusb

Lines 427 to 434 in 69af694

if [ ${#parameters[@]} -lt 1 ]; then
printf_with_color \
red \
'%s: %s\n' \
"${FUNCNAME[0]}" \
'ERROR: --label option requires 1 argument.'
return 1
fi

WoeUSB/sbin/woeusb

Lines 445 to 452 in 69af694

if [ ${#parameters[@]} -lt 1 ]; then
printf_with_color \
red \
'%s: %s\n' \
"${FUNCNAME[0]}" \
'ERROR: --debugging-internal-function-call option requires at least 1 argument.'
return 1
fi

WoeUSB/sbin/woeusb

Lines 461 to 468 in 69af694

if [ ${#parameters[@]} -lt 1 ]; then
printf_with_color \
red \
'%s: %s\n' \
"${FUNCNAME[0]}" \
'ERROR: --target-filesystem option requires 1 argument.'
return 1
fi

WoeUSB/sbin/woeusb

Lines 503 to 508 in 69af694

if \
[ "${enable_partition}" == true ] \
&& [ "${enable_label}" == true ]; then
echo_with_color red "${FUNCNAME[0]}: Error: --label option only can be used with --device creation method"
return 1
fi

WoeUSB/sbin/woeusb

Lines 511 to 516 in 69af694

if \
[ "${enable_target_filesystem}" == true ] \
&& [ "${enable_partition}" == true ]; then
echo_with_color red "${FUNCNAME[0]}: Error: --target-filesystem option only can be used with --device creation method"
return 1
fi

WoeUSB/sbin/woeusb

Lines 626 to 629 in 69af694

if ! command -v "${required_command}" >/dev/null; then
echo_with_color red "${FUNCNAME[0]}: Error: ${application_name} requires ${required_command} command in the executable search path, but it is not found."
result=failed
fi

WoeUSB/sbin/woeusb

Lines 640 to 646 in 69af694

else
echo_with_color red \
"${FUNCNAME[0]}: Error: mkdosfs/mkfs.msdos/mkfs.vfat/mkfs.fat command not found!" >&2
echo_with_color red \
"${FUNCNAME[0]}: Error: Please make sure that dosfstools is properly installed!" >&2
result='failed'
fi

WoeUSB/sbin/woeusb

Lines 650 to 656 in 69af694

else
printf_with_color red \
'%s\n%s\n' \
"${FUNCNAME[0]}: Error: mkntfs command not found!" \
"${FUNCNAME[0]}: Error: Please make sure that ntfs-3g is properly installed!"
result=failed
fi

WoeUSB/sbin/woeusb

Lines 708 to 720 in 69af694

if [ "${install_mode_ref}" = device ] \
&& [[ "${target_media}" =~ .*[0-9] ]]
then
echo_with_color red "${FUNCNAME[0]}: Error: Target media \"${target_media_ref}\" is not an entire storage device!"
return 1
fi
if [ "${install_mode_ref}" = partition ] \
&& ! [[ "${target_media}" =~ .*[0-9] ]]
then
echo_with_color red "${FUNCNAME[0]}: Error: Target media \"${target_media_ref}\" is not an partition!"
return 1
fi

WoeUSB/sbin/woeusb

Lines 756 to 762 in 69af694

printf -- \
'%s: Error: Unsupported target filesystem "%s", currently supported target filesystems: %s, %s' \
"${FUNCNAME[0]}" \
"${target_filesystem_type_libblkid}" \
"${ENUM_SUPPORTED_FILESYSTEMS[FS_FAT]}" \
"${ENUM_SUPPORTED_FILESYSTEMS[FS_NTFS]}"
return 1

WoeUSB/sbin/woeusb

Lines 771 to 777 in 69af694

if [ "${verbose}" = true ]; then
echo "${FUNCNAME[0]}: Info: Target device is '${target_device_ref}'."
echo "${FUNCNAME[0]}: Info: Target partition is '${target_partition_ref}'."
if [ "${install_mode}" = partition ]; then
echo "${FUNCNAME[0]}: Info: Target filesystem is '${ENUM_SUPPORTED_FILESYSTEMS[$target_filesystem_type]}'."
fi
fi

WoeUSB/sbin/woeusb

Lines 804 to 812 in 69af694

if [ "$(mount \
| grep \
--count \
--fixed-strings \
"${source_media}"
)" != 0 ]; then
echo_with_color red "Error: Source media is currently mounted, unmount the partition then try again"
exit 1
fi

and more.

Expected behavior

Warning and error messages should be outputted to STDERR.

Move global variables to `main` context

Rationale

Designed to be changed by the user, make it closer to the start of the file.

Implementation detail

Use the readonly command to avoid modification in runtime.

allow parameters to autocomplete

Is your feature request related to a problem? Please describe

When typing parameters, easily typos can come in. If to support CLI autocomplete also with parameters, there will be much less errors.

Describe the solution you'd like

When typing --de and then press TAB once then its name will be autocompleted, in current case as --device. Or if there are multiple parameters with same beginning, pressing TAB quickly twice will show choices. This is very common in Linux command-line.

Describe alternatives you've considered

Open help page of woeusb in separate window and copy parameters from there.

Additional context

If there will be multiple ISOs supported and in folder, where WoeUSB is started, it could automatically use appropriate parameter to use with multiple ISOs.

Device always busy

WoeUSB always states the device is busy.

Which is hilarious because none of the partitions are even mounted!

Umount confirms the same.

Why is WoeUSB saying this and how can I resolve it?

Host system is Fedora 33

./woeusb: line 128: local: program_name: readonly variable (was: script broken on Fedora 33)

$ ./woeusb --help
./woeusb: line 128: local: program_name: readonly variable
The command "local -r program_name="$1"" failed with exit status "1", program is prematurely aborted
$ bash --version 
GNU bash, version 5.0.17(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ 

Improve "filesystem still mounted" error message

Describe the bug

A clear and concise description of what the bug is.

I may recommend slightly reworking the error string to include what device is currently still mounted to clarify to the user what device is causing problems. I thought my problem was that my usb's partition was mounted (though I unmounted it and knew it was unmounted) but the problem was that the iso was still mounted.

Source: https://github.com/slacka/WoeUSB/issues/112#issuecomment-803661686

Evaluate proper command-line argument parsing implementation options

Is your feature request related to a problem? Please describe

Currently, our command-line argument parsing is based on big and ugly switch cases, we should probably delegate to a specific (internal/external) command to do so.

Describe the solution you'd like

  • getopt command from util-linux
    • Seems to be promising, but not sure

Describe alternatives you've considered

  • shell builtin getopts command
    • Not all required features supported

Additional context

N/A

"mount failed: Operation not permitted." (run as sudo)

Describe the bug

woeusb fails to mount /tmp/woeusb-source-20210520-075336-Thursday.j4C5pa. The program continues afterward and throws a few more errors.

To Reproduce

  1. umount /dev/sdX
  2. sudo ./woeusb-5.1.0.bash -d windows_iso /dev/sdX

Expected behavior

The flash drive gets correctly prepared

Teminal output

WoeUSB v5.1.0
==============================
Mounting source filesystem...
mount: /tmp/woeusb-source-20210520-075336-Thursday.j4C5pa: mount failed: Operation not permitted.
mount_source_filesystem: Error: Unable to mount source media
Error: Unable to mount source filesystem
Unmounting and removing "/tmp/woeusb-source-20210520-075336-Thursday.j4C5pa"...
umount: /tmp/woeusb-source-20210520-075336-Thursday.j4C5pa: not mounted.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-source-20210520-075336-Thursday.j4C5pa".
Unmounting and removing "/tmp/woeusb-target-20210520-075336-Thursday.0vbhsN"...
umount: /tmp/woeusb-target-20210520-075336-Thursday.0vbhsN: not mounted.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-target-20210520-075336-Thursday.0vbhsN".
Some mountpoints are not unmount/cleaned successfully and must be done manually
You may now safely detach the target device

Environment

  • OS: Arch Linux (5.12.4-arch1-2)
  • Bash: version 5.1.8(1)-release
  • WoeUSB: v5.1.0

Additional context

  • I got the .bash file from releases
  • aur/woeusb and aur/woeusb-gui have the same issue
  • Flash drive is a SanDisk Cruzer Blade 8GB (USB 2.0)
  • The flash drive currently has Arch Linux installed on it (installed with Rufus with ISO mode)

many: Wrong usage of printf

Describe the bug

WoeUSB/sbin/woeusb

Lines 917 to 920 in 69af694

printf_with_color \
green \
'%s\n' \
'Making system realize that partition table has changed...'

WoeUSB/sbin/woeusb

Lines 988 to 991 in 69af694

printf_with_color \
red \
'%s\n' \
"${FUNCNAME[0]}: FATAL: Illegal parted_mkpart_fs_type, please report bug."

  • The message body should not be substituted into %s.
  • Parameter(variable) expansions should be provided via format specifier arguments.

One should check other locations of the same issue.

Improve software dependency accessibility (was: [Features] A script that install dependancies)

Hi, i know linux it's hardcore, but i wonder : Why you don't make the install of the ONLY usb windows maker more easy ?

I mean, you don't even put some lines to copy/cut in the terminal to install the dependencies in the readme, you make a list, and it's not even the name of the soft you can install with sudo apt for example.

So, why not make a like a script that install or a more accessible way of install this ?

Thanks a lot for the work !

Exit trap is wrongfully triggered when `--help` is issued

Describe the bug

As title

To Reproduce

Steps to reproduce the behavior:

Run ./path/to/woeusb --help

Expected behavior

Only help text is printed

Teminal output

If applicable, add the terminal output to help explain your problem. Please avoid pasting screenshots whenever possible.

WoeUSB 5.0.1 Help Information
======================================

...stripped

## Command-line Options ##
    --verbose, -v
        Verbose mode

...stripped

    --for-gui
        No longer supported, reserved for compatibility with the wrapper programs

Unmounting and removing "/tmp/woeusb-source-20201116-065010-Monday.V7gxBi"...
umount: /tmp/woeusb-source-20201116-065010-Monday.V7gxBi: not mounted.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-source-20201116-065010-Monday.V7gxBi".
Unmounting and removing "/tmp/woeusb-target-20201116-065010-Monday.KKSQG0"...
umount: /tmp/woeusb-target-20201116-065010-Monday.KKSQG0: not mounted.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-target-20201116-065010-Monday.KKSQG0".
Some mountpoints are not unmount/cleaned successfully and must be done manually

Environment

  • OS: Ubuntu
  • Bash: 5.0.17
  • WoeUSB: 5.0.1

Flatpak Version

It appears that this is the new home for WoeUSB going forward. I really appreciate the effort of all the contributors.

I am requesting a flatpak version for the next release. Appimage are great and easy to make but they don't run everywhere
The future of Linux desktop apps is cross-distro apps. When choosing a packaging format, don't look to the past. Look to the future. In the future most linux distributions will be based on OSTREE. So it is wise to have a package format that not only works on today's linux systems but also tomorrow's. Flatpak is write once and run everywhere. There is no more need to focus on multiple distributions or platform versions. Just focus on one.

sorrry, app not working :-(

[welon@wel windows10]$
[welon@wel windows10]$ sudo woeusb --device Win10_1803_Polish_x64.iso /dev/sdf --target-filesystem NTFS
[sudo] hasło użytkownika welon:
WoeUSB v5.0.4

Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sdf...
/dev/sdf: usunięto 2 bajty pod offsetem 0x000001fe (dos): 55 aa
/dev/sdf: wywoływanie ioctl w celu ponownego odczytu tablicy partycji: Sukces
Ensure that /dev/sdf is really wiped...
Creating new partition table on /dev/sdf...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
Failed to sync device /dev/sdf1: Błąd wejścia/wyjścia
Syncing device. FAILEDThe command ""${command_mkntfs}" --quick --label "${filesystem_label}" "${target_partition}"" failed with exit status "1", program is prematurely aborted
Unmounting and removing "/tmp/woeusb-source-20210203-122941-Wednesday.a6ntJC"...
Unmounting and removing "/tmp/woeusb-target-20210203-122941-Wednesday.edRtte"...
umount: /tmp/woeusb-target-20210203-122941-Wednesday.edRtte: nie zamontowany.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-target-20210203-122941-Wednesday.edRtte".
Some mountpoints are not unmount/cleaned successfully and must be done manually
You may now safely detach the target device
[welon@wel windows10]$ ^C
[welon@wel windows10]$

read iso file from stdin

Is your feature request related to a problem? Please describe

No hard drive space to save iso file to disk - the script must read the iso from a file saved to disk

A clear and concise description of what the problem is.
Windows ISOs tend to be large. On old hardware or in some situations (for example liveusb), this can limit situations where this script can be used if the iso is too large to hold on disk.

Describe the solution you'd like

Allow woeusb to read the iso file from stdin instead of requiring it to be read from a file

A clear and concise description of what you want to happen.
1/ Download windows iso on laptop 1, currently not running linux.
2/ Transfer windows iso to laptop 2 with hardware restrictions. Use ncat or ssh, both of which will spit out the file contents to stdout by default. Or download the iso file directly to laptop 2 with curl if that's an option.
3/ Pipe the ncat/ssh/curl output from 2/ into woeusb, running in "read iso from stdin mode"

This would enable writing data to usb without it ever having to be persisted to disk, similar to what can be done with dd command: cat foobarfile | dd of=myoutputfile
The final setup could be used like this:
Laptop 1:
ncat -vw1 $LAPTOP_2_IP_ADDR $PORTNO < windows.iso
Laptop 2:
ncat -w1 -vlp $PORTNO | pv | sudo ./woeusb --device - /dev/sdX

Describe alternatives you've considered

Use tmpfs https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html

A clear and concise description of any alternative solutions or features you've considered.
Create tmpfs with mkdir /mnt/tmpfs; mount -t tmpfs none /mnt/tmpfs
Download iso file into tmpfs
Run the script as usual
Potential issue with this case: if ram gets saturated, the OS can crash or the download can fail
Second workaround: get different hardware

Additional context

Thank you so much for this project, it's truly a lifesaver

Add any other context or screenshots about the feature request here.

Requires wimlib-imagex, but has installed on Debian

This error occurs on run woeusb-5.1.0.bash,

check_runtime_dependencies: Error: WoeUSB requires wimlib-imagex command in the executable search path, but it is not found.

Screenshot shows the wimlib-imagex has been installed.

Captura de tela de 2021-03-21 17-59-42

automatic unmount if possible

Is your feature request related to a problem? Please describe

Currently usually USB-stick will be mounted in nowadays Linux distros. This prevents the use of WoeUSB unless you unmount in first place.

Describe the solution you'd like

While running WoeUSB, it is expected that it detects whether the filesystems on USB-stick are mounted or not. If mounted, it should automatically try to unmount in first place. If there is any problem, e.g. filesystem is somehow in use, it should announce it, e.g. the output of lsof /dev/sdX command to show, what is using.
If not having enough permissions, WoeUSB should nicely ask it as described here - #26

Describe alternatives you've considered

Currently manually unmounting, but quite often I forgot it and then I get bunch of error messages in first place, which is not pleasant.

Drop license statement in file header

To Reproduce

Steps to reproduce the problem:

  1. Open sbin/woeusb with a text editor
  2. Frown on the wall of comments that are not really important but use a lot of space

Expected behavior

A clear and concise description of what you expected to happen.

  • Add WoeUSB project link next to # This file is part of WoeUSB.

  • Move the following passage to project README:

    # WoeUSB is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # WoeUSB is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with WoeUSB  If not, see <http://www.gnu.org/licenses/>.
    

BREAKING CHANGE: Use rsync (instead of dd) for file copying process

Currently, we use find(1)+while(built-in) loop, cp(1), and dd(1) to copy source media files to target filesystem (to mostly support displaying accurate(?) progress to the GUI wrapper), it has the following problems:

  • Potentially poor copy performance
  • Obscure interaction with GUI wrapper

Switching to rsync(1) based solution will offer the following benefits:

  • machine-parsable output supported
  • Potentially better copy performance
  • Potentially better process reporting

However, making this change will certainly make the current wxWidgets based GUI wrapper malfunction, so it's not backward compatible.

Inspiration

WinToUsbLinux.sh · master · vaared / WinToUsbLinux · GitLab

/usr/lib/grub/i386-pc/modinfo.sh doesn't exist

I get the following error when try to create a bootable USB. Any ideas how to proceed?

➜  Downloads sudo ./woeusb --tgt-fs NTFS --device ~/Downloads/Win10_20H2_EnglishInternational_x64.iso /dev/sdc
WoeUSB v@@WOEUSB_VERSION@@
==============================
Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sdc...
/dev/sdc: 5 bytes were erased at offset 0x00008001 (udf): 43 44 30 30 31
Ensure that /dev/sdc is really wiped...
Creating new partition table on /dev/sdc...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
--2020-10-22 14:56:01--  https://github.com/pbatard/rufus/raw/master/res/uefi/uefi-ntfs.img
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img [following]
--2020-10-22 14:56:02--  https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.12.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.12.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288 (512K) [application/octet-stream]
Saving to: ‘/tmp/WoeUSB.7LRnQn.tempdir/uefi-ntfs.img’

uefi-ntfs.img             100%[==================================>] 512.00K  --.-KB/s    in 0.1s    

2020-10-22 14:56:02 (3.49 MB/s) - ‘/tmp/WoeUSB.7LRnQn.tempdir/uefi-ntfs.img’ saved [524288/524288]

1024+0 records in
1024+0 records out
524288 bytes (524 kB, 512 KiB) copied, 0.110466 s, 4.7 MB/s
Mounting target filesystem...
Applying workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
Copying files from source media...
Installing GRUB bootloader for legacy PC booting support...
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.
The command ""${command_grubinstall}" --target=i386-pc --boot-directory="${target_fs_mountpoint}" --force "${target_device}"" failed with exit status "1", program is prematurely aborted
Resetting workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
./woeusb: line 1679: echo: write error: Invalid argument
The command ""${command_grubinstall}" --target=i386-pc --boot-directory="${target_fs_mountpoint}" --force "${target_device}"" failed with exit status "1", program is prematurely aborted

Could be similar to #8

Does the last 3% take an eternity or what?

Apologies for the bad formatting of an "issue", this is more of a "Is this actually supposed to be a thing or no?". Just frustrated, 4 days trying to make a windows USB and nothing is working thus far.

System NeoFetch https://i.imgur.com/rGeGF83.png
Using WoeUSB version 4.0.3
Image: Win10_20H2_English_x64.iso
Device Mode: /dev/sdd, 16GB USB Flash Drive
CLI Args: --tgt-fs NTFS --workaround-bios-boot-flag --device ~/Downloads/Win10_20H2_English_x64.iso /dev/sdd
Console Log at the time of writing this: https://pastebin.com/SY5hSFt6

Its been hung on 97% for over 30 minutes at this point. Is this expected behaviour?

Write to VHD support

Is it possible to do this somehow?

I've tried creating an empty fixed VHD file, then mounting in with loop, but WoeUSB says Target /dev/loop10 is not an entire storage device!

cannot mount device

Describe the bug

i type this..
sudo /snap/bin/woe-usb.woeusb --device Win10.iso /dev/sda --tgt-fs NTFS
and get mount failure

i also get this without ntfs

Expected behavior

i expect it to work

Environment

Deepin 20
woe usb snap edge

bhante@subhuntu:~/Downloads$ sudo /snap/bin/woe-usb.woeusb --device Win10.iso /dev/sda --tgt-fs NTFS
WoeUSB v@@WOEUSB_VERSION@@

Mounting source filesystem...
mount: permission denied
mount_source_filesystem: Error: Unable to mount source media
Error: Unable to mount source filesystem
Unmounting and removing "/media/woeusb_source_1611194231_17926"...
umount: /media/woeusb_source_1611194231_17926: must be superuser to unmount
cleanup_mountpoint: Warning: Unable to unmount "/media/woeusb_source_1611194231_17926".
Some mountpoints are not unmount/cleaned successfully and must be done manually
You may now safely detach the target device
bhante@subhuntu:~/Downloads$

automatically asking proper superuser if forgot to use

Is your feature request related to a problem? Please describe

Currently if you forgot to use sudo prior WoeUSB command, you will get bunch of error messages. It takes some time to find out relevant lines from that long text in order to understand, that you just forgot sudo before the woeusb command

Describe the solution you'd like

In case of running woeusb without sudo, it should automatically ask your user password and run it via sudo. If the current user is not the member of sudo group, WoeUSB should ask that user username and password, who has sudo in current PC.
In case of non-sudo Linux distro, it should ask root user and its password.

Describe alternatives you've considered

Currently just manually is needed to determine the use of superuser permissions and use sudo command or switch to root via su - root command

Additional context

It makes the use of WoeUSB much more smooth to behave appropriately in case the user forgot to use the superuser power.

Add step-by-step how to install on Ubuntu

The README states the dependencies, but it would be helpful to have a sudo apt install DEPENDENCIES command to ctrl+c and ctrl+v for the installation of them. Or at least have the packages listed with the names they have in the distro.

Also it says "Run from source" but the step by step instructions need archives from the Release page and not git clone from the repository source, which is unhelpful for running from the source for development.

allow fit multiple ISO-files in one USB-storage device

Is your feature request related to a problem? Please describe

The problem is, that you never know, whether the target system is 64-bit or 32-bit capable. Also if there is less memory, there might be 32-bit more reasonable.
Another issue is, if there are multiple languages, then for each language is separate USB-stick needed to create. I propose to allow them to be on one USB-stick. Today USB-sticks have lots of space, there could be easily fit more than one onto one USB-stick. Also it is not easy to update such USB-stick - it requires lots of time. If something goes wrong, it starts over.

Describe the solution you'd like

woeusb --device-multi iso-1.iso iso-2.iso .... iso-n.iso /dev/sdX

Or there could be just same command but with more than one ISO-file support:
woeusb --device iso-1.iso iso-2.iso .... iso-n.iso /dev/sdX
... if it is possible to do so. If not, then separate parameter for multiple ISOs can be created.

There should be menu available to choose between 32-bit, 64-bit and different languages. There could be just every ISO-file listed in the menu - would be sufficient, e.g.:

  • Win10_20H2_English_x32
  • Win10_20H2_English_x64
  • Win10_20H2_Estonian_x32
  • Win10_20H2_Estonian_x64

These would be ~19,5 GB - there are 32 GB USB-sticks available, which are quite common nowadays. Also much larger are available. Even external SSD could be used, which volumes are in terabytes. In such case (SSD used), the search by type would be useful, because the menu can be very long due to lots of items of ISO-files - there should be a search line, where can type. Starting typing will automatically filter available items in menu. Such searching by typing should work in case of any part of menu item. E.g. starting typing language name will also work, even the language name is part of the filename and not necessarily the first word in menu.

I guess automatically creating menu would be enough. No need to create parameter for that. If there is one ISO in determined folder, then no menu will be generated. If there is more than one ISO, automatically menu will be generated.

Would be even more easier, if there could be also easily updated such USB-stick, when new versions of MS Windows 10 comes out twice per year. The easiest way could be just copy ISO-files onto USB-stick, e.g. to determined folder and that's it. When booting such USB-stick, then WoeUSB would automatically identify *.iso files in specific folder on USB-stick and creates appropriate boot menu, if more than one ISO-file have been found. Then mounts selected ISO over loopback and rest of boot process goes like it used to. Using ISO-files will not mix its contents on USB-stick and therefore they can co-exist and used.
In case of new MS Windows 10 version, we just download new ISO-files, after checking checksums, delete old ISO-files from USB-stick and copy new ones. Also, if would like to add other Windows versions, just copy additional ISO files to that determined folder and on next boot these fill be recognized.

Describe alternatives you've considered

Microsoft has Media Creation Tool (MCT). Using it under MS Windows it is possible to put 32-bit and 64-bit onto one USB-stick if there is MS Windows PC available. Or try to use Wine under Linux to run that MCT under Linux.

Additional context

When just copying ISO-files, then it would be much more easier to prepare USB-storage. Although I'm not sure, whether MS Windows allows to do so.

Same error on my side. Before the error, it was waiting on "Installing for i386-pc platform" as described in #2. Full log:

Same error on my side. Full log:

➜  Downloads sudo ./woeusb --device ~/Downloads/Win10_20H2_EnglishInternational_x64.iso /dev/sdc --tgt-fs NTFS
WoeUSB v@@WOEUSB_VERSION@@
==============================
Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sdc...
/dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdc: calling ioctl to re-read partition table: Success
Ensure that /dev/sdc is really wiped...
Creating new partition table on /dev/sdc...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
--2020-10-22 16:56:02--  https://github.com/pbatard/rufus/raw/master/res/uefi/uefi-ntfs.img
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img [following]
--2020-10-22 16:56:03--  https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.12.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.12.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288 (512K) [application/octet-stream]
Saving to: ‘/tmp/WoeUSB.DtupeT.tempdir/uefi-ntfs.img’

uefi-ntfs.img             100%[==================================>] 512.00K  --.-KB/s    in 0.1s    

2020-10-22 16:56:03 (4.61 MB/s) - ‘/tmp/WoeUSB.DtupeT.tempdir/uefi-ntfs.img’ saved [524288/524288]

1024+0 records in
1024+0 records out
524288 bytes (524 kB, 512 KiB) copied, 0.0579957 s, 9.0 MB/s
Mounting target filesystem...
Applying workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
Copying files from source media...
Installing GRUB bootloader for legacy PC booting support...
Installing for i386-pc platform.
Installation finished. No error reported.
Installing custom GRUB config for legacy PC booting...
Resetting workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
./woeusb: line 1679: echo: write error: Invalid argument
The command "exit 0" failed with exit status "1", program is prematurely aborted

Originally posted by @nikolayhg in #8 (comment)

mktemp incompatibility

Describe the bug

Slackware version of mktemp has no support to extra values before the XXXXXX tag.

Fix suggestion

Remove the .tempdir part from mktemp arguments in temp_directory declaration.

To Reproduce

  1. Run the script on a Slackware 14.2 box
  2. See error

Teminal output

# ./woeusb-5.1.0.bash 
mktemp: cannot make temp dir /tmp/WoeUSB.XXXXXX.tempdir: Invalid argument
The command "temp_directory=$(
    mktemp         -d         -t         WoeUSB.XXXXXX.tempdir
)" failed with exit status "1", program is prematurely aborted
$ mktemp -V
mktemp version debianutils-2.7

Environment

  • OS: Slackware 14.2
  • Bash: GNU bash, version 4.3.48(1)-release (x86_64-slackware-linux-gnu)
  • WoeUSB: 5.1.0

mount_target_filesystem: Error: Unable to mount target partition

When I execute this command, I get the following error message:
sudo ./woeusb-5.0.4.bash --no-color --target-filesystem NTFS --device Win10_20H2_EnglishInternational_x64.iso /dev/sdb > woeusb_ntfs.log 2>&1

WoeUSB v5.0.4
==============================
Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sdb...
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioctl to re-read partition table: Success
Ensure that /dev/sdb is really wiped...
Creating new partition table on /dev/sdb...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
--2020-12-01 23:27:13--  https://github.com/pbatard/rufus/raw/master/res/uefi/uefi-ntfs.img
Resolving github.com (github.com)... 192.30.255.112
Connecting to github.com (github.com)|192.30.255.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img [following]
--2020-12-01 23:27:14--  https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.8.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.8.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288 (512K) [application/octet-stream]
Saving to: ‘/tmp/WoeUSB.NqEzNR.tempdir/uefi-ntfs.img’

     0K .......... .......... .......... .......... ..........  9%  234K 2s
    50K .......... .......... .......... .......... .......... 19%  178K 2s
   100K .......... .......... .......... .......... .......... 29%  161K 2s
   150K .......... .......... .......... .......... .......... 39%  326K 1s
   200K .......... .......... .......... .......... .......... 48%  228K 1s
   250K .......... .......... .......... .......... .......... 58%  302K 1s
   300K .......... .......... .......... .......... .......... 68%  244K 1s
   350K .......... .......... .......... .......... .......... 78%  306K 0s
   400K .......... .......... .......... .......... .......... 87%  233K 0s
   450K .......... .......... .......... .......... .......... 97%  331K 0s
   500K .......... ..                                         100%  895K=2.1s

2020-12-01 23:27:16 (245 KB/s) - ‘/tmp/WoeUSB.NqEzNR.tempdir/uefi-ntfs.img’ saved [524288/524288]

1024+0 records in
1024+0 records out
524288 bytes (524 kB, 512 KiB) copied, 1.80694 s, 290 kB/s
Mounting target filesystem...
ntfs_mst_post_read_fixup_warn: magic: 0xffffffff  size: 1024   usa_ofs: 65535  usa_count: 65535: Invalid argument
ntfs_mst_post_read_fixup_warn: magic: 0xffffffff  size: 1024   usa_ofs: 65535  usa_count: 65535: Invalid argument
ntfs_mst_post_read_fixup_warn: magic: 0xffffffff  size: 1024   usa_ofs: 65535  usa_count: 65535: Invalid argument
ntfs_mst_post_read_fixup_warn: magic: 0xffffffff  size: 1024   usa_ofs: 65535  usa_count: 65535: Invalid argument
$MFTMirr error: Invalid mft record for '$MFT'.
Failed to mount '/dev/sdb1': Input/output error
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details.
mount_target_filesystem: Error: Unable to mount target partition
Error: Unable to mount target filesystem
Unmounting and removing "/tmp/woeusb-source-20201201-232650-Tuesday.JhWNIv"...
Unmounting and removing "/tmp/woeusb-target-20201201-232650-Tuesday.3R9eQm"...
umount: /tmp/woeusb-target-20201201-232650-Tuesday.3R9eQm: not mounted.
cleanup_mountpoint: Warning: Unable to unmount "/tmp/woeusb-target-20201201-232650-Tuesday.3R9eQm".
Some mountpoints are not unmount/cleaned successfully and must be done manually
You may now safely detach the target device

I had to add target-filesystem because the default FAT throws an error. I'm assuming it's because the iso size is 5.8G.

Here is my OS:
NAME="elementary OS"
VERSION="5.1.7 Hera"

Is this now the active project? (And issue migration?)

Active project

I was browsing around reading about the write issues regarding NTFS formatted partitions required for Win10-isos on the other project page, and I wondered a bit about the status of the project in general.

Mentioned over here by Lin-Buo-Ren this is supposed to be a new active project: https://github.com/slacka/WoeUSB/issues/209#issuecomment-699851697

Issue migration/priority

Also, as far as I can imagine due to the state of Win7 being more or less abandoned my MS, I imagine the main usage of WoeUSB should be for creating Win10 boot sticks. I'm currently writing a stick myself with the latest ISO from MS which requires me to use NTFS because of the >4GB files which wont fit on a FAT32 partition. I've set a timer for good measure, it has been stuck on the "Installing for i386-pc platform." for just over 21 minutes as of writing. (If I remember I'll get back here with a comment of the total time taken once it is finished)

Not sure if there are more critical issues regarding the project available currently, for my use on Ubuntu 20.04 this was the only hurdle from it being a near perfect alternative for me to something like Rufus on Linux.

Here are two old issues talking about what seems to be the same problem (which also contain important discussions about the underlying cause):

Temporary directory names with non C locale

Describe the bug

Failure while reading target_fs_uuid due to extended characters that may be produced by function generate_timestamp. The extended characters are converted to escape sequences by lsblk and does not match in piped grep when reading the target_fs_uuid.

The full WoeUSB execution logs was:

WoeUSB v5.1.0
==============================
Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sde...
/dev/sde: 5 bytes foram apagados na posição 0x00008001 (udf): 43 44 30 30 31
Ensure that /dev/sde is really wiped...
Creating new partition table on /dev/sde...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
mkfs.fat 3.0.28 (2015-05-16)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
Mounting target filesystem...
Copying files from source media...
Splitting WIM: 4708 MiB of 4708 MiB (100%) written, part 2 of 26%
Finished splitting "./sources/install.wim"
Installing GRUB bootloader for legacy PC booting support...
Installation finished. No error reported.
Installing custom GRUB config for legacy PC booting...
The command "cut --fields=1 --delimiter=' '" failed with exit status "1", program is prematurely aborted
The command "target_fs_uuid=$(
        lsblk             --noheadings             --raw             --output UUID,MOUNTPOINT         | grep             --extended-regexp             "${target_fs_mountpoint}"$         | cut             --fields=1             --delimiter=' '
    )" failed with exit status "1", program is prematurely aborted
Unmounting and removing "/tmp/woeusb-source-20210522-205401-sábado.tOmEwJ"...
Unmounting and removing "/tmp/woeusb-target-20210522-205401-sábado.cMMWmN"...
You may now safely detach the target device

Observe that my operating system runs with LC_ALL=pt_BR.UTF-8, so the date formatter %A seems to has ignored the LC_TIME=C in function generate_timestamp and has expanded to sábado (as you can be observed on Unmounting and removing logs at end of the logs).

As a temporary fix, I have changed generate_timestamp it to set LC_ALL instead of LC_TIME and that fixed the execution by generating %A in English instead of my current locale. As long as I could tell, this change does not has side effects, so I suggest it to be the permanent fix in upstream code.

Environment

  • OS: Slackware 14.2
  • Bash: GNU bash, version 4.3.48(1)-release (x86_64-slackware-linux-gnu)
  • WoeUSB: 5.1.0

date test

To check if date was outputting the correct value, I have done the fallowing test:

$ LC_TIME=C.UTF-8                 date                 +%Y%m%d-%H%M%S-%A
20210522-212732-sábado
$ LC_ALL=C.UTF-8                 date                 +%Y%m%d-%H%M%S-%A
20210522-212755-Saturday

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.