Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of a faulty APFS volume breaks installation #833

Open
ches opened this issue Feb 2, 2024 · 1 comment
Open

Parsing of a faulty APFS volume breaks installation #833

ches opened this issue Feb 2, 2024 · 1 comment
Labels
MacOS Darwin/MacOS

Comments

@ches
Copy link

ches commented Feb 2, 2024

Error

Error: 
   0: Planner error
   1: Error executing action
   2: Action `create_nix_volume` errored
   3: Action `create_apfs_volume` errored
   4: Serde("missing field `Encryption`")

Metadata

key value
version 0.16.1
os macos
arch aarch64

This is an edge case, but a real one that happened, so perhaps it's worth improving.

The Encryption field in plist output from diskutil appears to be optional actually, at least in the presence of a faulty disk which the command reports with a successful exit status.

I happen to have a faulty external disk attached, for which diskutil apfs list reports an error string in the Encrypted field where the relevant bit looks like this in the human-readable output (notice the final line):

+-- Container disk5 70967390-346F-4062-B600-D559E11B9625
    ====================================================
    APFS Container Reference:     disk5
    Size (Capacity Ceiling):      999994101760 B (1000.0 GB)
    Capacity In Use By Volumes:   613823676416 B (613.8 GB) (61.4% used)
    Capacity Not Allocated:       386170425344 B (386.2 GB) (38.6% free)
    |
    +-< Physical Store disk4s2 435B27E3-03BD-4B4B-942B-DB6C74E514FB
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk4s2
    |   Size:                       999994101760 B (1000.0 GB)
    |
    +-> Volume disk5s1 E04BD327-E0C1-4B31-BE82-97F4D68DD072
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk5s1 (No specific role)
    |   Name:                      Heen (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         104920772608 B (104.9 GB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk5s3 51A18CB8-3F37-456F-8F00-D11D5B1268AB
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk5s3 (Backup)
        Name:                      Time Machine (Case-sensitive)
        Mount Point:               Not Mounted
        Capacity Consumed:         508695658496 B (508.7 GB)
        Encrypted:                 ERROR -69461

In plist format, I guess given that it isn't certain of a decisive boolean value, the Encryption field just gets omitted altogether:

Long-ish plist snippet
<dict>
	<key>APFSContainerUUID</key>
	<string>70967390-346F-4062-B600-D559E11B9625</string>
	<key>CapacityCeiling</key>
	<integer>999994101760</integer>
	<key>CapacityFree</key>
	<integer>386170425344</integer>
	<key>ContainerReference</key>
	<string>disk5</string>
	<key>DesignatedPhysicalStore</key>
	<string>disk4s2</string>
	<key>Fusion</key>
	<false/>
	<key>PhysicalStores</key>
	<array>
		<dict>
			<key>DeviceIdentifier</key>
			<string>disk4s2</string>
			<key>DiskUUID</key>
			<string>435B27E3-03BD-4B4B-942B-DB6C74E514FB</string>
			<key>Size</key>
			<integer>999994101760</integer>
		</dict>
	</array>
	<key>Volumes</key>
	<array>
		<dict>
			<key>APFSVolumeUUID</key>
			<string>E04BD327-E0C1-4B31-BE82-97F4D68DD072</string>
			<key>CapacityInUse</key>
			<integer>104920772608</integer>
			<key>CapacityQuota</key>
			<integer>0</integer>
			<key>CapacityReserve</key>
			<integer>0</integer>
			<key>CryptoMigrationOn</key>
			<false/>
			<key>DeviceIdentifier</key>
			<string>disk5s1</string>
			<key>Encryption</key>
			<false/>
			<key>FileVault</key>
			<false/>
			<key>Locked</key>
			<false/>
			<key>Name</key>
			<string>Heen</string>
			<key>Roles</key>
			<array/>
		</dict>
		<dict>
			<key>APFSVolumeUUID</key>
			<string>51A18CB8-3F37-456F-8F00-D11D5B1268AB</string>
			<key>CapacityInUse</key>
			<integer>508695658496</integer>
			<key>CapacityQuota</key>
			<integer>0</integer>
			<key>CapacityReserve</key>
			<integer>0</integer>
			<key>CryptoMigrationOn</key>
			<false/>
			<key>DeviceIdentifier</key>
			<string>disk5s3</string>
			<key>Name</key>
			<string>Time Machine</string>
			<key>Roles</key>
			<array>
				<string>Backup</string>
			</array>
		</dict>
	</array>
</dict>

Note that some other volume fields like <FileVault> and <Locked> are also absent, so may want to consider whether all of these can be handled gracefully. (Perhaps it's even normal for fields to vary for Time Machine volumes—the backup role—even if not faulty?)

@Hoverbear Hoverbear added the MacOS Darwin/MacOS label Feb 2, 2024
@Hoverbear
Copy link
Contributor

Oh no, that is surprising and unfortunate. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MacOS Darwin/MacOS
Projects
None yet
Development

No branches or pull requests

2 participants