Lxd-to-incus migration failed in Manjaro: Failed getting target server info

Hi all,
I was trying to run lxd-to-incus tool (running lxd on Manjaro, btrfs) and it failed:

$ sudo lxd-to-incus --ignore-version-check
=> Looking for source server
==> Detected: manual installation
=> Looking for target server
==> Detected: systemd
=> Connecting to source server
=> Connecting to the target server
=> Checking server versions
Error: Failed getting target server info: Get "http://unix.socket/1.0": EOF

Is there any way to fix it?

My kind regards!

Some diagnostic commands:

$ sudo incus --version
6.7
$ sudo lxd --version
6.2
$ sudo systemctl status incus
â—Ź incus.service - Incus Container Hypervisor
     Loaded: loaded (/usr/lib/systemd/system/incus.service; enabled; preset: disabled)
     Active: activating (start-post) (Result: exit-code) since Fri 2025-01-17 11:13:28 MSK; 7min ago
 Invocation: db46ce7cfd5e4193a864817e5b228b9b
TriggeredBy: â—Ź incus.socket
       Docs: man:incusd(1)
    Process: 14989 ExecStart=/usr/bin/incusd --group=incus-admin --logfile=/var/log/incus/incusd.log (code=exited, status=1/FAILURE)
   Main PID: 14989 (code=exited, status=1/FAILURE); Control PID: 14990 (incusd)
      Tasks: 8
     Memory: 121.3M (peak: 248.7M)
        CPU: 1.374s
     CGroup: /system.slice/incus.service
             └─.control
               └─14990 /usr/bin/incusd waitready --timeout=600

jan 17 11:13:28 kirill-ug systemd[1]: incus.service: Scheduled restart job, restart counter is at 14.
jan 17 11:13:28 kirill-ug systemd[1]: Starting Incus Container Hypervisor...
jan 17 11:13:28 kirill-ug incusd[14989]: time="2025-01-17T11:13:28+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
jan 17 11:13:28 kirill-ug incusd[14989]: time="2025-01-17T11:13:28+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
jan 17 11:13:30 kirill-ug incusd[14989]: time="2025-01-17T11:13:30+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute quer>
jan 17 11:13:30 kirill-ug incusd[14989]: Error: Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_insta>
jan 17 11:13:30 kirill-ug systemd[1]: incus.service: Main process exited, code=exited, status=1/FAILURE

Some logs:

# cat /var/log/incus/incusd.log
time="2025-01-17T10:33:26+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
time="2025-01-17T10:33:26+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time="2025-01-17T10:33:28+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_instance_snaphot_delete"
time="2025-01-17T10:43:27+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
time="2025-01-17T10:43:27+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time="2025-01-17T10:43:28+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_instance_snaphot_delete"
time="2025-01-17T10:53:27+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
time="2025-01-17T10:53:27+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time="2025-01-17T10:53:29+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_instance_snaphot_delete"
time="2025-01-17T11:03:28+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
time="2025-01-17T11:03:28+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time="2025-01-17T11:03:29+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_instance_snaphot_delete"
time="2025-01-17T11:13:28+03:00" level=warning msg="AppArmor support has been disabled because of lack of kernel support"
time="2025-01-17T11:13:28+03:00" level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time="2025-01-17T11:13:30+03:00" level=error msg="Failed to start the daemon" err="Failed to initialize global database: failed to ensure schema: failed to execute queries from /var/lib/incus/database/patch.global.sql: no such trigger: on_instance_snaphot_delete"
# cat /var/log/lxd-to-incus.330932.log
Source server: manual installation
Target server: systemd
Source server paths: &{daemon:/var/lib/lxd logs:/var/log/lxd cache:/var/cache/lxd}
Target server paths: &{daemon:/var/lib/incus logs:/var/log/incus cache:/var/cache/incus}
Rewrite SQL statements:
 - UPDATE profiles SET description='Default Incus profile' WHERE description='Default LXD profile';
 - UPDATE projects SET description='Default Incus project' WHERE description='Default LXD project';
 - DELETE FROM storage_volumes_config WHERE key='volatile.uuid';
 - DELETE FROM storage_volumes_snapshots_config WHERE key='volatile.uuid';
 - CREATE TABLE certificates (
    id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    fingerprint TEXT NOT NULL,
    type INTEGER NOT NULL,
    name TEXT NOT NULL,
    certificate TEXT NOT NULL,
    restricted INTEGER NOT NULL DEFAULT 0,
    UNIQUE (fingerprint)
);
CREATE TABLE "certificates_projects" (
    certificate_id INTEGER NOT NULL,
    project_id INTEGER NOT NULL,
    FOREIGN KEY (certificate_id) REFERENCES certificates (id) ON DELETE CASCADE,
    FOREIGN KEY (project_id) REFERENCES "projects" (id) ON DELETE CASCADE,
    UNIQUE (certificate_id, project_id)
);
 - DELETE FROM schema WHERE version < 73;
