The image from quick create in hyper-v for Ubuntu 18.04.2 and 19.04 doesn't allow me to install anything

I've created a new VM from using the Quick Create function in Hyper-V on windows 10.

Once the VM is setup (I've picked language settings, created a password etc) I then tried to install Visual Studio Code and got the following error message:Unable to install "Visual Studio Code": too early for operation, device not yet seeded or device model not acknowledged.

From investigation this appears to be a snap problem.

Here's some details

snap --version:

snap 2.38
snapd 2.38
series 16
ubuntu 18.04
kernel 4.15.0-50-generic

snap changes:

ID Status Spawn Ready Summary
1 Doing today at 10:58 BST - Initialize system state
2 Done today at 10:58 BST today at 10:58 BST Initialize device

snap tasks --last=seed:

Status Spawn Ready Summary
Done today at 10:58 BST today at 10:58 BST Ensure prerequisites for "core" are available
Done today at 10:58 BST today at 10:58 BST Prepare snap "/var/lib/snapd/seed/snaps/core_6673.snap" (6673)
Done today at 10:58 BST today at 10:58 BST Mount snap "core" (6673)
Done today at 10:58 BST today at 10:58 BST Copy snap "core" data
Done today at 10:58 BST today at 10:58 BST Setup snap "core" (6673) security profiles
Done today at 10:58 BST today at 10:58 BST Make snap "core" (6673) available to the system
Done today at 10:58 BST today at 10:59 BST Automatically connect eligible plugs and slots of snap "core"
Done today at 10:58 BST today at 10:59 BST Set automatic aliases for snap "core"
Done today at 10:58 BST today at 10:59 BST Setup snap "core" aliases
Done today at 10:58 BST today at 10:59 BST Run install hook of "core" snap if present
Done today at 10:58 BST today at 10:59 BST Start snap "core" (6673) services
Done today at 10:58 BST today at 10:59 BST Run configure hook of "core" snap if present
Done today at 10:58 BST today at 10:59 BST Ensure prerequisites for "gnome-3-26-1604" are available
Done today at 10:58 BST today at 10:59 BST Prepare snap "/var/lib/snapd/seed/snaps/gnome-3-26-1604_82.snap" (82)
Done today at 10:58 BST today at 10:59 BST Mount snap "gnome-3-26-1604" (82)
Done today at 10:58 BST today at 10:59 BST Copy snap "gnome-3-26-1604" data
Done today at 10:58 BST today at 10:59 BST Setup snap "gnome-3-26-1604" (82) security profiles
Done today at 10:58 BST today at 10:59 BST Make snap "gnome-3-26-1604" (82) available to the system
Done today at 10:58 BST today at 10:59 BST Automatically connect eligible plugs and slots of snap "gnome-3-26-1604"
Done today at 10:58 BST today at 10:59 BST Set automatic aliases for snap "gnome-3-26-1604"
Done today at 10:58 BST today at 10:59 BST Setup snap "gnome-3-26-1604" aliases
Done today at 10:58 BST today at 10:59 BST Run install hook of "gnome-3-26-1604" snap if present
Done today at 10:58 BST today at 10:59 BST Start snap "gnome-3-26-1604" (82) services
Done today at 10:58 BST today at 10:59 BST Run configure hook of "gnome-3-26-1604" snap if present
Doing today at 10:58 BST - Ensure prerequisites for "gnome-calculator" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-calculator_352.snap" (352)
Do today at 10:58 BST - Mount snap "gnome-calculator" (352)
Do today at 10:58 BST - Copy snap "gnome-calculator" data
Do today at 10:58 BST - Setup snap "gnome-calculator" (352) security profiles
Do today at 10:58 BST - Make snap "gnome-calculator" (352) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-calculator"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-calculator"
Do today at 10:58 BST - Setup snap "gnome-calculator" aliases
Do today at 10:58 BST - Run install hook of "gnome-calculator" snap if present
Do today at 10:58 BST - Start snap "gnome-calculator" (352) services
Do today at 10:58 BST - Run configure hook of "gnome-calculator" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-characters" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-characters_206.snap" (206)
Do today at 10:58 BST - Mount snap "gnome-characters" (206)
Do today at 10:58 BST - Copy snap "gnome-characters" data
Do today at 10:58 BST - Setup snap "gnome-characters" (206) security profiles
Do today at 10:58 BST - Make snap "gnome-characters" (206) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-characters"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-characters"
Do today at 10:58 BST - Setup snap "gnome-characters" aliases
Do today at 10:58 BST - Run install hook of "gnome-characters" snap if present
Do today at 10:58 BST - Start snap "gnome-characters" (206) services
Do today at 10:58 BST - Run configure hook of "gnome-characters" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-logs" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-logs_57.snap" (57)
Do today at 10:58 BST - Mount snap "gnome-logs" (57)
Do today at 10:58 BST - Copy snap "gnome-logs" data
Do today at 10:58 BST - Setup snap "gnome-logs" (57) security profiles
Do today at 10:58 BST - Make snap "gnome-logs" (57) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-logs"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-logs"
Do today at 10:58 BST - Setup snap "gnome-logs" aliases
Do today at 10:58 BST - Run install hook of "gnome-logs" snap if present
Do today at 10:58 BST - Start snap "gnome-logs" (57) services
Do today at 10:58 BST - Run configure hook of "gnome-logs" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-system-monitor" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-system-monitor_70.snap" (70)
Do today at 10:58 BST - Mount snap "gnome-system-monitor" (70)
Do today at 10:58 BST - Copy snap "gnome-system-monitor" data
Do today at 10:58 BST - Setup snap "gnome-system-monitor" (70) security profiles
Do today at 10:58 BST - Make snap "gnome-system-monitor" (70) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-system-monitor"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-system-monitor"
Do today at 10:58 BST - Setup snap "gnome-system-monitor" aliases
Do today at 10:58 BST - Run install hook of "gnome-system-monitor" snap if present
Do today at 10:58 BST - Start snap "gnome-system-monitor" (70) services
Do today at 10:58 BST - Run configure hook of "gnome-system-monitor" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gtk-common-themes" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gtk-common-themes_1198.snap" (1198)
Do today at 10:58 BST - Mount snap "gtk-common-themes" (1198)
Do today at 10:58 BST - Copy snap "gtk-common-themes" data
Do today at 10:58 BST - Setup snap "gtk-common-themes" (1198) security profiles
Do today at 10:58 BST - Make snap "gtk-common-themes" (1198) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gtk-common-themes"
Do today at 10:58 BST - Set automatic aliases for snap "gtk-common-themes"
Do today at 10:58 BST - Setup snap "gtk-common-themes" aliases
Do today at 10:58 BST - Run install hook of "gtk-common-themes" snap if present
Do today at 10:58 BST - Start snap "gtk-common-themes" (1198) services
Do today at 10:58 BST - Run configure hook of "gtk-common-themes" snap if present
Do today at 10:58 BST - Mark system seeded
......................................................................
Make snap "core" (6673) available to the system
2019-05-17T10:58:58+01:00 INFO Requested daemon restart.
......................................................................
Automatically connect eligible plugs and slots of snap "core"
2019-05-17T10:58:58+01:00 INFO Waiting for restart...

sudo systemctl status snapd.autoimport:

● snapd.autoimport.service - Auto import assertions from block devices Loaded: loaded (/lib/systemd/system/snapd.autoimport.service; enabled; vendor preset: enabled) Active: inactive (dead)
Condition: start condition failed at Fri 2019-05-17 16:31:20 BST; 33min ago └─ ConditionKernelCommandLine=snap_core was not met

Windows details: - Windows 10, version 1809, (OS Build 17763.437)

Things I've tried

1 - messing around with /var/lib/snapd/state.json

I tried the suggestion here:

Which looks like this:

sudo systemctl stop snapd
sudo cat /var/lib/snapd/state.json | \ jq 'delpaths([["data", "auth", "device"]])' > state.json-new
sudo cp state.json-new /var/lib/snapd/state.json
sudo systemctl start snapd

However (and this is probably me being a Ubuntu noob) I can't get jq to install and I'm not sure exactly what it's doing so I can't do it manually.

2 - Using the Ubuntu 19 image

This apparently has the same issue.

3 - A colleague tried on his laptop

He had the same issue

4 - Reinstall snapd

I ran this: sudo apt install --reinstall snapd only for the install to get stuck at 67%.

5 - messing around with /var/lib/snapd/seed/seed.yaml

As per this bug:

I tried re-ordering the gtk-common-themes part and also removing the gnome-calculator part (rebooting after each change), this appeared to make no difference. The snap tasks --last=seed command still showed it getting stuck on the gnome-calculator task.

6 - headbutting the keyboard

I felt better but the issue persisted.

7 - using a non-quick start image

I downloaded a Ubuntu 18.04.2 ISO and used that. THIS WORKED (as in I could install Visual Studio Code and the snap commands looked healthy). However, it doesn't have all the nice hyper-v stuff so the screen res sucked, no copy and paste, mouse was very laggy etc...

I could install the various bits to make this image more hyper-v friendly but I have a feeling I'll never get as slick as the official one. If I can fix the snap on this one I think I'll end up with the best UX.

8 - THIS WORKS. messing around with /var/lib/snapd/seed/seed.yaml part 2

I removed a bunch of stuff from my /var/lib/snapd/seed/seed.yaml so it now looks like this:

snaps: - name: core channel: stable file: core_6673.snap - name: gtk-common-themes channel: stable/ubuntu-18.04 file: gtk-common-themes_1198.snap - name: gnome-3-26-1604 channel: stable/ubuntu-18.04 file: gnome-3-26-1604_82.snap

And then did snap abort --last=seed followed by sudo systemctl restart snapd. Check snap tasks --last=seed - they should all be complete and you can do install snaps (such as Visual Studio Code).

Someone smarter than me will probably point out the horrible side affects this will cause.

1

1 Answer

Apparently the seed.yml file specifies apps to install on a fresh OS install.

If we remove the ones that are getting stuck and then manually install them, this works.

Steps:

  1. Change your /var/lib/snapd/seed/seed.yaml file to look like this:

    snaps:
    -
    name: core
    channel: stable
    file: core_6673.snap
    -
    name: gtk-common-themes
    channel: stable/ubuntu-18.04
    file: gtk-common-themes_1198.snap
    -
    name: gnome-3-26-1604
    channel: stable/ubuntu-18.04
    file: gnome-3-26-1604_82.snap

    Basically I'm removing all the entries that caused the snap tasks to get stuck.

  2. Abort the currently running snap tasks and restart the service:

    • snap abort --last=seed
    • sudo systemctl restart snapd
    • Keep running snap tasks --last=seed to see the progress of the snap tasks and wait for all the tasks to be "Done"
  3. Manually install any apps that you removed from /var/lib/snapd/seed/seed.yaml, they might include:

    • gnome-calculator
    • gnome-characters
    • gnome-logs
    • gnome-system-monitor

    The command to reinstall these is:

    snap install gnome-calculator gnome-characters gnome-logs gnome-system-monitor`

Credit

Thanks to Stefan Jarina for help resolving this issue!

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like