[pve-devel] [Patch] Proxmox 4.0 CentOS 5 and 6 Containers not starting (CentOS 5 implementation)

Andreas Brodowski andreas at brodowski.org
Sun Oct 18 18:12:19 CEST 2015


Hi Dietmar,

 
after last update - right, the startup regex is fixed already...

 
please find below patch to enable CentOS 5:

--- Redhat.pm.bak       2015-10-16 08:28:04.000000000 +0200

+++ Redhat.pm   2015-10-18 17:20:46.000000000 +0200

@@ -19,7 +19,7 @@

     my $version;

 
     if ($release =~ m/release\s+(\d+\.\d+)(\.\d+)?/) {

-       if ($1 >= 6 && $1 < 8) {

+       if ($1 >= 5 && $1 < 8) {

            $version = $1;

        }

     }

@@ -82,39 +82,45 @@

     my ($self, $conf) = @_;

 
     if ($self->{version} < 7) {

-       # re-create emissing files for tty

+       if ($self->{version} == 6) {

+               # re-create emissing files for tty

 
-       $self->ct_mkpath('/etc/init');

+               $self->ct_mkpath('/etc/init');

 
-       my $filename = "/etc/init/tty.conf";

-       $self->ct_file_set_contents($filename, $tty_conf)

-           if ! $self->ct_file_exists($filename);

-

-       $filename = "/etc/init/start-ttys.conf";

-       $self->ct_file_set_contents($filename, $start_ttys_conf)

-           if ! $self->ct_file_exists($filename);

-

-       $filename = "/etc/init/power-status-changed.conf";

-       $self->ct_file_set_contents($filename, $power_status_changed_conf)

-           if ! $self->ct_file_exists($filename);

-

-       # do not start udevd

-       $filename = "/etc/rc.d/rc.sysinit";

-       my $data = $self->ct_file_get_contents($filename);

-       $data =~ s!^(/sbin/start_udev.*)$!#$1!gm;

-       $self->ct_file_set_contents($filename, $data);

-

-       # edit /etc/securetty (enable login on console)

-       $self->setup_securetty($conf, qw(lxc/console lxc/tty1 lxc/tty2 lxc/tty3 lxc/tty4));

+               my $filename = "/etc/init/tty.conf";

+               $self->ct_file_set_contents($filename, $tty_conf)

+                   if ! $self->ct_file_exists($filename);

+

+               $filename = "/etc/init/start-ttys.conf";

+               $self->ct_file_set_contents($filename, $start_ttys_conf)

+                   if ! $self->ct_file_exists($filename);

+

+               $filename = "/etc/init/power-status-changed.conf";

+               $self->ct_file_set_contents($filename, $power_status_changed_conf)

+                   if ! $self->ct_file_exists($filename);

+

+               # do not start udevd

+               $filename = "/etc/rc.d/rc.sysinit";

+               my $data = $self->ct_file_get_contents($filename);

+               $data =~ s!^(/sbin/start_udev.*)$!#$1!gm;

+               $self->ct_file_set_contents($filename, $data);

+

+               # edit /etc/securetty (enable login on console)

+               $self->setup_securetty($conf, qw(lxc/console lxc/tty1 lxc/tty2 lxc/tty3 lxc/tty4));

+       } elsif ($self->{version} == 5) {

+       }

     }

 }

 
 sub setup_init {

     my ($self, $conf) = @_;

 
-     # edit/etc/securetty

+    if ($self->{version} == 5) {

+    } else {

+       # edit/etc/securetty

 
-    $self->setup_systemd_console($conf);

+       $self->setup_systemd_console($conf);

+    }

 }

 
 sub set_hostname {

 
 
More changes are not necessary. Template seems to run without problems. Template created using following commands (for those not having yum installed in debian please run “apt-get install yum”):

 
/usr/share/lxc/templates/lxc-centos -n CentOS_5_template -R 5 -p /var/lib/lxc/centos5

cd /var/lib/lxc/centos5/rootfs

tar -czf /var/lib/vz/template/cache/centos-5-default_20151018_amd64.tar.xz *

 
Start of CentOS 5 went smoothly without any visible error. “pct enter” works on console, Console Button in Interface is working, too. Network is working.  

 
If you find any issue please drop me a line and I will have a look into it.

 
Best regards

 
Andreas

 
-----Ursprüngliche Nachricht-----
Von: Dietmar Maurer [mailto:dietmar at proxmox.com] 
Gesendet: Samstag, 17. Oktober 2015 14:41
An: PVE development discussion; Andreas Brodowski
Betreff: Re: [pve-devel] [Patch] Proxmox 4.0 CentOS 5 and 6 Containers not starting

 
> This small little patch for file /usr/share/perl5/PVE/LXC/Setup/Redhat.pm

> should enable CentOS 6 Containers to start and to allow CentOS 5 (provided

> that you've adapted the container for LXC means that you've updated the /dev

> devices, fstab, halt/reboot scripts and sysinit!) to start, too.

 
Thanks, but CentOS5 require much more work, because all scripts for newer

version does not work.

The regex for centos6 is already fixed.

 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20151018/a29adc7c/attachment.htm>


More information about the pve-devel mailing list