Lxc import - error: not found

  • I exported my container with lxc export container.
  • Deleted the container and images from storage pool
  • Ran lxd init again to add a ZFS storage pool (was using dir).
  • Removed default pool
  • Imported the backup

But I run into this issue:

stanislas@xps ~> lxc import backup.tar.gz
Error: not found 

What did I do wrong?

Thanks

1 Like

Hmm, that’s a pretty unfortunate error :slight_smile:

Can you show lxc import backup.tar.gz --debug?

Off the top of my head, my guess would be that a profile or storage pool mentioned in the backup is missing, but it may be something else entirely…

1 Like

Oh, my dir pool was named default, and this one is named zpool-lxd.

Here it is:

stanislas@xps-sla ~> lxc import backup.tar.gz --debug
DBUG[01-29|17:38:05] Connecting to a local LXD over a Unix socket 
DBUG[01-29|17:38:05] Sending request to LXD                   method=GET url=http://unix.socket/1.0 etag=
DBUG[01-29|17:38:09] Got response struct from LXD 
DBUG[01-29|17:38:09] 
        {
                "config": {},
                "api_extensions": [
                        "storage_zfs_remove_snapshots",
                        "container_host_shutdown_timeout",
                        "container_stop_priority",
                        "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",
                        "container_only_migration",
                        "storage_zfs_clone_copy",
                        "unix_device_rename",
                        "storage_lvm_use_thinpool",
                        "storage_rsync_bwlimit",
                        "network_vxlan_interface",
                        "storage_btrfs_mount_options",
                        "entity_description",
                        "image_force_refresh",
                        "storage_lvm_lv_resizing",
                        "id_map_base",
                        "file_symlinks",
                        "container_push_target",
                        "network_vlan_physical",
                        "storage_images_delete",
                        "container_edit_metadata",
                        "container_snapshot_stateful_migration",
                        "storage_driver_ceph",
                        "storage_ceph_user_name",
                        "resource_limits",
                        "storage_volatile_initial_source",
                        "storage_ceph_force_osd_reuse",
                        "storage_block_filesystem_btrfs",
                        "resources",
                        "kernel_limits",
                        "storage_api_volume_rename",
                        "macaroon_authentication",
                        "network_sriov",
                        "console",
                        "restrict_devlxd",
                        "migration_pre_copy",
                        "infiniband",
                        "maas_network",
                        "devlxd_events",
                        "proxy",
                        "network_dhcp_gateway",
                        "file_get_symlink",
                        "network_leases",
                        "unix_device_hotplug",
                        "storage_api_local_volume_handling",
                        "operation_description",
                        "clustering",
                        "event_lifecycle",
                        "storage_api_remote_volume_handling",
                        "nvidia_runtime",
                        "container_mount_propagation",
                        "container_backup",
                        "devlxd_images",
                        "container_local_cross_pool_handling",
                        "proxy_unix",
                        "proxy_udp",
                        "clustering_join",
                        "proxy_tcp_udp_multi_port_handling",
                        "network_state",
                        "proxy_unix_dac_properties",
                        "container_protection_delete",
                        "unix_priv_drop",
                        "pprof_http",
                        "proxy_haproxy_protocol",
                        "network_hwaddr",
                        "proxy_nat",
                        "network_nat_order",
                        "container_full",
                        "candid_authentication",
                        "backup_compression",
                        "candid_config",
                        "nvidia_runtime_config",
                        "storage_api_volume_snapshots",
                        "storage_unmapped",
                        "projects",
                        "candid_config_key",
                        "network_vxlan_ttl",
                        "container_incremental_copy",
                        "usb_optional_vendorid",
                        "snapshot_scheduling",
                        "container_copy_project",
                        "clustering_server_address",
                        "clustering_image_replication",
                        "container_protection_shift"
                ],
                "api_status": "stable",
                "api_version": "1.0",
                "auth": "trusted",
                "public": false,
                "auth_methods": [
                        "tls"
                ],
                "environment": {
                        "addresses": [],
                        "architectures": [
                                "x86_64",
                                "i686"
                        ],
                        "certificate": "-----BEGIN CERTIFICATE-----\nMIIFSTCCAzGgAwIBAgIQQc0tP8fxpztsr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Mtc2xhhwQK\nLggIhwQKLhIfMA0GCSqGSIb3DQEBCwUAA4ICAQBbg/CH/9YSuUKB7NZNsDMHQi0v\n4+/A8oMZ+5KIwLPmIleTyYk3YE6F8ILTw+MIcrc9X7VW8FX9gvAvolXu/l+5FUjc\nUEw8iguMFzHzOUSceiNghEIV/90I3khw9Bwuy8Cc/ycZmLMaTT2s1wgTL/Kp8Tbe\nthmdCS2/6YyqhEJiah8Klsq5YBZ46pzEoTkit5kPJpWzdsDqp6EMXcL75R96Qo2k\naGALqnpmcnNZLzr4/cbPjM36eb379wxdYx1hdNTu+5y30BCAW+bkOCDGumDDxq3K\nwm7ZOS9FzzQg/m1zFU5S+6RFXfVRdekJC8PGDCSBOWhgVvWy4hgSV+39S4kM5hHG\nT2dDcBhXzCUFN5FO/RUiMIZn3KxcbZennAmlCPIqIkRlFWGnHy4BiFnXoSpmFF32\nCGCEE9XZ/Wja+8lgtWrQM1Ki4IiVma1gW/Gk9yftTToHpY+z16MIAQUZ7TGfY/+i\nyqh19F5YDA8e2CecBvABtbpSDfviOaZrPf1yjYPuOrryhaJn7A94QMd+pjvEGX4w\nw2pfBiy1WEL3prtZsP7sVb1qDWOeqW7Lx/cWrnKLaF6fmvOb0KfOzuYgbTR4bpsp\n9H+aXsZmJk7sJcCFJwEEaPXPb3l+ZC2s6McQKGtY1D+7NhgEOXWDW6Ng2ckbdYwe\noK5IuQFWD4EElgEnXw==\n-----END CERTIFICATE-----\n",
                        "certificate_fingerprint": "d7a1d306eca0421e7614a3393db4ea8050d50b4f99b1354b39b32193929aba10",
                        "driver": "lxc",
                        "driver_version": "3.1.0",
                        "kernel": "Linux",
                        "kernel_architecture": "x86_64",
                        "kernel_version": "4.20.4-arch1-1-ARCH",
                        "server": "lxd",
                        "server_pid": 18319,
                        "server_version": "3.9",
                        "storage": "zfs",
                        "storage_version": "0.7.12-1",
                        "server_clustered": false,
                        "server_name": "xps-sla",
                        "project": "default"
                }
        }
