LXC Copy of container with profile different on host and remote fail with Socket Error

Hi,
I try to sync container between 2 hosts.
Profile are differents between source and destination, so I use the -p flag but it fail:

# /snap/bin/lxc copy local:redmine remote:bck-redmine --refresh --mode=push -p default
Error: Failed instance migration: Failed reading migration index header: websocket: close 1006 (abnormal closure): unexpected EOF

lxd monitor display this error on remote:


location: none
metadata:
  context:
    class: websocket
    description: Creating instance
    err: 'Error transferring instance data: Profile not found'
    operation: 7c619393-ee9d-4e65-96e5-4f03947c118e
    project: default
  level: debug
  message: Failure for operation
timestamp: "2022-12-07T11:54:32.61458309+01:00"
type: logging


location: none
metadata:
  class: websocket
  created_at: "2022-12-07T11:54:32.378287067+01:00"
  description: Creating instance
  err: 'Error transferring instance data: Profile not found'
  id: 7c619393-ee9d-4e65-96e5-4f03947c118e
  location: none
  may_cancel: false
  metadata:
    control: d5876ca2a261aa332f6d21640828d62cdde01b822de519473d08d09a6036b0ca
    fs: 64c87cc151aba4249a2f6cb366fd8e0b2fab5b7df307e5c44a7b65fa64fc9ad1
  resources:
    containers:
    - /1.0/containers/bck-redmine
    instances:
    - /1.0/instances/bck-redmine
  status: Failure
  status_code: 400
  updated_at: "2022-12-07T11:54:32.378287067+01:00"
project: default
timestamp: "2022-12-07T11:54:32.614696903+01:00"
type: operation

Strange thing, it fail on 1 host only, I had a second server with the same specific profile (lanprofile) and it success :thinking:

Note:

  • I had to upgrade local LXD from 4.x to 5.8 just before because lxc copy hang (cf my previous question)
  • my backup script was not bullet proof so multiple execution occured in parralell (now corrected)
  • bck-redmine is not visible on remote (try to check in lxd database but don’t find how)

Thanks for your time

So both hosts run lxd 5.8?

Thanks

Yes:

Client version: 5.8
Server version: 5.8

On both server

I just made another test, if I create another container on the same source server with default profile (lxc init test) instead of my custom profile (lanprofile) I can successfully copy it to my remote (/snap/bin/lxc copy local:test remote:bck-test --refresh --mode=push -p default)

The problem seem to be that my -p default flag is not recognised ?

I created on destination a copy of default profile named like the used source profile and it works.
The problem is clearly in -p flag

Thanks, I’ve assigned this to myself and its on my list to look at.

Thanks for the detail.

1 Like

So I tried to reproduce this (unsuccessfully) using LXD 5.9:

Host A:

lxc profile create foo
lxc profile show default | lxc profile edit foo
lxc profile list
+---------+---------------------+---------+
|  NAME   |     DESCRIPTION     | USED BY |
+---------+---------------------+---------+
| default | Default LXD profile | 2       |
+---------+---------------------+---------+
| foo     | Default LXD profile | 1       |
+---------+---------------------+---------+

lxc init images:alpine/3.17 c1 -p foo
lxc config show c1
architecture: x86_64
config:
  image.architecture: amd64
  image.description: Alpine 3.17 amd64 (20221213_13:01)
  image.os: Alpine
  image.release: "3.17"
  image.requirements.secureboot: "false"
  image.serial: "20221213_13:01"
  image.type: squashfs
  image.variant: default
  volatile.apply_template: create
  volatile.base_image: fb6a90c9a45b42c74dbbf2c27551a02a63ecd920016609aaa2758079479b0c0d
  volatile.cloud-init.instance-id: bb76df35-0675-4563-b4a9-3764cd2667b1
  volatile.eth0.hwaddr: 00:16:3e:94:a3:73
  volatile.eth0.name: eth0
  volatile.idmap.base: "0"
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.last_state.idmap: '[]'
  volatile.uuid: 0c2d28db-519d-436d-8c79-4c6530a06774
devices: {}
ephemeral: false
profiles:
- foo
stateful: false
description: ""

Host B:

lxc profile list
+---------+---------------------+---------+
|  NAME   |     DESCRIPTION     | USED BY |
+---------+---------------------+---------+
| default | Default LXD profile | 4       |
+---------+---------------------+---------+

Host A:

lxc copy c1 hostb: --mode=push --refresh
Error: Requested profile "foo" doesn't exist

lxc copy c1 hostb: --mode=push --refresh -p default
lxc copy c1 hostb: --mode=push --refresh -p default

Host B:

lxc config show c1
architecture: x86_64
config:
  image.architecture: amd64
  image.description: Alpine 3.17 amd64 (20221213_13:01)
  image.os: Alpine
  image.release: "3.17"
  image.requirements.secureboot: "false"
  image.serial: "20221213_13:01"
  image.type: squashfs
  image.variant: default
  volatile.apply_template: create
  volatile.base_image: fb6a90c9a45b42c74dbbf2c27551a02a63ecd920016609aaa2758079479b0c0d
  volatile.cloud-init.instance-id: bb76df35-0675-4563-b4a9-3764cd2667b1
  volatile.eth0.hwaddr: 00:16:3e:94:a3:73
  volatile.eth0.name: eth0
  volatile.idmap.base: "0"
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.last_state.idmap: '[]'
  volatile.uuid: 0c2d28db-519d-436d-8c79-4c6530a06774
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""

All seems to be working as expected.

Is your lxc client command also 5.8?
Does using LXD 5.9 fix it?

Are you also using different projects?

Thanks for your time, I’me not surprised because as I said, on another server with the same profile it’s works fine :confused:
For now, the copy of my default profile on destination with the same name of source profile make the job.
Still don’t updated my servers to 5.9 so I can’t tell you.

I don’t understand your last question (projects ?)

I wondered if your instances were in different LXD projects?