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

New VM Launch Returns Error: Identifiers consist of letters… when placed image file in .UTM manually #3388

Closed
The00Dustin opened this issue Dec 15, 2021 · 4 comments · Fixed by #3409
Labels
bug Something isn't working settings Anything in the setting/create views

Comments

@The00Dustin
Copy link

Describe the issue
Error popup stating Identifiers consist of letters, digits, '-', '.', '_', starting with a letter. while trying to launch new VM.

New VM includes qcow2 file generated using qemu-img installed using brew.

Configuration

  • UTM Version: 2.4.1 (40)
  • OS Version: 11.6.2
  • Intel or Apple Silicon? Apple (M1)

Crash log
No crash reports in Console, no file names containing "qemu" in log reports section, either.

Debug Log
debug.log

Upload VM
config.plist.txt

config.plist includes this:

	<key>Drives</key>
	<array>
		<dict>
			<key>DriveName</key>
			<string>7E113ED5-C4F0-4709-98AC-FD11309A7949</string>

It seems plausible this could be the same as closed issue #2614 for iOS. In this case, can I edit that string in the plist file to start with a letter as a workaround?

@conath
Copy link
Contributor

conath commented Dec 19, 2021

Thanks for providing the debug information; however you did not describe what steps you took in UTM to produce this error.

I just tested the following steps to try and reproduce the issue, but it did not occur. (UTM does not use UUID for the image name, unless you add a 1001st image to the VM [UTMData.swift L157-176]. The code you referenced has been changed significantly.)

  1. Open UTM 2.4.1
  2. Click Plus => Start from scratch
  3. Select Drives tab
  4. Click Import Drive
  5. Open a QCOW2 file
  6. Click Save

Expected result: the Config PLIST includes the drive with "name" property "drive0".

Actual result: see expected.

If these steps produce a different result for you or if you have different steps that lead to this issue, please re-open.

@conath conath closed this as completed Dec 19, 2021
@The00Dustin
Copy link
Author

Sorry I missed that. Here are the steps I took, but I think it is obvious they wouldn't reproduce the issue consistently if the same random ID is causing the same issue:

  1. Open UTM 2.4.1
  2. Click Plus => Start from scratch
  3. Click Save
  4. Close UTM 2.4.1
  5. Install QEMU using brew in order to access QEMU-IMG application
  6. qemu-img convert -O qcow2 SourceDiskImage.vhd Library/Containers/com.utmapp.UTM/Data/Documents/NewVM.utm/Images/NewDiskImage.qcow2 -p
  7. Open UTM 2.4.1
  8. Click Settings for "New VM"
  9. Click Drives "tab"
  10. Note that drive image from (6) is already shown
  11. Set Image Type to "Disk Image" (this may have already been the case) and Interface to "IDE"
  12. Save
  13. Attempt to launch the VM and see the error.

FWIW, these steps were taken due to searching in the issues section and seeing that .vhd files aren't supported or planned to be in the future (didn't look at the date) with advice to search the Internet for how to convert them. It is possible these steps should not be taken anymore and .vhd files are now supported.

@conath conath reopened this Dec 20, 2021
@conath
Copy link
Contributor

conath commented Dec 20, 2021

Thank you @The00Dustin for the steps. This is indeed a different code path from what I was investigating. I’ll have to check that out later and see where the bug is hiding (note to self: orphaned files detection).

In the mean time please use the Import feature instead of placing files in the .utm/Images yourself. UTM is not designed to accept manual changes to the contents of the .utm folder.

@conath conath added bug Something isn't working settings Anything in the setting/create views labels Dec 22, 2021
@conath conath changed the title New VM Launch Returns Error: Identifiers consist of letters, digits, '-', '.', '_', starting with a letter. New VM Launch Returns Error: Identifiers consist of letters… when placed image file in .UTM manually Dec 22, 2021
conath added a commit to conath/UTM that referenced this issue Dec 25, 2021
QEMU drive ids must start with a letter.
However if an image files was manually placed in the VM images folder,
this code path is triggered and a UUID set for the id.
This causes ids starting with numbers to be set sometimes.

This commit changes the name for these drives to use sequential driveX numbering instead of UUID.
@conath
Copy link
Contributor

conath commented Dec 25, 2021

As suspected the bug is in the code that adds "orphaned" drive files to the configuration:

- (void)recoverOrphanedDrives {
NSArray<NSString *> *orphans = self.orphanedDrives;
for (NSInteger i = 0; i < orphans.count; i++) {
NSString *name = [NSUUID UUID].UUIDString;
[self newDrive:name path:orphans[i] type:UTMDiskImageTypeNone interface:@""];
}
}

Here in line 107 the UUID string is used as the name without the usual "drive" prefix. A fix could be to change the code to use sequential numbers for the drive names:

NSString *name = [NSString stringWithFormat:@"drive%ld", [self countDrives]];

conath added a commit to conath/UTM that referenced this issue Jan 7, 2022
QEMU drive ids must start with a letter.
However if an image files was manually placed in the VM images folder,
this code path is triggered and a UUID set for the id.
This causes ids starting with numbers to be set sometimes.

This commit changes the name for these drives to use driveUUID naming to definitively work around name collisions.
@osy osy closed this as completed in #3409 Jan 8, 2022
osy added a commit that referenced this issue Jan 8, 2022
…ed-drive

Fix #3388 invalid drive id for manually placed files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working settings Anything in the setting/create views
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants