[Bug 531599] Re: device mappings for partitions not removed after build using --raw, leading to filesystem corruption

Louis Bouchard louis.bouchard at canonical.com
Thu Apr 12 15:38:29 UTC 2012


** Description changed:

+ SRU Request for Lucid
+ 
+ [Impact] This bug occurs systematically when the --raw option is used to
+ create a VM. This results in file system data corruption messages in the
+ VM created.
+ 
+ [Development/Stable Fix] Fixed in 0.12.4+bzr475-0ubuntu1 for precise as stated in comment #9 with the following addition :
+   [ Louis Bouchard ]
+   * Remove dev maps created by parted. (LP: #531599)
+ 
+ 
+ [Test Case] section with detailed instructions how to reproduce the bug. These should allow someone who is not familiar with the affected package to reproduce the bug and verify that the updated package fixes the problem.
+ 
+ On an unmodified system with an existging 8Gb LVM volume named
+ /dev/sysvg/testvmvol, run the following command :
+ 
+ ubuntu-vm-builder kvm natty --lang=en_US --hostname=testvm
+ --rootsize=8000 --mem=10240 --cpus=2 --rootpass=X --arch=amd64
+ --libvirt=qemu:///system --raw=/dev/sysvg/testvmvol
+ 
+ On an unmodified system, once completed, the dmsetup list command will show the following :
+ $ dmsetup ls
+ sysvg-testvmvol1p1        (252, 2)
+ sysvg-testvmvol1        (252, 1)
+ sysvg-testvmvol (252, 0)
+ 
+ The sysvg-testvmvol1p1 table should not be there
+ 
+ [Regression Potential] This fix needs to be backported to the LTS
+ version to avoid potential file system corruption.
+ 
+ ---
+ 
  I've tried to install a vm using an LVM logical volume with --raw. The
  problem was that I used a too small logical volume.
  
  vmbuilder told me:
  2010-03-03 21:33:59,923 INFO    : Adding partition table to disk image: /dev/mapper/leo01-test--disk
  2010-03-03 21:34:00,007 INFO    : Adding type 1 partition to disk image: /dev/mapper/leo01-test--disk
  2010-03-03 21:34:00,879 INFO    : Adding type 3 partition to disk image: /dev/mapper/leo01-test--disk
  2010-03-03 21:34:00,890 INFO    : [0] ../../libparted/filesys.c:147 (ped_file_system_type_get): File system alias linux-swap(new) is deprecated
  2010-03-03 21:34:00,892 INFO    : Cleaning up
  Traceback (most recent call last):
-   File "/usr/bin/vmbuilder", line 29, in <module>
-     VMBuilder.run()
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/__init__.py", line 65, in run
-     frontend.run()
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/plugins/cli/__init__.py", line 68, in run
-     vm.create()
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/vm.py", line 480, in create
-     disk.create_partitions(self)
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 416, in create_partitions
-     disk.create(vm.workdir)
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 100, in create
-     part.create(self)
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 244, in create
-     run_cmd('parted', '--script', '--', disk.filename, 'mkpart', 'primary', self.parted_fstype(), self.begin, self.end)
-   File "/usr/lib/python2.6/dist-packages/VMBuilder/util.py", line 135, in run_cmd
-     raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, stdout, stderr)
+   File "/usr/bin/vmbuilder", line 29, in <module>
+     VMBuilder.run()
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/__init__.py", line 65, in run
+     frontend.run()
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/plugins/cli/__init__.py", line 68, in run
+     vm.create()
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/vm.py", line 480, in create
+     disk.create_partitions(self)
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 416, in create_partitions
+     disk.create(vm.workdir)
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 100, in create
+     part.create(self)
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 244, in create
+     run_cmd('parted', '--script', '--', disk.filename, 'mkpart', 'primary', self.parted_fstype(), self.begin, self.end)
+   File "/usr/lib/python2.6/dist-packages/VMBuilder/util.py", line 135, in run_cmd
+     raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, stdout, stderr)
  VMBuilder.exception.VMBuilderException: Process (['parted', '--script', '--', '/dev/mapper/leo01-test--disk', 'mkpart', 'primary', 'linux-swap(new)', '9', '1032']) returned 1. stdout: Error: The location 1032 is outside of the device /dev/mapper/leo01-test--disk.
  , stderr: [0] ../../libparted/filesys.c:147 (ped_file_system_type_get): File system alias linux-swap(new) is deprecated
  
  While this is a lot of noise, telling me 'location 1032 is outside of
  the device...' made me recognize my mistake.
  
  The problem is that I wasn't able to just remove the logical volume, create a bigger one and start again:
-  sudo lvremove /dev/mapper/leo01-test--disk
-    Can't remove open logical volume "test-disk"
+  sudo lvremove /dev/mapper/leo01-test--disk
+    Can't remove open logical volume "test-disk"
  
  The reason is that there's another device map set up by vmbuilder:
  /dev/mapper/leo01-test--diskp1
  
  This is because the first (root) partition did fit on the logical
  volume, but only the second (swap) one not.
  
  I had to drop the device mapping using
-  sudo dmsetup remove /dev/mapper/leo01-test--diskp1
+  sudo dmsetup remove /dev/mapper/leo01-test--diskp1
  
  This would allow me to lvremove the logical volume now.
  
  I would expect that vmbuilder cleans up on exceptions like this and
  remove the device mappings for the inner partitions.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to vm-builder in Ubuntu.
https://bugs.launchpad.net/bugs/531599

Title:
  device mappings for partitions not removed after build using --raw,
  leading to filesystem corruption

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/531599/+subscriptions



More information about the Ubuntu-server-bugs mailing list