← Back to team overview

touch-packages team mailing list archive

[Bug 1410746] [NEW] Interrupted lxc-snapshot deletes snapshot *and* vm

 

Public bug reported:

lxc is configured for limited user usage, i.e. the backing store is
always "dir".  Let's create a container, and snapshot it in its pristine
state:

% lxc-create -n restorebug -t download -- -d ubuntu -r utopic -a amd64 && lxc-snapshot -n restorebug
[...]
lxc_container: lxccontainer.c: lxcapi_snapshot: 3011 Snapshot of directory-backed container requested.
lxc_container: lxccontainer.c: lxcapi_snapshot: 3012 Making a copy-clone.
[...]

% ls ~/.local/share/lxc/restorebug/rootfs ~/.local/share/lxc/restorebug/snaps/snap0/rootfs
.local/share/lxc/restorebug/rootfs:
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

.local/share/lxc/restorebug/snaps/snap0/rootfs:
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var


Everything went to plan.  Now, try restoring the snapshot, and ctrl+c'ing lxc-snapshot while it's running:

% lxc-snapshot -n restorebug -r snap0
[ctrl+c, bang!]

Depending on when you press it, you might get some rsync output, but never anything from the lxc-snapshot command itself.  This isn't unexpected, it's probably just copying the snapshot over to the vm, right?!  That sounds cancellable.  e.g.
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(632) [sender=3.1.1]
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(504) [generator=3.1.1]


Now, let's run lxc-snapshot again, no need to ctrl+c it:
% lxc-snapshot -n restorebug -r snap0                                                 
lxc_container: bdev.c: bdev_copy: 3253 failed to detect blockdev type for ...local/share/lxc/restorebug/snaps/snap0/rootfs
lxc_container: lxccontainer.c: copy_storage: 2543 Error copying storage
lxc_container: lxccontainer.c: lxcapi_destroy: 2141 Container restorebug has snapshots;  not removing
lxc_container: lxc_snapshot.c: do_restore_snapshots: 109 Error restoring snapshot snap0

% ls -a ~/.local/share/lxc/restorebug/rootfs ~/.local/share/lxc/restorebug/snaps/snap0
.local/share/lxc/restorebug/rootfs:
.  ..

.local/share/lxc/restorebug/snaps/snap0:
.  ..  config  ts


It's deleted both the snapshot, and the original container.  Further attempts to run lxc-snapshot give similar errors:

% lxc-snapshot -n restorebug -r snap0                                             
lxc_container: lxccontainer.c: lxcapi_snapshot_restore: 3217 Failed to find original backing store type
lxc_container: lxc_snapshot.c: do_restore_snapshots: 109 Error restoring snapshot snap0

Also reproduced on cleaner utopic server installs, this bug report is
from my laptop.

(We hit this on our build server: a typical job is to restore a vm, then
run some commands in it.  Jobs are cancellable, which just interrupts
any running process.)

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: lxc 1.1.0~alpha2-0ubuntu3
ProcVersionSignature: Ubuntu 3.16.0-29.39-generic 3.16.7-ckt2
Uname: Linux 3.16.0-29-generic x86_64
ApportVersion: 2.14.7-0ubuntu8
Architecture: amd64
Date: Wed Jan 14 10:11:15 2015
InstallationDate: Installed on 2014-08-01 (165 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
SourcePackage: lxc
UpgradeStatus: Upgraded to utopic on 2014-09-11 (125 days ago)
defaults.conf:
 lxc.network.type = veth
 lxc.network.link = lxcbr0
 lxc.network.flags = up
 lxc.network.hwaddr = 00:16:3e:xx:xx:xx

** Affects: lxc (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apparmor apport-bug utopic

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1410746

Title:
  Interrupted lxc-snapshot deletes snapshot *and* vm

Status in lxc package in Ubuntu:
  New

Bug description:
  lxc is configured for limited user usage, i.e. the backing store is
  always "dir".  Let's create a container, and snapshot it in its
  pristine state:

  % lxc-create -n restorebug -t download -- -d ubuntu -r utopic -a amd64 && lxc-snapshot -n restorebug
  [...]
  lxc_container: lxccontainer.c: lxcapi_snapshot: 3011 Snapshot of directory-backed container requested.
  lxc_container: lxccontainer.c: lxcapi_snapshot: 3012 Making a copy-clone.
  [...]

  % ls ~/.local/share/lxc/restorebug/rootfs ~/.local/share/lxc/restorebug/snaps/snap0/rootfs
  .local/share/lxc/restorebug/rootfs:
  bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

  .local/share/lxc/restorebug/snaps/snap0/rootfs:
  bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

  
  Everything went to plan.  Now, try restoring the snapshot, and ctrl+c'ing lxc-snapshot while it's running:

  % lxc-snapshot -n restorebug -r snap0
  [ctrl+c, bang!]

  Depending on when you press it, you might get some rsync output, but never anything from the lxc-snapshot command itself.  This isn't unexpected, it's probably just copying the snapshot over to the vm, right?!  That sounds cancellable.  e.g.
  rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(632) [sender=3.1.1]
  rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(504) [generator=3.1.1]

  
  Now, let's run lxc-snapshot again, no need to ctrl+c it:
  % lxc-snapshot -n restorebug -r snap0                                                 
  lxc_container: bdev.c: bdev_copy: 3253 failed to detect blockdev type for ...local/share/lxc/restorebug/snaps/snap0/rootfs
  lxc_container: lxccontainer.c: copy_storage: 2543 Error copying storage
  lxc_container: lxccontainer.c: lxcapi_destroy: 2141 Container restorebug has snapshots;  not removing
  lxc_container: lxc_snapshot.c: do_restore_snapshots: 109 Error restoring snapshot snap0

  % ls -a ~/.local/share/lxc/restorebug/rootfs ~/.local/share/lxc/restorebug/snaps/snap0
  .local/share/lxc/restorebug/rootfs:
  .  ..

  .local/share/lxc/restorebug/snaps/snap0:
  .  ..  config  ts

  
  It's deleted both the snapshot, and the original container.  Further attempts to run lxc-snapshot give similar errors:

  % lxc-snapshot -n restorebug -r snap0                                             
  lxc_container: lxccontainer.c: lxcapi_snapshot_restore: 3217 Failed to find original backing store type
  lxc_container: lxc_snapshot.c: do_restore_snapshots: 109 Error restoring snapshot snap0

  Also reproduced on cleaner utopic server installs, this bug report is
  from my laptop.

  (We hit this on our build server: a typical job is to restore a vm,
  then run some commands in it.  Jobs are cancellable, which just
  interrupts any running process.)

  ProblemType: Bug
  DistroRelease: Ubuntu 14.10
  Package: lxc 1.1.0~alpha2-0ubuntu3
  ProcVersionSignature: Ubuntu 3.16.0-29.39-generic 3.16.7-ckt2
  Uname: Linux 3.16.0-29-generic x86_64
  ApportVersion: 2.14.7-0ubuntu8
  Architecture: amd64
  Date: Wed Jan 14 10:11:15 2015
  InstallationDate: Installed on 2014-08-01 (165 days ago)
  InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
  SourcePackage: lxc
  UpgradeStatus: Upgraded to utopic on 2014-09-11 (125 days ago)
  defaults.conf:
   lxc.network.type = veth
   lxc.network.link = lxcbr0
   lxc.network.flags = up
   lxc.network.hwaddr = 00:16:3e:xx:xx:xx

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1410746/+subscriptions


Follow ups

References