question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DiskPart exited with non-zero status (1). Aborting.

See original GitHub issue

I’ve read through all the issues (closed and open) in GitHub and tried all the suggestions that I could, but unfortunately, I’m not able to get this to work. I’m running Windows 10 x64 1909 with all available updates installed. I’ve tried three different USB sticks from different manufacturers and different USB ports. I’ve tried running it as admin and letting the script self-elevate, but they all fail with the same error:

DiskPart exited with non-zero status (1). Aborting.

DiskPart codes look like it is simply saying it is a “fatal error.” However, I looked at the Python script, and it appears that it is trying to run the following block:

"select disk {}".format(disk.get("index",-1)),
"clean",
"convert mbr",
"create partition primary size=200",
"format quick fs=fat32 label='CLOVER'",
"active",
"create partition primary id=AB" # AF = HFS, AB = Recovery

Running these commands (without the comments and commas and such, obviously, and substituting the proper disk in the select statement) in diskpart itself works just fine and creates a drive that looks like the following, but the script seems to be having an issue with it, and unfortunately, I’m not good enough with Python to troubleshoot it further. Any ideas? Thanks for all the hard work on this!

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
corpnewtcommented, Dec 30, 2019

I appreciate you taking the time to look through this. I’ll see if there’s anything I can do to improve the pathing logic - and assigning a drive letter could likely be done in the script passed to diskpart when formatting.

-CorpNewt


Could you test with the changes in this commit and see if that works better? I setup the path to diskpart using:

self.diskpart = os.path.join(os.environ['SYSTEMDRIVE'] + "\\", "Windows", "System32", "diskpart.exe")

And adjusted the diskpart.txt script to contain the following (specifically the last 2 lines):

            dp_script = "\n".join([
                "select disk {}".format(disk.get("index",-1)),
                "clean",
                "convert mbr",
                "create partition primary size=200",
                "format quick fs=fat32 label='CLOVER'",
                "active",
                "create partition primary id=AB", # AF = HFS, AB = Recovery
                "select part 1",
                "assign"
            ])

-CorpNewt

1reaction
firefox15commented, Dec 30, 2019

Regarding the latest issue of “No partitions located on disk!”, it appears that Clover needs to have a drive letter assigned to the Clover partition, or the script will fail because the following two WMI commands will not find the partition without it:

wmic path Win32_LogicalDiskToPartition get antecedent,dependent
wmic logicaldisk get deviceid,filesystem,volumename,size,drivetype /format:csv

I was able to bypass this by assigning a drive letter before the Clover step. I believe modifying the diskpart commands to assign a drive letter would likely fix the issue and would resolve #13, #23, #29, and #51 while changing the path logic should fix #25, #37, and #57.

Read more comments on GitHub >

github_iconTop Results From Across the Web

disk formatting issue with gibMacOS : r/hackintosh - Reddit
every time i run the make install script it errors out while formatting DiskPart exited with non-zero status (1). Aborting. am following ...
Read more >
ZTI ERROR - Non-zero return code by ZTIUserState, rc = 38
Hi, we're using MDT 2013 (and USMT5) to capture and deploy images. Last week a colleague captured user data and tried to restore...
Read more >
MS-DOS DiskPart Command Help - Computer Hope
By default, if DiskPart encounters an error, it will terminate with a non-zero exit status. Some DiskPart commands accept the noerr option.
Read more >
Fixed: Diskpart Clean Errors in Windows 11, 10, 8, 7
Solution 1.​​ 1. Press “Windows + R” and enter “diskpart” in the pop-up box. Then hit “Enter” key.
Read more >
gibMacOS Problems - iATKOS Inside
Using MBR.. DiskPart exited with non-zero status (1). Aborting. ​. I have tried EVERYTHING, I tried different versions of python, tried different computers, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found