Migrate from PPA to Snap


#1

How do i migrate from PPA to Snap? PPA will deprecate at the end of 2017.

Remove old packages? Which packages should i remove?

After that only do snap install lxd && lxd.migrate ?

Thanks for help.


Is the Snap the recommended way to install LXD in Ubuntu 18.04?
(Stéphane Graber) #2

Just running "snap install lxd" and then "lxd.migrate" will move all your data and then remove the old packages from your system.

The alternative option is to use the deb package from the backports pocket which would save you from having to do any data migration at this point.


#3

Thanks. So lxcfs and lxc-common will be supported in ppa? It wasn't removed from migration script.


#4

Hey, i get an error after migrating with mac_filtering:

error: Failed to run: ebtables -A FORWARD -s ! 00:16:3e:00:e7:b4 -i veth43e3daa9 -o lxdbr0 -j DROP: ebtables: error while loading shared libraries: libebt_802_3.so: cannot open shared object file: No such file or directory

I tried the command on console and there was no problem.


(Stéphane Graber) #5

Correct, lxc and lxcfs will stay in the PPA, though note that once you're using the LXD snap you're unlikely to need those as the snap includes its own copy of those.


(Stéphane Graber) #6

Reprodced the ebtables issue here, I suspect it's a missing file in the snap, I'll fix it now, there should be a snap update in the next 2 hours with a fix.


(Stéphane Graber) #7

The fix for this is now in the stable channel.

Run:

snap refresh lxd

To refresh it to the latest revision.


#8

Thanks, the fix does work.


(IT Crowdsource) #9

I tried to migrate from PPA to the LXD snap install with the following command: snap install lxd && lxd.migrate
but I'm getting an error "lxd.migrate: command not found"

It seems that lxd.migrate isn't available. I did notice a lxd.migrate file in the folder /snap/bin but it looks like a stub file? Does anyone know what's wrong?

drwxr-xr-x 2 root root 4.0K Nov 23 18:41 .
lrwxrwxrwx 1 root root 7 Nov 23 18:41 lxc -> lxd.lxc
lrwxrwxrwx 1 root root 13 Nov 23 18:41 lxd -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Nov 23 18:41 lxd.benchmark -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Nov 23 18:41 lxd.check-kernel -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Nov 23 18:41 lxd.lxc -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Nov 23 18:41 lxd.migrate -> /usr/bin/snap
drwxr-xr-x 6 root root 4.0K Nov 23 18:41 ..
lrwxrwxrwx 1 root root 13 Oct 6 06:52 canonical-livepatch -> /usr/bin/snap


(Stéphane Graber) #10

Try to logout and log back in, chances are that it's just that your shell is missing /snap/bin in its PATH.


(IT Crowdsource) #11

You're correct after adding PATH=$PATH:/snap/bin to ~/.bashrc it started working!


(Jan Vokas) #12

Hi, after migrating to snap version of lxd, there are issues with migrate:
1) remotes are not migrated - maybe by design and certificate issues?
2) live migration not working due to missing criu (not working for me either in pre snap, just want to try snap version):
lxc move test-1234 compute-ssd01:
error: Unable to perform container live migration. CRIU isn't installed on the source server.

I have criu installed on system - looks like missing in snap package.


(IT Crowdsource) #13

Well my migration didn't go well either. After running the migration command I lost all my machines...(lxc list shows no machines) I was using ZFS as a storage backend, but it looks like the migration failed to move the ZFS to the newly installed LXD version.

I noticed these errors:
error: Unable to connect to the source LXD: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

The migration process will shut down all your containers then move your data to the destination LXD.
Once the data is moved, the destination LXD will start and apply any needed updates.
And finally your containers will be brought back to their previous state, completing the migration.

Are you ready to proceed (yes/no) [default=no]? yes
=> Shutting down the source LXD
=> Stopping the source LXD units
=> Stopping the destination LXD unit
=> Unmounting source LXD paths
=> Unmounting destination LXD paths
=> Wiping destination LXD clean
=> Moving the data
=> Moving the database
=> Backing up the database
=> Opening the database
=> Updating the storage backends
error: Failed to update the storage pools: Failed to run: zfs list -H -t all -o name,mountpoint -r : cannot open '': invalid dataset name


(Stéphane Graber) #14

Snap packages indeed store their configuration in a different location. You should be able to move your ~/.config/lxc directory into ~/snap/lxd/.config which should do the trick.


(Stéphane Graber) #15

CRIU is currently disabled in the snap package as it wasn't working at all. I believe some of the main blockers have now been resolved so we may try to re-introduce it over the next couple of weeks.


(Stéphane Graber) #16

Can you check what (if anything) is in /var/lib/lxd and what made it to /var/snap/lxd/common/lxd?

It looks like the migration process failed due to an odd database entry for your storage pool. We should be able to manually fix this once we know more.

Assuming you have a /var/snap/lxd/common/lxd/lxd.db file, can you install the sqlite3 package and post the output of:

sqlite3 /var/snap/lxd/common/lxd/lxd.db "SELECT * FROM storage_pools;"
sqlite3 /var/snap/lxd/common/lxd/lxd.db "SELECT * FROM storage_pools_config;"

(IT Crowdsource) #17

I tried the remount ZFS to the newly created LXD instance. After the mount the ZFS volume was entirely destroyed. I had create a new ZFS volume and restore the systems onto it.
I just tried to upgrade a second server which produces the same problem. As suggested I ran the commands on this second system:

sqlite3 /var/snap/lxd/common/lxd/lxd.db "SELECT * FROM storage_pool s;"
1|lxd|zfs|

sqlite3 /var/snap/lxd/common/lxd/lxd.db "SELECT * FROM storage_pools_config;"
3|1|size|427349245952
4|1|source|/var/snap/lxd/common/lxd/disks/lxd.img


(IT Crowdsource) #18

After restarting the LXD services I ran the lxd.migrate command again. The migration seems to be succesful now. Although I don't understand the "the source is empty message"

lxd.migrate
=> Connecting to source server
=> Connecting to destination server
=> Running sanity checks
The source server is empty, no migration needed.

The migration is now complete and your containers should be back online.
Do you want to uninstall the old LXD (yes/no) [default=no]? yes

All done. You may need to close your current shell and open a new one to have the "lxc" command work.


(Mike Gaboury) #19

I had what appeared to be apparmor issues after migrating to the snap package. 'lxc list' would give a permission denied error accessing $HOME/snap/lxd/5061.

Out of frustration I've given up on this dabble with Snappy and installed the backport package. I assume there is no migration help and I'll need to manually configure things. Any advice on that?


(Idef1x) #20

Just installed the snap LXD package and all seems fine, but where is the LXD configuration stored? I'd like to or be able to back it up and/or move it onto my zfs pool. I am running the LXD host from an USB stick :wink: