Skip to content

Launch command fails on a long instance name #4889

Description

@geoffreynyaga

Describe the bug
On both the GUI and CLI, the launch command fails if the provided instance name is very long. This is because of the OS limitation on folder names.

To Reproduce

1. CLI

  1. multipass launch --name abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbhhgpppqnkbnvnmfgnzrhkbdzwayuadujtdcdnqvadnfpbjuxunjzfuugbnbhfvbuuaabhbpjvfnagmcxdzigfnpvfdytrzukbudqazygwhhyezkuhaxrcjdmihqiuccgqvucaynncvcekkmmvanpbbpdibftmuittdvnhvyfhuyuqzjefyjcqyqwgingtjtfwfikvqtyynmvcnmenfpavngrwtzcgncyndijtqciihcuupudenhjrqcepzxahravijivjdpjajzrznqiuukgdyxuqpecixeqbvzwufmmnxygepzujatencvmpupbmgfiejcizfdcvdzbvyiawcpnuuffyqrjdntrmeztktwfhbvvxgiuixkfnfpzqgnargdpvxdtypzfmpbggwhjwyuqjzuvhnmtcaqqbgekxjumnknczgipgdzxxnbhxgr
  2. The CLI starts downloading the image and shows an error. The full log is
multipass launch --name abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbhhgpppqnkbnvnmfgnzrhkbdzwayuadujtdcdnqvadnfpbjuxunjzfuugbnbhfvbuuaabhbpjvfnagmcxdzigfnpvfdytrzukbudqazygwhhyezkuhaxrcjdmihqiuccgqvucaynncvcekkmmvanpbbpdibftmuittdvnhvyfhuyuqzjefyjcqyqwgingtjtfwfikvqtyynmvcnmenfpavngrwtzcgncyndijtqciihcuupudenhjrqcepzxahravijivjdpjajzrznqiuukgdyxuqpecixeqbvzwufmmnxygepzujatencvmpupbmgfiejcizfdcvdzbvyiawcpnuuffyqrjdntrmeztktwfhbvvxgiuixkfnfpzqgnargdpvxdtypzfmpbggwhjwyuqjzuvhnmtcaqqbgekxjumnknczgipgdzxxnbhxg

Creating abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbhhgpppqnkbnvnmfgnzrhkbdzwayuadujtdcdnqvadnfpbjuxunjzfuugbnbhfvbuuaabhbpjvfnagmcxdzigfnpvfdytrzukbudqazygwhhyezkuhaxrcjdmihqiuccgqvucaynncvcekkmmvanpbbpdibftmuittdvnhvyfhuyuqzjefyjcqyqwgingtjtfwfikvqtyynmvcnmenfpavngrwtzcgncyndijtqciihcuupudenhjrqcepzxahravijivjdpjajzrznqiuukgdyxuqpecixeqbvzwufmmnxygepzujatencvmpupbmgfiejcizfdcvdzbvyiawcpnuuffyqrjdntrmeztktwfhbvvxgiuixkfnfpzqgnargdpvxdt

Verifying image:  |
Preparing image for abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbhhgpppqnkbnvnmfgnzrhkbdzwayuadujtdcdnqvadnfpbjuxunjzfuugbnbhfvbuuaabhbpjvfnagmcxdzigfnpvfdytrzukbudqazygwhhyezkuhaxrcjdmihqiuccgqvucaynncvcekkmmvanpbbpdibftmuittdvnhvyfhuyuqzjefyjcqyqwgingtjtfwfikvqtyynmvcnmenfpavngrwtzcgncyndijtqciihcuupudenhjrqcepzxahravijivjdpjajzrznqiuukgdyxuqpecixeqbvzwufmmnxygepzujatencvmpupbmgfiejcizfdcvdzbvyiawcpnuuffyqrjdntrmeztktwfhbvvxgiuixkfnfpzq

launch failed: unable to create directory '/var/root/Library/Application Support/multipassd/qemu/vault/instances/abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbhhgpppqnkbnvnmfgnzrhkbdzwayuadujtdcdnqvadnfpbjuxunjzfuugbnbhfvbuuaabhbpjvfnagmcxdzigfnpvfdytrzukbudqazygwhhyezkuhaxrcjdmihqiuccgqvucaynncvcekkmmvanpbbpdibftmuittdvnhvyfhuyuqzjefyjcqyqwgingtjtfwfikvqtyynmvcnmenfpavngrwtzcgncyndijtqciihcuupudenhjrqcepzxahravijivjdpjajzrznqiuukgdyxuqpecixeqbvzwufmmnxygepzujatencvmpupbmgfiejcizfdcvdzbvyiawcpnuuffyqrjdntrmeztktwfhbvvxgiuixkfnfpzqgnargdpvxdtypzfmpbggwhjwyuqjzuvhnmtcaqqbgekxjumnknczgipgdzxxnbhxg'

2. GUI

  1. The GUI starts downloading the image and shows the "launching state". The GUI also shows a black ribbon across the screen with the long name which is not a good user experience.
Image 2. The GUI displays the error. Image

The error message is:
unable to create directory '/var/root/ Library/Application Support/multipassd/ qemu/vault/instances/jvkcwwuqdxgkviht hjhndimukwzzxwxtrjueurnbngmeptfmjydi faiivbhhgpppqnkbnvnmfgnzrhkbdzwayu adujtdednqvadnfpbjuxunjzfuugbnbhfvbu uaabhbpjvfnagmoxdzigfnpvfdytrzukbudq azygwhhyezkuhaxrcjdmihqiuccgqvucayn ncvcekkmmvanpbbpdibftmuittdvnhvyfhu yuązjefyjcąyqwgingtjtfwfikvątyynmvcn...

Expected behavior

  1. In the CLI, there should be an instant error message if the name exceeds a certain string length.
    An example would be
multipass launch --name <a very long string>
launch failed: instance name too long (<length of provided string e.g. 200> chars, max <what is the max allowed?>)

    Instance names map to filesystem directories and must fit OS limits.
    Allowed: 1–<max allowed> chars, [a-zA-Z][a-zA-Z0-9-]*

    Try: multipass launch --name <shorter-name>

We can also truncate the echoed instance name in the error log to make the logs/error message readable. If you look at provided terminal logs in the previous section, they are not great design.

Something to debate:

We could still launch an instance by truncating the long instance name to the max allowed length and issue a warning in the terminal.

multipass launch --name abcdjvkcwwuqdxgkvi...nbhxgr
warning: name truncated to <max allowed> chars → 'abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbh'
           original was 612 chars (OS filesystem limit)
           use --strict-name or --force etc to fail instead

Launched: abcdjvkcwwuqdxgkvihthjhndimukwzzxwxtrjueurnbngmeptfmjydifqiivbh

The tradeoff here is that the process is convenient but there is a silent collision risk if two long names share prefix

  1. In the GUI, a text input validator on the name form field should have a validation check for string length.

Additional info

  • OS: MacOS Tahoe 26.5
  • CPU architecture or model: Apple M1

We also need to find out what is the max string length that is allowed by the various OS.

Metadata

Metadata

Labels

highHigh priority. Combine with "medium" to signal intermediate medium-high priority.mediumMedium priority. Combine with "low" or "high" to signal intermediate priority.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions