ValdikSS / windows2usb

Windows 7/8/8.1/10/11 ISO to Flash Drive burning utility for Linux (MBR/GPT, BIOS/UEFI, FAT32/NTFS)
Apache License 2.0
682 stars 52 forks source link

`Unable to open == get_dev_partition_num: INTERNAL ERROR ==, No such file or directory` #24

Open ilyaigpetrov opened 2 years ago

ilyaigpetrov commented 2 years ago
sudo ./windows2usb-0.2-x86_64.AppImage /dev/sdc ./Win10_21H2_Russian_x64.iso mbr
 == Working with ISO CCCOMA_X64FRE_RU-RU_DV9 ==                                 
 == Creating new MBR-formatted partition table ==                               
Checking that no-one is using this disk right now ... OK                        

Disk /dev/sdc: 15,1 GiB, 16231956480 bytes, 31703040 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: 0xa3382964                                                     

Old situation:                                                                  

Device     Boot Start      End  Sectors  Size Id Type                           
/dev/sdc1  *     2048 31703039 31700992 15,1G  7 HPFS/NTFS/exFAT                

>>> Script header accepted.                                                     
>>> Done.                                                                       
Created a new DOS disklabel with disk identifier 0x718e8e9c.
                                                                       [229/478]
New situation:
Disklabel type: dos
Disk identifier: 0x718e8e9c

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/sdc: 15,1 GiB, 16231956480 bytes, 31703040 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: 0x718e8e9c

Old situation:

>>> Created a new DOS disklabel with disk identifier 0x9e972e02.
/dev/sdc1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 15,1 
GiB.                                                                   [206/478]
Partition #1 contains a vfat signature.
/dev/sdc2: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x9e972e02

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 31703039 31700992 15,1G  7 HPFS/NTFS/exFAT

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.fat 4.1 (2017-01-24)
 == Writing bootloader ==
Windows 7 master boot record successfully written to /dev/sdc
Unable to open  == get_dev_partition_num: INTERNAL ERROR ==, No such file or dir
ectory
umount: /run/windows2usb.WKahAnlA7P: not mounted.
ValdikSS commented 2 years ago

I'd guess that the system did not create the partition node in time for some reason. You can try to add sleep 1 here: https://github.com/ValdikSS/windows2usb/blob/5d803853aa37d02822422b4531cb40dd0c4f9091/windows2usb#L96

ilyaigpetrov commented 2 years ago

Reproduced the same bug on windows2usb-0.2.1-x86_64.AppImage.

ValdikSS commented 2 years ago

Well, add set -x to the top of the script to check what's going on.

ilyaigpetrov commented 2 years ago

ilyaigpetrov@netbook:~/Downloads/tmp/squashfs-root$ sudo PATH=$PATH:~/Downloads/
tmp/squashfs-root/deps/ ./windows2usb /dev/sdc ~/Downloads/Win10_21H2_EnglishInt
ernational_x64.iso mbr
+ set -e
+ set -f
+ set +o braceexpand
+ shopt -s nocasematch
+ export LANG=C.utf8
+ LANG=C.utf8
++ tput bold
+ bold=''
++ tput sgr0
+ normal=''
++ readlink -f -- ./windows2usb
+ scriptpath=/home/ilyaigpetrov/Downloads/tmp/squashfs-root/windows2usb
++ dirname /home/ilyaigpetrov/Downloads/tmp/squashfs-root/windows2usb
+ dirpath=/home/ilyaigpetrov/Downloads/tmp/squashfs-root
+ [[ ! -n /home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso ]]
+ [[ 0 == \0 ]]
+ dev=/dev/sdc
+ isopath=/home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso
+ isolabel=
+ labeltype=mbr
+ [[ ! -n mbr ]]
+ mountntfs_cmd=mount.ntfs-3g
+ command -v mount.ntfs-3g
+ check_requirements
+ reqs=(awk lsblk 7z mkfs.vfat mkfs.ntfs sfdisk ms-sys mktemp wimsplit)
+ local reqs
+ for req in ${reqs[*]}
+ command -v awk
+ for req in ${reqs[*]}
+ command -v lsblk
+ for req in ${reqs[*]}
+ command -v 7z
+ for req in ${reqs[*]}
+ command -v mkfs.vfat
+ for req in ${reqs[*]}
+ command -v mkfs.ntfs
+ for req in ${reqs[*]}
+ command -v sfdisk
+ for req in ${reqs[*]}
+ command -v ms-sys
+ for req in ${reqs[*]}
+ command -v mktemp
+ for req in ${reqs[*]}
+ command -v wimsplit
+ check_iso_and_device /home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso /dev/sdc
+ '[' '!' -f /home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso ']'
+ '[' '!' -b /dev/sdc ']'
++ get_iso_name /home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso
++ 7z l /home/ilyaigpetrov/Downloads/Win10_21H2_EnglishInternational_x64.iso
++ awk '/Comment = / {print $3; exit 0}'
+ isolabel=CCCOMA_X64FRE_EN-GB_DV9
+ '[' 0 -ne 0 ']'
+ echo ' == Working with ISO CCCOMA_X64FRE_EN-GB_DV9 =='
 == Working with ISO CCCOMA_X64FRE_EN-GB_DV9 ==
+ skipinstallwim=
+ splitinstallwim=1
++ mktemp -d /run/windows2usb.XXXXXXXXXX
+ partpath=/run/windows2usb.zvoi3Y2EC2
++ mktemp -d /run/windows2usb-mount.XXXXXXXXXX
+ isomountpath=/run/windows2usb-mount.YUdUBqlLDK
+ trap sigint_handler INT EXIT
+ [[ mbr == \m\b\r ]]
+ echo ' == Creating new MBR-formatted partition table =='
 == Creating new MBR-formatted partition table ==
+ format_drive dos /dev/sdc
+ [[ dos == \d\o\s ]]
+ echo 'label: dos'
+ sfdisk /dev/sdc
Checking that no-one is using this disk right now ... OK

Disk /dev/sdc: 14.95 GiB, 16025387008 bytes, 31299584 sectors
Disk model: FLASH DRIVE
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: gpt
Disk identifier: FE90419B-EB9A-5243-9986-B281A731CBDD

Old situation:

Device     Start      End  Sectors  Size Type
/dev/sdc1   2048 31299550 31297503 14.9G Microsoft basic data

>>> Script header accepted.
>>> Done.
Created a new DOS disklabel with disk identifier 0xec5ae4a3.

New situation:
Disklabel type: dos
Disk identifier: 0xec5ae4a3

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
+ sleep 3
+ echo ' == Creating FAT partition =='
 == Creating FAT partition ==
+ create_partitions dos /dev/sdc
+ local 'mbrscript=- - 7 *'
+ local 'gptscript=- - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 *'
+ local 'gptuefintfsscript=- 1MiB U *\n- - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 *'
+ [[ dos == \d\o\s ]]
+ [[ dos == \d\o\s ]]
+ echo -e '- - 7 *'
+ sfdisk /dev/sdc
Checking that no-one is using this disk right now ... OK

Disk /dev/sdc: 14.95 GiB, 16025387008 bytes, 31299584 sectors
Disk model: FLASH DRIVE
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: 0xec5ae4a3

Old situation:

>>> Created a new DOS disklabel with disk identifier 0xc1966069.
/dev/sdc1: Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 14.9 GiB.
Partition #1 contains a vfat signature.
/dev/sdc2: Done.

New situation:
Disklabel type: dos
Disk identifier: 0xc1966069

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 31299583 31297536 14.9G  7 HPFS/NTFS/exFAT

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
+ sleep 1
++ get_dev_partition_num /dev/sdc 1
++ '[' -b /dev/sdc1 ']'
++ echo /dev/sdc1
++ return
+ mkfs.vfat -n CCCOMA_X64F /dev/sdc1
mkfs.fat 4.1 (2017-01-24)
+ echo ' == Writing bootloader =='
 == Writing bootloader ==
+ ms-sys -7 -f /dev/sdc
Windows 7 master boot record successfully written to /dev/sdc
++ get_dev_partition_num /dev/sdc 1
++ '[' -b /dev/sdc1 ']'
++ '[' -b /dev/sdcp1 ']'
++ echo ' == get_dev_partition_num: INTERNAL ERROR =='
++ exit 105
+ ms-sys -e ' == get_dev_partition_num: INTERNAL ERROR =='
Unable to open  == get_dev_partition_num: INTERNAL ERROR ==, No such file or directory
+ sigint_handler
+ umount_rm_path /run/windows2usb.zvoi3Y2EC2 /run/windows2usb-mount.YUdUBqlLDK
+ '[' -d /run/windows2usb.zvoi3Y2EC2 ']'
+ umount /run/windows2usb.zvoi3Y2EC2
umount: /run/windows2usb.zvoi3Y2EC2: not mounted.
+ true
+ rm -r /run/windows2usb.zvoi3Y2EC2
+ '[' -d /run/windows2usb-mount.YUdUBqlLDK ']'
+ umount /run/windows2usb-mount.YUdUBqlLDK
+ true
+ rm -r /run/windows2usb-mount.YUdUBqlLDK
ilyaigpetrov commented 2 years ago
$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20.3
Release:        20.3
Codename:       una
$ uname -a
Linux netbook 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

In Linux Mint partitions auto mounting is present which may be a possible culprit.

s3rgeym commented 2 years ago
$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20.3
Release:        20.3
Codename:       una
$ uname -a
Linux netbook 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

In Linux Mint partitions auto mounting is present which may be a possible culprit.

Ventoy починили можешь его использовать