Lxd: "No root device could be found" when creating new container from image

Created on 23 Mar 2017  路  6Comments  路  Source: lxc/lxd

Required information

  • Distribution: CentOS
  • Distribution version: 7.3.1611
  • The output of "lxc info" or if that fails:
config: {}
api_extensions:
- storage_zfs_remove_snapshots
- container_host_shutdown_timeout
- container_syscall_filtering
- auth_pki
- container_last_used_at
- etag
- patch
- usb_devices
- https_allowed_credentials
- image_compression_algorithm
- directory_manipulation
- container_cpu_time
- storage_zfs_use_refquota
- storage_lvm_mount_options
- network
- profile_usedby
- container_push
- container_exec_recording
- certificate_update
- container_exec_signal_handling
- gpu_devices
- container_image_properties
- migration_progress
- id_map
- network_firewall_filtering
- network_routes
- storage
- file_delete
- file_append
- network_dhcp_expiry
- storage_lvm_vg_rename
- storage_lvm_thinpool_rename
- network_vlan
- image_create_aliases
- container_stateless_copy
api_status: stable
api_version: "1.0"
auth: trusted
public: false
environment:
  addresses: []
  architectures:
  - x86_64
  - i686
  certificate: |
    -----BEGIN CERTIFICATE-----
    ...
    -----END CERTIFICATE-----
  certificate_fingerprint: 69fc87bb290f2351ad78165457a853b5be437498529902c10ed111e8a3ec7650
  driver: lxc
  driver_version: 1.0.9
  kernel: Linux
  kernel_architecture: x86_64
  kernel_version: 3.10.0-514.10.2.el7.x86_64
  server: lxd
  server_pid: 1032
  server_version: "2.12"
  storage: btrfs
  storage_version: 4.4.1

Issue description

I am trying to create container from Centos 7 image, and it fails:

# lxc image list
+-------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
| ALIAS | FINGERPRINT  | PUBLIC |           DESCRIPTION           |  ARCH  |   SIZE   |          UPLOAD DATE          |
+-------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
|       | 6bd5c0e40c9a | no     | Centos 7 amd64 (20170323_02:16) | x86_64 | 65.25MB  | Mar 23, 2017 at 12:34pm (UTC) |
+-------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
|       | a781ec53fc07 | no     | Template-20170310-085722        | x86_64 | 549.45MB | Mar 23, 2017 at 12:22pm (UTC) |
+-------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
[root@loadtest ~]# lxc launch 6bd5c0e40c9a NewContainer -p default -p privileged
Creating NewContainer
error: No root device could be found.

Information to attach

  • [ ] output of the client with --debug
DBUG[03-23|15:03:16] POST {"devices":{},"name":"NewContainer","profiles":["default","privileged"],"source":{"fingerprint":"a781ec53fc07","type":"image"}}
 to http://unix.socket/1.0/containers 
DBUG[03-23|15:03:16] Raw response: {"type":"async","status":"Operation created","status_code":100,"operation":"/1.0/operations/7668f87b-d1b5-477a-9caf-694f7264bd09","error_code":0,"error":"","metadata":{"id":"7668f87b-d1b5-477a-9caf-694f7264bd09","class":"task","created_at":"2017-03-23T15:03:16.239260451+02:00","updated_at":"2017-03-23T15:03:16.239260451+02:00","status":"Running","status_code":103,"resources":{"containers":["/1.0/containers/NewContainer"]},"metadata":null,"may_cancel":false,"err":""}}

Creating NewContainer
DBUG[03-23|15:03:16] Raw response: {"type":"sync","status":"Success","status_code":200,"operation":"","error_code":0,"error":"","metadata":{"id":"7668f87b-d1b5-477a-9caf-694f7264bd09","class":"task","created_at":"2017-03-23T15:03:16.239260451+02:00","updated_at":"2017-03-23T15:03:16.239260451+02:00","status":"Failure","status_code":400,"resources":{"containers":["/1.0/containers/NewContainer"]},"metadata":null,"may_cancel":false,"err":"No root device could be found."}}

error: No root device could be found.

Most helpful comment

It seems that none of your profiles specify a root disk device and you're not specifying one when starting a container. One of those options is required to start a container properly. So you need to find out what storage pools you have available by doing:

lxc storage list

then choose the name of the storage pool you want to create the container on and then either do:

lxc profile device add default root disk path=/ pool=<pool-name>

or

lxc launch 6bd5c0e40c9a NewContainer -p default -p privileged -s <pool-name>

All 6 comments

It seems that none of your profiles specify a root disk device and you're not specifying one when starting a container. One of those options is required to start a container properly. So you need to find out what storage pools you have available by doing:

lxc storage list

then choose the name of the storage pool you want to create the container on and then either do:

lxc profile device add default root disk path=/ pool=<pool-name>

or

lxc launch 6bd5c0e40c9a NewContainer -p default -p privileged -s <pool-name>

Thank you, @brauner! That fixed the problem.
But now another problem:

# lxc launch 6bd5c0e40c9a NewContainer -p default -p privileged
Creating NewContainer
error: Failed to set LXC config: lxc.mount.auto=proc:mixed sys:mixed cgroup:mixed

I wonder, what's the cause why it fails to set LXC config.

  driver: lxc
  driver_version: 1.0.9

That would be why. You're using LXC 1.0.x rather than 2.0.x.

Thank you @stgraber!
I've updated lxc* system packages, and that fixes the problem.

I just run into the same problem. What are the use cases to have docker profile without this root device?

The Docker profile was needed for older version of Docker to successfully run in a LXD container. It doesn't have a root disk device because it can't reasonably assume what pool property the user wants to have. Either add one, or add the default and the docker profile to the container lxc profile assign <c> docker,default.

Was this page helpful?
0 / 5 - 0 ratings