multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Directions on how to use MULTIPASS_STORAGE are missing some crucial steps

Open schveiguy opened this issue 1 year ago • 1 comments

Describe the bug

The online steps to use the MULTIPASS_STORAGE data migration are missing some steps that render existing instances inoperable

To Reproduce

Ensure at least one instance exists in the original location

Follow all the directions here: https://multipass.run/docs/configure-multipass-storage#heading--linux

including removing the original data. (I just moved the data because removing it scared me, and lucky I did or I would have panicked)

Try to start an instance or list instances -- they either don't start or are gone from the listing.

Expected behavior My original instances to be usable, but stored in a different location.

Logs

This is a log of all the relevant commands I ran:

steves@homebuild:~$ multipass list
Name                    State             IPv4             Image
nrmbuild                Stopped           --               Ubuntu 18.04 LTS
steves@homebuild:~$ sudo snap stop multipass
2023-10-12T20:58:23-04:00 INFO Waiting for "snap.multipass.multipassd.service" to stop.
Stopped.
steves@homebuild:~$ sudo snap connect multipass:all-home
steves@homebuild:~$ mkdir -p multipass
steves@homebuild:~$ sudo chown root multipass
steves@homebuild:~$ sudo mkdir /etc/systemd/system/snap.multipass.multipassd.service.d/
steves@homebuild:~$ sudo tee /etc/systemd/system/snap.multipass.multipassd.service.d/override.conf <<EOF
[Service]
Environment=MULTIPASS_STORAGE=/home/steves/multipass
> EOF
[Service]
Environment=MULTIPASS_STORAGE=/home/steves/multipass
steves@homebuild:~$ sudo systemctl daemon-reload
steves@homebuild:~$ sudo cp -r /var/snap/multipass/common/data/multipassd /home/steves/multipass/data
steves@homebuild:~$ sudo cp -r /var/snap/multipass/common/cache/multipassd /home/steves/multipass/cache
steves@homebuild:~$ sudo snap start multipass
Started.
steves@homebuild:~$ multipass list
Name                    State             IPv4             Image
nrmbuild                Stopped           --               Ubuntu 18.04 LTS

At this point, my instances still work. But let's move the original data away

steves@homebuild:~$ sudo mkdir /root/multipass
steves@homebuild:~$ sudo mv /var/snap/multipass/common/data/multipassd /root/multipass/data
steves@homebuild:~$ sudo mv /var/snap/multipass/common/cache/multipassd /root/multipass/cache
steves@homebuild:~$ multipass list
Name                    State             IPv4             Image
nrmbuild                Stopped           --               Ubuntu 18.04 LTS
steves@homebuild:~$ multipass shell nrmbuild
start failed: cannot start VM without an image

The instance fails to start. If I reboot at this point, the image disappear from the listing!

Now, what I found is that there are 2 configuration files that need updating. One config file multipass-vm-instances.json which has the absolute path of the instance images in the "arguments" key for each instance, and the config file vault/multipassd-instance-image-records.json which has it listed as a "path" key for each instance. These also need to point at the correct directories, or the instance fails to start!

If these are updated, the instances start correctly.

Additional info

  • OS: Ubuntu 22.04.2
  • multipass version: 1.12.2
  • multipass info --all
Name:           nrmbuild
State:          Running
IPv4:           10.44.115.87
Release:        Ubuntu 18.04.6 LTS
Image hash:     4431ad342590 (Ubuntu 18.04 LTS)
CPU(s):         1
Load:           0.00 0.05 0.05
Disk usage:     3.7GiB out of 4.8GiB
Memory usage:   126.6MiB out of 15.7GiB
Mounts:         /home/steves/git => git
                    UID map: 1000:default
                    GID map: 1000:default
  • multipass get local.driver : qemu

schveiguy avatar Oct 13 '23 01:10 schveiguy

Hi @schveiguy, thank you for pointing this out! You are right, those two json files indeed need updating when transferring old data, (which that how-to tries to achieve).

ricab avatar Oct 13 '23 09:10 ricab