DBUG[01-29|17:38:09] Connected to the websocket
DBUG[01-29|17:38:09] Sending request to LXD                   method=POST url=http://unix.socket/1.0/containers etag=
Importing container: 100% (866.34MB/s)DBUG[01-29|17:38:14] Got operation from LXD
DBUG[01-29|17:38:14]
        {
                "id": "884b1ac4-6913-40b6-a432-397ef198279a",
                "class": "task",
                "description": "Restoring backup",
                "created_at": "2019-01-29T17:38:14.379586205+01:00",
                "updated_at": "2019-01-29T17:38:14.379586205+01:00",
                "status": "Running",
                "status_code": 103,
                "resources": {
                        "containers": [
                                "/1.0/containers/myct"
                        ]
                },
                "metadata": null,
                "may_cancel": false,
                "err": ""
        }
DBUG[01-29|17:38:14] Sending request to LXD                   method=GET url=http://unix.socket/1.0/operations/884b1ac4-6913-40b6-a432-397ef198279a etag=
DBUG[01-29|17:38:14] Got response struct from LXD
DBUG[01-29|17:38:14]
        {
                "id": "884b1ac4-6913-40b6-a432-397ef198279a",
                "class": "task",
                "description": "Restoring backup",
                "created_at": "2019-01-29T17:38:14.379586205+01:00",
                "updated_at": "2019-01-29T17:38:14.379586205+01:00",
                "status": "Running",
                "status_code": 103,
                "resources": {
                        "containers": [
                                "/1.0/containers/myct"
                        ]
                },
                "metadata": null,
                "may_cancel": false,
                "err": ""
        }
Error: not found

Btw, this container is not important, but maybe someone will run into the same error as I did :slight_smile:

Can you go inside that tarball and get the .yaml files that are directly inside it?

That may give us a clue as to what’s causing the error.

Makes sense:

stanislas@xps-sla ~> cat index.yaml
project: ""
name: myct
backend: dir
privileged: false
pool: default

I will try importing the backup with the new pool name.

Doesn’t work:

stanislas@xps-sla ~> lxc import backup.tar.gz
Error: Internal import request: The storage pool "default" the container was detected on does not match the storage pool "zpool-lxd" specified in the backup file

Can you find the backup.yaml file in the tarball? should be under container/

Yes:

container:
  architecture: x86_64
  config:
    image.architecture: amd64
    image.description: Debian stretch amd64 (20190123_05:25)
    image.os: Debian
    image.release: stretch
    image.serial: "20190123_05:25"
    volatile.base_image: a17e9d4577503b2b553b0b85814f4b5b7b70851cb2ad921acf160ef060ac1f56
    volatile.eth0.hwaddr: 00:16:3e:0f:12:fd
    volatile.idmap.base: "0"
    volatile.idmap.next: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
    volatile.last_state.idmap: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
    volatile.last_state.power: RUNNING
  devices: {}
  ephemeral: false
  profiles:
  - default
  stateful: false
  description: ""
  created_at: 2019-01-28T15:04:58.485777318+01:00
  expanded_config:
    image.architecture: amd64
    image.description: Debian stretch amd64 (20190123_05:25)
    image.os: Debian
    image.release: stretch
    image.serial: "20190123_05:25"
    volatile.base_image: a17e9d4577503b2b553b0b85814f4b5b7b70851cb2ad921acf160ef060ac1f56
    volatile.eth0.hwaddr: 00:16:3e:0f:12:fd
    volatile.idmap.base: "0"
    volatile.idmap.next: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
    volatile.last_state.idmap: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
    volatile.last_state.power: RUNNING
  expanded_devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: lxdbr0
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: myct
  status: Stopped
  status_code: 102
  last_used_at: 2019-01-28T15:04:59.72095902+01:00
  location: none
snapshots: []
pool:
  config:
    source: /var/snap/lxd/common/lxd/storage-pools/default
  description: ""
  name: default
  driver: dir
  used_by: []
  status: Created
  locations:
  - none
volume:
  config: {}
  description: ""
  name: myct
  type: container
  used_by: []
  location: none

So, to import a backup that was made on a different storage pool:

In backup.tar.gz/index.yml, modify:

  • backend (if the pool type is different)
  • pool

In backup.tar.gz/container/backup.yml, modify:

  • pool.driver (if the pool type is different)
  • container.expanded_devices.root.pool
  • pool.config.source
  • pool.name

Thanks for your help!

2 Likes

Ok, so that’s obviously not ideal :slight_smile:

@monstermunchkin I think we’d at least want:

  • Clear error when the storage pool can’t be found during restore
  • Option to lxc import to override the storage pool, so one can do -s blah at import time
1 Like

@monstermunchkin please file a Github issue to track this, thanks!

Let’s try again with LXD 3.10:

stanislas@xps-sla ~> lxc import notthatbigct.tar.gz
Error: Create container from backup: No root device could be found
stanislas@xps-sla ~> lxc storage list
+-----------+-------------+--------+----------------------------------------------+---------+
|   NAME    | DESCRIPTION | DRIVER |                    SOURCE                    | USED BY |
+-----------+-------------+--------+----------------------------------------------+---------+
| zpool-lxd |             | zfs    | /var/snap/lxd/common/lxd/disks/zpool-lxd.img | 1       |
+-----------+-------------+--------+----------------------------------------------+---------+
stanislas@xps-sla ~> lxc import notthatbigct.tar.gz -s zpool-lxd
Error: Create container from backup: No root device could be found
stanislas@xps-sla ~> lxc import
Description:
  Import backups of containers including their snapshots.

Usage:
  lxc import [<remote>:] <backup file> [flags]

Examples:
  lxc import backup0.tar.gz
      Create a new container using backup0.tar.gz as the source.

Flags:
  -s, --storage   Storage pool name

Global Flags:
      --debug            Show all debug messages
      --force-local      Force using the local unix socket
  -h, --help             Print help
      --project string   Override the source project
  -q, --quiet            Don't show progress information
  -v, --verbose          Show all information messages
      --version          Print version number

Am I missing something?

Thanks for reporting. This is a bug in the backup code. Here’s the PR: https://github.com/lxc/lxd/pull/5506

1 Like

Great, let me know when I can can test it :slight_smile:

The issue has been fixed upstream. It will be available in LXD 3.11. Alternatively you can check out the master branch.

1 Like

I tested with the current edge snap channel and it’s working. Good job!