While running windows2usb /dev/loop0 xxx.iso mbr, we're getting this error:
== Writing bootloader ==
/dev/loop0 seems to be a disk partition device,
use the switch -f to force writing of a master boot record
While running `windows2usb /dev/loop0 xxx.iso mbr`, we're getting this error:
```
== Writing bootloader ==
/dev/loop0 seems to be a disk partition device,
use the switch -f to force writing of a master boot record
```
The software does not work with loop device properly (in one shot) because upon creating new partitions on loop device, the kernel does not create additional devices in /dev for partitions, requiring userspace softwae like losetup or kpartx to do that.
The software does not work with loop device properly (in one shot) because upon creating new partitions on loop device, the kernel does not create additional devices in /dev for partitions, requiring userspace softwae like losetup or kpartx to do that.
loop device is working perfectly in my test. I'm running Arch Linux, installed windows2usb from AUR.
This is the full log:
➜ qemu qemu-img create -f raw usb.img 6G
Formatting 'usb.img', fmt=raw size=6442450944
➜ qemu sudo losetup -P /dev/loop0 usb.img
➜ qemu sudo windows2usb /dev/loop0 ~/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso mbr
== Working with ISO CCCOMA_X64FRE_EN-US_DV9 ==
== Creating new MBR-formatted partition table ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Done.
Created a new DOS disklabel with disk identifier 0xf5f78d93.
New situation:
Disklabel type: dos
Disk identifier: 0xf5f78d93
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
== Waiting 3 seconds to settle new partition layout ==
== Creating FAT partition ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf5f78d93
Old situation:
>>> Created a new DOS disklabel with disk identifier 0x2c2f44b1.
/dev/loop0p1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 6 GiB.
/dev/loop0p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0x2c2f44b1
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 12582911 12580864 6G 7 HPFS/NTFS/exFAT
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.fat 4.2 (2021-01-31)
== Writing bootloader ==
Windows 7 master boot record successfully written to /dev/loop0
FAT32 PE boot record successfully written to /dev/loop0p1
== Mounting data partition ==
== NOTE: install.wim is greater than 4 GiB and will be split to fit FAT32 limit ==
== Extracting files from ISO to the partition ==
7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=C,Utf16=off,HugeFiles=on,64 bits,8 CPUs x64)
Scanning the drive for archives:
1 file, 5883697152 bytes (5612 MiB)
Extracting archive: /home/recolic/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso
--
Path = /home/recolic/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso
Type = Udf
Physical Size = 5883697152
Comment = CCCOMA_X64FRE_EN-US_DV9
Cluster Size = 2048
Created = 2021-10-07 08:00:00
Everything is Ok
Folders: 85
Files: 903
Size: 918393834
Compressed: 5883697152
Splitting WIM: 4693 MiB of 4693 MiB (100%) written, part 2 of 2
Finished splitting "/run/windows2usb-mount.RGqoUTYedw/sources/install.wim"
== Unmounting partition ==
NOTE: If this process takes very long to complete, your system is misconfigured!
More info: https://github.com/ValdikSS/windows2usb/issues/3#issuecomment-771534058
== All done! ==
➜ qemu
➜ qemu lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 6G 0 loop
└─loop0p1 259:0 0 6G 0 part
sda 8:0 0 476.9G 0 disk
├─sda1 8:1 0 499M 0 part
├─sda2 8:2 0 499M 0 part /boot
├─sda3 8:3 0 128M 0 part
├─sda4 8:4 0 164.9G 0 part
├─sda5 8:5 0 75.8G 0 part /var/lib/docker/btrfs
│ /
└─sda9 8:9 0 210.1G 0 part
└─home 254:0 0 210.1G 0 crypt /home/recolic/Downloads/PicturesLink
/home
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 1.3T 0 part /mnt
└─sdb2 8:18 0 500G 0 part
sdc 8:32 1 0B 0 disk
➜ qemu sudo losetup -d /dev/loop0
➜ qemu
loop device is working perfectly in my test. I'm running Arch Linux, installed windows2usb from AUR.
This is the full log:
```
➜ qemu qemu-img create -f raw usb.img 6G
Formatting 'usb.img', fmt=raw size=6442450944
➜ qemu sudo losetup -P /dev/loop0 usb.img
➜ qemu sudo windows2usb /dev/loop0 ~/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso mbr
== Working with ISO CCCOMA_X64FRE_EN-US_DV9 ==
== Creating new MBR-formatted partition table ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Done.
Created a new DOS disklabel with disk identifier 0xf5f78d93.
New situation:
Disklabel type: dos
Disk identifier: 0xf5f78d93
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
== Waiting 3 seconds to settle new partition layout ==
== Creating FAT partition ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf5f78d93
Old situation:
>>> Created a new DOS disklabel with disk identifier 0x2c2f44b1.
/dev/loop0p1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 6 GiB.
/dev/loop0p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0x2c2f44b1
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 12582911 12580864 6G 7 HPFS/NTFS/exFAT
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.fat 4.2 (2021-01-31)
== Writing bootloader ==
Windows 7 master boot record successfully written to /dev/loop0
FAT32 PE boot record successfully written to /dev/loop0p1
== Mounting data partition ==
== NOTE: install.wim is greater than 4 GiB and will be split to fit FAT32 limit ==
== Extracting files from ISO to the partition ==
7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=C,Utf16=off,HugeFiles=on,64 bits,8 CPUs x64)
Scanning the drive for archives:
1 file, 5883697152 bytes (5612 MiB)
Extracting archive: /home/recolic/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso
--
Path = /home/recolic/extraHDD/images/en-us_windows_10_consumer_editions_version_21h2_x64_dvd_6cfdb144.iso
Type = Udf
Physical Size = 5883697152
Comment = CCCOMA_X64FRE_EN-US_DV9
Cluster Size = 2048
Created = 2021-10-07 08:00:00
Everything is Ok
Folders: 85
Files: 903
Size: 918393834
Compressed: 5883697152
Splitting WIM: 4693 MiB of 4693 MiB (100%) written, part 2 of 2
Finished splitting "/run/windows2usb-mount.RGqoUTYedw/sources/install.wim"
== Unmounting partition ==
NOTE: If this process takes very long to complete, your system is misconfigured!
More info: https://github.com/ValdikSS/windows2usb/issues/3#issuecomment-771534058
== All done! ==
➜ qemu
➜ qemu lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 6G 0 loop
└─loop0p1 259:0 0 6G 0 part
sda 8:0 0 476.9G 0 disk
├─sda1 8:1 0 499M 0 part
├─sda2 8:2 0 499M 0 part /boot
├─sda3 8:3 0 128M 0 part
├─sda4 8:4 0 164.9G 0 part
├─sda5 8:5 0 75.8G 0 part /var/lib/docker/btrfs
│ /
└─sda9 8:9 0 210.1G 0 part
└─home 254:0 0 210.1G 0 crypt /home/recolic/Downloads/PicturesLink
/home
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 1.3T 0 part /mnt
└─sdb2 8:18 0 500G 0 part
sdc 8:32 1 0B 0 disk
➜ qemu sudo losetup -d /dev/loop0
➜ qemu
```
Hrm, Fedora 34 does not automatically re-scan and re-add partitions on loop devices. As far as I know, Ubuntu does not as well. What did you configure to do that?
Hrm, Fedora 34 does not automatically re-scan and re-add partitions on loop devices. As far as I know, Ubuntu does not as well. What did you configure to do that?
I have performed this test on both Ubuntu 21.10 and archlinux. You need to run losetup -P /dev/loop0 xxx.img, and apply this pull request. And it will work very well on any linux distro.
Maybe you missed the -P argument.
This is testing log on Ubuntu:
root@localhost:~# rm usb.img
root@localhost:~# truncate -s 6G usb.img
root@localhost:~# losetup -P /dev/loop0 usb.img
root@localhost:~# squashfs-root/windows2usb /dev/loop0 en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso mbr
== Working with ISO CES_X64FREV_EN-US_DV9 ==
== Creating new MBR-formatted partition table ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Done.
Created a new DOS disklabel with disk identifier 0x6e5570b7.
New situation:
Disklabel type: dos
Disk identifier: 0x6e5570b7
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
== Waiting 3 seconds to settle new partition layout ==
== Creating FAT partition ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6e5570b7
Old situation:
>>> Created a new DOS disklabel with disk identifier 0xbbacc623.
/dev/loop0p1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 6 GiB.
/dev/loop0p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0xbbacc623
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 12582911 12580864 6G 7 HPFS/NTFS/exFAT
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.fat 4.2 (2021-01-31)
== Writing bootloader ==
Windows 7 master boot record successfully written to /dev/loop0
FAT32 PE boot record successfully written to /dev/loop0p1
== Mounting data partition ==
== Extracting files from ISO to the partition ==
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,1 CPU x64)
Scanning the drive for archives:
1 file, 4899461120 bytes (4673 MiB)
Extracting archive: en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
--
Path = en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
Type = Udf
Physical Size = 4899461120
Comment = CES_X64FREV_EN-US_DV9
Cluster Size = 2048
Created = 2021-10-07 00:00:00
Everything is Ok
Folders: 85
Files: 905
Size: 4894030614
Compressed: 4899461120
== Unmounting partition ==
NOTE: If this process takes very long to complete, your system is misconfigured!
More info: https://github.com/ValdikSS/windows2usb/issues/3#issuecomment-771534058
== All done! ==
root@localhost:~#
I have performed this test on both Ubuntu 21.10 and archlinux. You need to run `losetup -P /dev/loop0 xxx.img`, and apply this pull request. And it will work very well on any linux distro.
Maybe you missed the `-P` argument.
This is testing log on Ubuntu:
```
root@localhost:~# rm usb.img
root@localhost:~# truncate -s 6G usb.img
root@localhost:~# losetup -P /dev/loop0 usb.img
root@localhost:~# squashfs-root/windows2usb /dev/loop0 en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso mbr
== Working with ISO CES_X64FREV_EN-US_DV9 ==
== Creating new MBR-formatted partition table ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Done.
Created a new DOS disklabel with disk identifier 0x6e5570b7.
New situation:
Disklabel type: dos
Disk identifier: 0x6e5570b7
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
== Waiting 3 seconds to settle new partition layout ==
== Creating FAT partition ==
Checking that no-one is using this disk right now ... OK
Disk /dev/loop0: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6e5570b7
Old situation:
>>> Created a new DOS disklabel with disk identifier 0xbbacc623.
/dev/loop0p1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 6 GiB.
/dev/loop0p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0xbbacc623
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 12582911 12580864 6G 7 HPFS/NTFS/exFAT
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.fat 4.2 (2021-01-31)
== Writing bootloader ==
Windows 7 master boot record successfully written to /dev/loop0
FAT32 PE boot record successfully written to /dev/loop0p1
== Mounting data partition ==
== Extracting files from ISO to the partition ==
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,1 CPU x64)
Scanning the drive for archives:
1 file, 4899461120 bytes (4673 MiB)
Extracting archive: en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
--
Path = en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
Type = Udf
Physical Size = 4899461120
Comment = CES_X64FREV_EN-US_DV9
Cluster Size = 2048
Created = 2021-10-07 00:00:00
Everything is Ok
Folders: 85
Files: 905
Size: 4894030614
Compressed: 4899461120
== Unmounting partition ==
NOTE: If this process takes very long to complete, your system is misconfigured!
More info: https://github.com/ValdikSS/windows2usb/issues/3#issuecomment-771534058
== All done! ==
root@localhost:~#
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
While running
windows2usb /dev/loop0 xxx.iso mbr, we're getting this error:The software does not work with loop device properly (in one shot) because upon creating new partitions on loop device, the kernel does not create additional devices in /dev for partitions, requiring userspace softwae like losetup or kpartx to do that.
But loop device is working very well in my test...
I'll so some further test to see if there's any problem.
loop device is working perfectly in my test. I'm running Arch Linux, installed windows2usb from AUR.
This is the full log:
Hrm, Fedora 34 does not automatically re-scan and re-add partitions on loop devices. As far as I know, Ubuntu does not as well. What did you configure to do that?
That's strange... I'll do some investigation on fresh-installed ArchLinux..
I have performed this test on both Ubuntu 21.10 and archlinux. You need to run
losetup -P /dev/loop0 xxx.img, and apply this pull request. And it will work very well on any linux distro.Maybe you missed the
-Pargument.This is testing log on Ubuntu:
Indeed, there may be some changes lately or I remember the behavior incorrectly. Thanks!