Skip to content

Instantly share code, notes, and snippets.

@lmiphay
Last active June 11, 2023 22:38
Show Gist options
  • Save lmiphay/81d64c285a7503054dd019af1829f473 to your computer and use it in GitHub Desktop.
Save lmiphay/81d64c285a7503054dd019af1829f473 to your computer and use it in GitHub Desktop.
Cloning/copying an lxc on gentoo (lxc-copy / lxc-clone)
lxc-copy is the replacement for lxc-clone:
mkdir -p <new_lxc_path>
lxc-copy --name=<existing_lxc_name> --newname <new_lxc_name> --newpath /<new_lxc_path>
In the new container:
1. /etc/conf.d/hostname - set new hostname
2. /etc/conf.d/net - set new ip (if static ip)
3. /etc/hosts - add new ip/hostname
On the host:
1. add new ip to: /etc/hosts
2. cd /etc/init.d && ln -s lxc lxc.<new_lxc_name>
Test start with:
lxc-start --name=<new_lxc_name> --foreground --logpriority=DEBUG
Fixups:
1. Lots of errors starting the lxc like:
mkdir: cannot create directory '/sys/fs/cgroup/openrc/killprocs': Read-only file system
For a possible fix, see: https://github.com/lxc/lxc/issues/1095
lxc.mount.auto=cgroup:rw proc:mixed sys:mixed
(was: lxc.mount.auto=cgroup:mixed proc:mixed sys:mixed)
@linuxjeff
Copy link

Obrigado pela ajuda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment