[SOLVED] CentOS 6 OpenVZ to LXC migration issues

jazzl0ver

Member
Mar 6, 2013
48
0
6
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
1,500
213
63
South Tyrol/Italy
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/lxc-console-fails-to-connect-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

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!