1 Reply Latest reply on Sep 7, 2010 5:23 AM by Marek Goldmann

    Error during ec2 image creating running losetup

    Scott Stark Master

      A boxgrinder build failed with:

       

      I, [2010-09-03T11:59:18.965288 #21804]  INFO -- : Converting hostmanager appliance image to EC2 format...
      E, [2010-09-03T11:59:21.386644 #21804] ERROR -- : /usr/lib/ruby/gems/1.8/gems/boxgrinder-core-0.0.22/lib/boxgrinder-core/helpers/exec-helper.rb:62:in `execute'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-ec2-platform-plugin-0.0.3/lib/boxgrinder-build-ec2-platform-plugin/ec2-plugin.rb:160:in `calculate_disk_offsets'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-ec2-platform-plugin-0.0.3/lib/boxgrinder-build-ec2-platform-plugin/ec2-plugin.rb:168:in `mount_image'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-ec2-platform-plugin-0.0.3/lib/boxgrinder-build-ec2-platform-plugin/ec2-plugin.rb:93:in `execute'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.5.1/lib/boxgrinder-build/plugins/base-plugin.rb:90:in `run'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.5.1/lib/boxgrinder-build/appliance.rb:92:in `execute_platform_plugin'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.5.1/lib/boxgrinder-build/appliance.rb:56:in `create'
      /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.5.1/bin/boxgrinder-build:88
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:385:in `run_active_command'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:62:in `run!'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
      /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/import.rb:10
      /usr/bin/boxgrinder-build:19
      E, [2010-09-03T11:59:21.386785 #21804] ERROR -- : An error occurred while executing command: 'losetup -d /dev/loop1', process exited with wrong exit status: 1
      error: Error while mounting image. See logs for more info. Use --trace to view backtrace

       

      The boxgrinder.log adds:

      D, [2010-09-03T11:59:21.375861 #21804] DEBUG -- : Executing command: 'losetup -d /dev/loop1'
      D, [2010-09-03T11:59:21.386313 #21804] DEBUG -- : loop: can't delete device /dev/loop1: Device or resource busy

       

      There are multiple loop devices defined, including loop1:

      [starksm@fedora13 noarch]$ sudo losetup -a
      /dev/loop0: [fd00]:798851 (/home/starksm/Dev/BoxGrinder/build/appliances/i386/fedora/13/h*)
      /dev/loop1: [fd00]:798855 (/home/starksm/Dev/BoxGrinder/build/appliances/i386/fedora/13/h*)

       

      I simply tried rerunning figuring there was some problem with detecting the devices that were defined, and the build did in fact succeed. Perhaps there is a race condition somewhere between reading existing devices and creating a new one?

       

      What clears these up after the build?

        • 1. Re: Error during ec2 image creating running losetup
          Marek Goldmann Master

          Hi Scott,

           

          This is because appliance-creator bug. The problem exists when a build fails (or is interrupted in some other way: CTRL+C). appliance-creator is not cleaning the loop devices.

           

          You can try to unmount loop devices by hand: losetup -d /dev/loop1, but before that you need umount any mounted filesystem located on this loop device. But it'll not always work.

           

          You can also try to increase loop device count.

           

          --Marek