What is the correct procedure to move a Linux container to a new host? Here is what I have done without success:

  1. Compress directory containing linux container: sudo tar -cjf sample_container.tar.bz2 <path-to-container>/sample_container
  2. Copy the compressed tar file to new host (via scp, rsync etc.)
  3. On new host, uncompress tar file: sudo -jxvf sample_container.tar.bz2
  4. Update sample_container/config with path to new rootfs (i.e path on new host)

Following the steps above does not seem to work. What am I doing wrong?

Update: Here is the log output I get when I try to run the container:

lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:mount_rootfs:807 - Permission denied - failed to get real path for '/home/newhost/dir1/dir2/lxc/mycontainer_trusty_lxc/rootfs'
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:setup_rootfs:1221 - failed to mount rootfs
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:do_rootfs_setup:3631 - failed to setup rootfs for 'mycontainer_trusty_lxc'
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:lxc_setup:3713 - Error setting up rootfs mount after spawn
lxc-start 20161111164704.185 ERROR    lxc_start - start.c:do_start:834 - failed to setup the container
lxc-start 20161111164704.185 ERROR    lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 3)
lxc-start 20161111164704.185 ERROR    lxc_start - start.c:__lxc_start:1354 - failed to spawn 'mycontainer_trusty_lxc'
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:344 - The container failed to start.
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:346 - To get more details, run the container in foreground mode.
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:348 - Additional information can be obtained by setting the --logfile and --logpriority options.
  • 1
    What is the error message? – Ipor Sircer Nov 15 '16 at 2:55
  • @IporSircer added the log file generated by --logfile give to lxc-start. Please let me know if there is another error message I can obtain. – Ilhaan Rasheed Nov 16 '16 at 3:04
  • 1st line is a permission denied. try to correct the path and/or permissions on that. – Ipor Sircer Nov 16 '16 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.