Looking at the code of xen-create-image, --keep would only matter if somewhere 
along the lines FAIL was set to 1and that
"exit" was not called at the point of the error.
The failure occurs during a `umount` of a busy device.  (it's still busy cause 
`sshd` is running.)
The perl program just exits at that point which at this point is inside the 
routine,  runCommand()
at the last 2 lines:  
        $FAIL = 1;
        exit 127;

If --keep were to work, I would have had to see this line get printed:
      Removing failed install:
The installation is not programmatically being removed via the command, 
xen-delete-image.

The installation is being removed cause of this line in the beginning:
        use File::Temp qw/ tempdir /;
Meaning, once the perl program exits, and before control is given back to the 
user,
Perl automajically removes any file systems that was created with the intention 
of them
being temporary. "tempdir" represents the entire installation and it is this 
directory that is
being "correctly" cleaned up behind the scenes without any notice to the end 
user.
"Correctly" meaning, Perl is only doing what it is supposed to do.

Anyways, I just did this per your request:

Ran UpdateManager to get any updates. (none)
rebooted machine.
Shut down the `sshd` on Dom0
Unedit by hack in /usr/lib/xen-tools/karmic.d/70-install-ssh.
sudo xen-create-image --fs=ext4 --image=full --memory=1Gb --size=20Gb 
--swap=2Gb --install-method=debootstrap --arch=amd64 --dist=precise --lvm=vg1 
--hostname=xen004  --vcpus=1 --ip=192.168.0.245 --gateway=192.168.0.1 
--broadcast=192.168.0.255 --netmask=255.255.255.0 --keep --verbose

and that resulted in an empty installation under my mounted volume at
/tmp/P_4Wff0FTJ.

This was the final n lines from the xen-create-image:
...
Setting up root password
Generating a password for the new guest.
All done
Executing : umount /tmp/P_4Wff0FTJ/proc
Finished : umount /tmp/P_4Wff0FTJ/proc 2>&1
Unmounting : /tmp/P_4Wff0FTJ/dev/pts
Executing : umount /tmp/P_4Wff0FTJ/dev/pts
Finished : umount /tmp/P_4Wff0FTJ/dev/pts 2>&1
Unmounting : /tmp/P_4Wff0FTJ
Executing : umount /tmp/P_4Wff0FTJ
umount: /tmp/P_4Wff0FTJ: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
Finished : umount /tmp/P_4Wff0FTJ 2>&1
Running command 'umount /tmp/P_4Wff0FTJ 2>&1' failed with exit code 256.
Aborting
See /var/log/xen-tools/xen004.log for details
cannot remove directory for /tmp/P_4Wff0FTJ: Device or resource busy at 
/usr/share/perl/5.14/File/Temp.pm line 902
$

and then I surmise between the message of "cannot remove directory" and the 
Unix prompt,
Perl is effectively doing this:  `rm -rf /tmp/P_4Wff0FTJ`.
Actually I discovered this, cause during my 100s of installations fighting with 
this problem, I had commented
out one of the umount commands for .../proc. So when xen-create-image failed 
and got the regular messages
as in the above, I also got all these messages about how it couldn't "unlink" a 
bunch of files under /tmp/XXXXXX/proc/...
I said to myself, huh? where is that code that is doing all this removing. I 
then stumbled upon that line:
   use File::Temp qw/ tempdir /;
and looked up what that Perl Class does. And the intent is to clean up after 
the programmer all files and directories
once the program exits. 
(Having said that, not sure why "root" couldn't unlink those directories. But 
that isn't important.)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/996789

Title:
  70-install-ssh does not prevent sshd from starting up

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xen-tools/+bug/996789/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to