Snapcraft --use-lxd suddenly fails with "No root device could be found."

My last successful build was 20 mins ago and now I suddenly get:

Launching a container.
An error occurred with the instance when trying to launch with 'LXD': Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found.
Ensure that 'LXD' is setup correctly and try again.

What does this possibly mean because I haven’t changed anything between now and my last successful build?

How do I “ensure that ‘LXD’ is setup correctly and try again.” because it has already been set up and working…?

I suspect the simplest solution is to run:

snapcraft clean --use-lxd

and then restart your build. Note that this will delete the container and recreate it, so any customisations you may have made inside the container will be gone.

1 Like

That succeeded, but didn’t help:

$ snapcraft --use-lxd
Launching a container.
Build environment is in unknown state, cleaning first.
An error occurred with the instance when trying to launch with 'LXD': Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found.
Ensure that 'LXD' is setup correctly and try again.
1 Like

As it repeatedly say that my build environment is in “unknown state, cleaning first” I suspect it doesn’t really clean anything. Where does snapcraft store information about builds?

I am having a somewhat related issue as well. It seems to be trying to download an image that clearly does not exist.

(venv) om26er@X1C6:~/scm/crossbario/crossbarfx$ snapcraft clean --use-lxd; snapcraft --use-lxd
Launching a container.
An error occurred with the instance when trying to launch with 'LXD': Unable to fetch https://cloud-images.ubuntu.com/buildd/daily/focal/20200728/focal-server-cloudimg-amd64-lxd_combined.tar.gz: 404 Not Found.
Ensure that 'LXD' is setup correctly and try again.
1 Like

Ok, now this is a bit serious as it seems to have broken our CI as well :confused:

Any solutions to this yet?

I had that issue, needed to refresh to LXD stable and reboot. There was a bug fixed by @stgraber on Friday, so maybe edge is fine now. But the reboot was required for me anyhow.

2 Likes

Yeah, seems to work now after reinstall and reboot.

In my case I update our CI to install LXD from 4.0/stable. There is probably a lesson there to not use cutting edge stuff when not needed :wink:

Well, I’ve been using stable all the time. Maybe this was not the same issue after all.

No root device means something probably went amiss with your LXD storage devices:

What is the output of:

  • lxc version
  • lxc profile show default
  • lxc storage show default # or pool for the root device from the previous output

Then make sure that default storage actually exists.

I’m again having this problem!

Launching a container.
An error occurred with the instance when trying to launch with 'LXD': Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found.
Ensure that 'LXD' is setup correctly and try again.

Here are the outputs you requested:

$ lxc version
Client version: 4.4
Server version: 4.4

$ lxc profile show default
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []

$ lxc storage show default
config:
  size: 30GB
  source: /var/snap/lxd/common/lxd/disks/default.img
description: ""
name: default
driver: btrfs
used_by:
- /1.0/images/84b6630213cde4243dd2553bfc1235dba7112dd767e9fb8da33050e0f20b6e37
- /1.0/profiles/default
status: Created
locations:
- none

Was it your choice to use btrfs as the storage backend?

Might be worth setting up an alternative storage pool as documented on https://lxd.readthedocs.io/en/latest/storage/ but if running lxc launch -e ubuntu:18.04 does not work I suggest going to https://discuss.linuxcontainers.org/ which is where all the LXD experts are.

1 Like

lxc launch -e ubuntu:18.04 works just fine. This problem is somehow related to snapcraft. When it comes to btrfs I just used the defaults.

Everything has worked for several days until it suddenly stops working like this without me doing anything.

I’m having the same issue – just started spontaneously happening now. Details on my side:

$ lxc profile show default 
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []
$ lxc storage show default
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.
config:
  size: 93GB
  source: /var/snap/lxd/common/lxd/disks/default.img
  zfs.pool_name: default
description: ""
name: default
driver: zfs
used_by:
- /1.0/images/8932633f436c73463da92237cc60466a2638d4e8515ccf44036ebded90ab892c
- /1.0/profiles/default
status: Created
locations:
- none

Context in which it showed up: I had a snapcraft build fail. Re-running it restarted from where it had left off, so I decided to clean and re-run it from scratch.

I mistakenly first typed snapcraft --use-lxd clean (which errored out) before the correct snapcraft clean --use-lxd. Then when I tried snapcraft --use-lxd again I got the error:

Launching a container.
Build environment is in unknown state, cleaning first.
An error occurred with the instance when trying to launch with 'LXD': Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found.
Ensure that 'LXD' is setup correctly and try again.

It seems to have now resolved itself as spontaneously as it started appearing, as a few attempts later things are running again … :-\

1 Like

Yeah, I got this working (without even rebooting my system) just by removing snapcraft snap with --purge and installing again. As I didn’t actually try to build before reinstalling snapcraft today it’s possible that it just tried to download something that was not available and showed this confusing and incorrect error and eventually got fixed (again) by itself when Canonical fixed their resources.