[SOLVED] CentOS 6 OpenVZ to LXC migration issues

jazzl0ver

Active Member
Mar 6, 2013
55
1
28
Hi all.

I'd like to share some issues I faced after migration CentOS 6 containers from OpenVZ (Proxmox VE 3.4) to LXC (Proxmox VE 4.1) using https://pve.proxmox.com/wiki/Convert_OpenVZ_to_LXC.

I had a CentOS 6 CT installed from a standard template. After migrating it to LXC there were two issues:
1. No more /dev/shm folder
2. The CT didn't react to shutdown command

To address the 1st issue one must add a line to /usr/share/lxc/config/centos.common.conf or create a file under /usr/share/lxc/config/common.conf.d on the Proxmox host. The magic line is:
Code:
lxc.mount.entry = none dev/shm tmpfs rw,nosuid,nodev,create=dir
Then make sure the CT's /etc/fstab no longer mounts /dev/shm

The 2nd issue happened due to missing files in the CT's file system which LXC requires. Here are they:
Code:
/etc/init.d/lxc-halt
/etc/rc.d/rc0.d/S00lxc-halt -> ../init.d/lxc-halt
/etc/rc.d/rc6.d/S00lxc-reboot -> ../init.d/lxc-halt
/etc/init/lxc-sysinit.conf
/etc/init/power-status-changed.conf
Also the following might be required in /etc/securetty:
Code:
# LXC (Linux Containers)
lxc/console
lxc/tty1
lxc/tty2
lxc/tty3
lxc/tty4
# For libvirt/Virtual Machine Monitor
pts/0
And don't forget to comment out /sbin/start_udev line in /etc/rc.sysinit

I was unable to quickly find those files on the net, so I put them here: https://github.com/jazzl0ver/lxc-centos
Or one can extract them from any publicly available LXC Centos templates.
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
2,949
464
103
South Tyrol/Italy
shop.maurer-it.com
Thanks for the notes, I linked this thread in the Convert OpenVZ to LXC wiki article: https://pve.proxmox.com/wiki/Convert_OpenVZ_to_LXC#CentOS_6_OpenVZ_to_LXC_migration_issues
Also this may be out of interest if your converted CentOS:
https://forum.proxmox.com/threads/l...to-converted-lxc-container.33221/#post-163326

But actually I may look if we can improve the restore code a little bit, we already have the functionality included to fix up securetty, etc. but we only call that when setting up a new container, because we do not want to modify an already configured container which a backed up one normally is.
But maybe we can execute a reduced fix up on restore.
 
  • Like
Reactions: jazzl0ver

moxfan

Active Member
Aug 28, 2013
71
4
28
I am getting these 2 errors when running your lxc-setup script in PMX6:

Code:
ln: failed to create symbolic link '/etc/rc.d/rc0.d/S00lxc-halt': No such file or directory
ln: failed to create symbolic link '/etc/rc.d/rc6.d/S00lxc-reboot': No such file or directory
Code:
root@pmx5:~# ll /etc/rc.d
total 20
drwxr-xr-x  3 root root  4096 Jul 17 17:29 .
drwxr-xr-x 98 root root 12288 Oct 28 10:01 ..
drwxr-xr-x  2 root root  4096 Jul 17 17:29 init.d
Should I create the rc0.d and rc6.d directories under rc.d or are those two 500lxc files not very important?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE and Proxmox Mail Gateway. We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!