UPDATE schema SET version=69 WHERE version=73;
 - INSERT INTO certificates (id, fingerprint, type, name, certificate, restricted) SELECT id, identifier, 1, name, json_extract(metadata, "$.cert"), 1 FROM identities WHERE type=1;
INSERT INTO certificates (id, fingerprint, type, name, certificate, restricted) SELECT id, identifier, 1, name, json_extract(metadata, "$.cert"), 0 FROM identities WHERE type=2;
INSERT INTO certificates (id, fingerprint, type, name, certificate, restricted) SELECT id, identifier, 2, name, json_extract(metadata, "$.cert"), 0 FROM identities WHERE type=3;
INSERT INTO certificates (id, fingerprint, type, name, certificate, restricted) SELECT id, identifier, 3, name, json_extract(metadata, "$.cert"), 1 FROM identities WHERE type=4;
INSERT INTO certificates (id, fingerprint, type, name, certificate, restricted) SELECT id, identifier, 3, name, json_extract(metadata, "$.cert"), 0 FROM identities WHERE type=6;
INSERT INTO certificates_projects (certificate_id, project_id) SELECT identity_id, project_id FROM identities_projects;
 - DROP TRIGGER on_auth_group_delete;
DROP TRIGGER on_cluster_group_delete;
DROP TRIGGER on_identity_delete;
DROP TRIGGER on_identity_provider_group_delete;
DROP TRIGGER on_image_alias_delete;
DROP TRIGGER on_image_delete;
DROP TRIGGER on_instance_backup_delete;
DROP TRIGGER on_instance_delete;
DROP TRIGGER on_instance_snaphot_delete;
DROP TRIGGER on_network_acl_delete;
DROP TRIGGER on_network_delete;
DROP TRIGGER on_network_zone_delete;
DROP TRIGGER on_node_delete;
DROP TRIGGER on_operation_delete;
DROP TRIGGER on_profile_delete;
DROP TRIGGER on_project_delete;
DROP TRIGGER on_storage_bucket_delete;
DROP TRIGGER on_storage_pool_delete;
DROP TRIGGER on_storage_volume_backup_delete;
DROP TRIGGER on_storage_volume_delete;
DROP TRIGGER on_storage_volume_snapshot_delete;
DROP TRIGGER on_warning_delete;
DROP TABLE identities_projects;
DROP TABLE auth_groups_permissions;
DROP TABLE auth_groups_identity_provider_groups;
DROP TABLE identities_auth_groups;
DROP TABLE identity_provider_groups;
DROP TABLE identities;
DROP TABLE auth_groups;
Rewrite commands:
Migration started
Stopping the source server
Stopping the target server
Unmounting "/var/lib/incus/devlxd"
Unmounting "/var/lib/incus/shmounts"
Wiping the target server
Migrating the data
Moving data over
Migrating database files
Writing the database patch
Cleaning up target paths
Cleaning up path "/var/lib/incus/backups"
Cleaning up path "/var/lib/incus/images"
Cleaning up path "/var/lib/incus/devices"
Cleaning up path "/var/lib/incus/devlxd"
Cleaning up path "/var/lib/incus/security"
Cleaning up path "/var/lib/incus/shmounts"
Rewrite symlinks:
 - "/var/lib/incus/storage-pools/lxd-pool/containers/eternal-liger" to "/var/lib/incus/containers/eternal-liger"
 - "/var/lib/incus/storage-pools/lxd-pool/containers/normal-ewe" to "/var/lib/incus/containers/normal-ewe"
 - "/var/lib/incus/storage-pools/lxd-pool/containers/wg" to "/var/lib/incus/containers/wg"
Rewrite symlinks:
 - "/var/lib/incus/storage-pools/lxd-pool/containers-snapshots/eternal-liger" to "/var/lib/incus/snapshots/eternal-liger"
 - "/var/lib/incus/storage-pools/lxd-pool/containers-snapshots/normal-ewe" to "/var/lib/incus/snapshots/normal-ewe"
Rewrite symlinks:
Rewrite symlinks:
Starting the target server
ERROR: Failed to run: systemctl start incus.service incus.socket: exit status 1 (Job for incus.service failed because the control process exited with error code.
See "systemctl status incus.service" and "journalctl -xeu incus.service" for details.)

Something was transferred:

# ls /var/lib/incus/containers
eternal-liger  normal-ewe  wg
# ls /var/lib/lxd/containers/
# 

You moved from an unsupported LXD release which apparently has had some database changes that are incompatible with the migration process…

Because of the change of license since LXD 5.21, we can’t legally go look at their source code to make the tool function with newer releases.

Given it’s failing on deleting a trigger, you could go and edit /var/lib/incus/database/patch.global.sql and change all “DROP TABLE” to “DROP TABLE IF EXISTS” and all “DROP TRIGGER” to “DROP TRIGGER IF EXISTS” which should get the database patch to clear.

Obviously that doesn’t guarantee that things will work properly afterwards as there very well may be a number of other incompatible database changes made in LXD since 5.21 which will come to bite you down the line…

1 Like

Thanks for your help, Stéphane!
Completely removed lxd and installed incus. Containers restored from backup. Everything works great!

1 Like