Ubuntu karmic Appliance

tobru

Member
May 19, 2008
31
0
6
Hi,

I tried to create a Ubuntu karmic (beta!) appliance, but it fails with the following output:
Code:
initialize VE 90000
package 'initramfs-tools' depends on exclusion ' module-init-tools'
package 'initramfs-tools' depends on exclusion ' module-init-tools'
Has anyone an idea what I can do to get this working?

Thanks!

Regards,
Tobias
 
Ok, found the answer:
Added karmic to the following line in DAP.pm (line 484):
Code:
elsif($suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic')
Thanks for this great tool DAB!!
 
The above solution didn't do the job for me. Here's my patch:
Code:
--- DAB.pm.orig   2010-01-08 09:43:52.000000000 +0100
+++ /usr/share/perl5/PVE/DAB.pm 2010-01-08 07:54:06.000000000 +0100
@@ -387,6 +387,8 @@
        $config->{ostype} = "ubuntu-8.10";
     } elsif ($suite eq 'jaunty') {
        $config->{ostype} = "ubuntu-9.04";
+    } elsif ($suite eq 'karmic') {
+       $config->{ostype} = "ubuntu-9.10";
     } else {
        die "unsupported debian suite '$suite'\n";
     }
@@ -413,7 +415,7 @@
        if ($suite eq 'etch' || $suite eq 'lenny') {
            push @{$config->{source}}, "http://ftp.debian.org/debian SUITE main contrib";
            push @{$config->{source}}, "http://security.debian.org SUITE/updates main contrib";
-       } elsif ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty') {
+       } elsif ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic') {
            my $comp = "main restricted universe multiverse";
            push @{$config->{source}}, "http://archive.ubuntu.com/ubuntu SUITE $comp";
            push @{$config->{source}}, "http://archive.ubuntu.com/ubuntu SUITE-updates $comp";
@@ -481,9 +483,12 @@
        push @$excl, qw(kbd);
        push @$excl, qw(apparmor apparmor-utils ntfs-3g
                        friendly-recovery);
-    } elsif($suite eq 'intrepid' || $suite eq 'jaunty') {
+    } elsif($suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic') {
        push @$excl, qw(apparmor apparmor-utils libapparmor1 libapparmor-perl
                        libntfs-3g28 ntfs-3g friendly-recovery);
+       if($suite eq 'karmic') {
+           push @$excl, qw(ureadahead);
+       }
     } else {
        push @$excl, qw(udev module-init-tools pciutils hdparm
                        memtest86+ parted);
@@ -768,10 +773,14 @@
     my $reader;
     my $pid = open2($reader, "<&STDIN", 'vzctl', 'exec2', $veid,
                    'defenv', @cmd) || die "unable to exec command";
-
     while (defined (my $line = <$reader>)) {
        $self->logmsg ($line);
     }
+    waitpid( $pid, 0 );
+    my $rc=$? >> 8;
+    if ($rc != 0) {
+       die "@cmd exited with status $rc";
+    }
 }

 sub ve_divert_add {
@@ -1187,7 +1196,7 @@

     # test if we have all 'ubuntu-minimal' and 'ubuntu-standard' packages
     # except those explicitly excluded
-    if ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty') {
+    if ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic') {
        my $mdeps = $pkginfo->{'ubuntu-minimal'}->{depends};
        foreach my $d (split (/,/, $mdeps)) {
            if ($d =~ m/^\s*(\S+)$/) {
@@ -1250,6 +1259,10 @@
     # avoid warnings about non-existent resolv.conf
     write_file ("", "$rootdir/etc/resolv.conf", 0644);

+    if ($suite eq 'karmic') {
+       $self->run_command ("mkdir $rootdir/etc/network");
+    }
+
     $data = "auto lo\niface lo inet loopback\n";
     write_file ($data, "$rootdir/etc/network/interfaces", 0644);

@@ -1394,7 +1407,7 @@
     # disable /dev/urandom init
     $self->run_command ("install -m 0755 '$script_init_urandom' '$rootdir/etc/init.d/urandom'");

-    if ($suite eq 'etch' || $suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty') {
+    if ($suite eq 'etch' || $suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic') {
        # avoid klogd start
        $self->ve_divert_add ("/sbin/klogd");
     }
@@ -1408,7 +1421,7 @@
     $cmd .= " -i '$rootdir/etc/sysctl.conf'";
     $self->run_command ($cmd);

-    if ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty') {
+    if ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty' || $suite eq 'karmic') {
        # disable tty init (console-setup)
        my $cmd = 'sed';
        $cmd .= ' -e \'s/^\(ACTIVE_CONSOLES=.*\)/ACTIVE_CONSOLES=/\'';
@@ -1423,7 +1436,7 @@
        $filelist .= " $rootdir/etc/sysctl.d/10-network-security.conf";
        $self->run_command ("rm $filelist");
     }
-    if ($suite eq 'jaunty') {
+    if ($suite eq 'jaunty' || $suite eq 'karmic') {
        # remove sysctl setup (avoid warnings at startup)
        my $filelist = "$rootdir/etc/sysctl.d/10-console-messages.conf";
        $filelist .= " $rootdir/etc/sysctl.d/10-network-security.conf";
Also, I needed to add an extra init script to fix things on VE startup: /etc/init/openvz.conf:
Code:
# OpenVZ - Fix init sequence to have OpenVZ working with upstart
description "Fix OpenVZ"
start on startup
task
pre-start script
     mount -t proc proc /proc
     mount -t devpts devpts /dev/pts
     mount -t sysfs sys /sys
     mount -t tmpfs varrun /var/run
     mount -t tmpfs varlock /var/lock
     mkdir -p /var/run/network
     rm -f /etc/network/if-*.d/upstart
     rm -f /etc/network/if-*.d/ntpdate
     mkdir -p /etc/init.disabled
     for file in /etc/init/hwclock*.conf /etc/init/tty*.conf ; do if [ -r $file ] ; then mv $file /etc/init.disabled; fi; done
     sed -i 's/^[[:space:]]*exec mountall/#exec mountall/' /etc/init/mountall.conf
end script

script
     start networking
     start portmap
     init 2
end script
See also https://bugs.launchpad.net/openvz-kernel/+bug/436130/comments/22
 
Many thank for the patch. I tried it, but i failed - it still starts mountall and that fails. Did you delete /etc/init/mountall.conf?
 
Many thank for the patch. I tried it, but i failed - it still starts mountall and that fails. Did you delete /etc/init/mountall.conf?

Hi,

sorry - I should have mentioned that it might take two tries to get the appliance to startup successfully for the first time.

The script modifies /etc/init/mountall.conf to skip running mountall. During the first container start, /etc/init/mountall.conf might run before /etc/init/openvz.conf and thus unmodified which will cause the container startup to fail at least partly.

My appliance mostly works now, though I still have some problems connected to upstart:

  • initctl emit ... does not seem to work (blocks)
  • services that should start automatically don't start (such as networking and portmap, that's whay I had to mention them explicitly in the script section of /etc/init/openvz.conf).

Once the container is up, it seems to work fine. I'm using it as a remote desktop session over NX.
 
Once the container is up, it seems to work fine. I'm using it as a remote desktop session over NX.

That new upstart is quite incompatible with containers. I tried to modify the mountall.conf, but it seems I can't get the dependencies working (networking does not start, ...). I already saw your hacks, but that is IMO the wrong way.