Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run.py fails on XEN because of losetup failure #344

Closed
tgrabiec opened this issue Jun 16, 2014 · 2 comments · Fixed by #1330
Closed

run.py fails on XEN because of losetup failure #344

tgrabiec opened this issue Jun 16, 2014 · 2 comments · Fixed by #1330

Comments

@tgrabiec
Copy link
Member

$ sudo ./scripts/run.py -nv
/dev/loop15427: No such file or directory
Parsing config from /tmp/tmpl2OepB
libxl: error: libxl_device.c:265:libxl__device_disk_set_backend: Disk vdev=hda failed to stat: /dev/loop15427: No such file or directory
libxl: error: libxl_dm.c:1467:kill_device_model: unable to find device model pid in /local/domain/18/image/device-model-pid
libxl: error: libxl.c:1421:libxl__destroy_domid: libxl__destroy_device_model failed for 18
loop: can't delete device /dev/loop15427: No such file or directory

Looks like losetup fails:

sudo strace losetup /dev/loop123 build/release/usr.img
...
open("build/release/usr.img", O_RDWR)   = 3
open("/dev/loop123", O_RDWR)            = -1 ENOENT (No such file or directory)

It moves on with this patch:

diff --git a/scripts/run.py b/scripts/run.py
index 1a4957f..0f24845 100755
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -233,7 +233,7 @@ def start_osv_xen(options):
         "vcpus=%s" % (options.vcpus),
         "maxcpus=%s" % (options.vcpus),
         "name='osv-%d'" % (os.getpid()),
-        "disk=['/dev/loop%s,raw,hda,rw']" % os.getpid(),
+        "disk=['%s,qcow2,hda,rw']" % (options.image_file),
         "serial='pty'",
         "paused=0",
         "on_crash='preserve'"
@@ -253,7 +253,7 @@ def start_osv_xen(options):
         stty_save()

         #create a loop device backed by image file
-        subprocess.call(["losetup", "/dev/loop%s" % os.getpid(), options.image_file])
+        # subprocess.call(["losetup", "/dev/loop%s" % os.getpid(), options.image_file]
         # Launch qemu
         cmdline = ["xl", "create" ]
         if not options.detach:
@glommer
Copy link
Contributor

glommer commented Jun 16, 2014

On Mon, Jun 16, 2014 at 8:27 PM, Tomasz Grabiec notifications@github.com
wrote:

$ sudo ./scripts/run.py -nv
/dev/loop15427: No such file or directory
Parsing config from /tmp/tmpl2OepB
libxl: error: libxl_device.c:265:libxl__device_disk_set_backend: Disk vdev=hda failed to stat: /dev/loop15427: No such file or directory
libxl: error: libxl_dm.c:1467:kill_device_model: unable to find device model pid in /local/domain/18/image/device-model-pid
libxl: error: libxl.c:1421:libxl__destroy_domid: libxl__destroy_device_model failed for 18
loop: can't delete device /dev/loop15427: No such file or directory

Looks like losetup fails:

sudo strace losetup /dev/loop123 build/release/usr.img
...
open("build/release/usr.img", O_RDWR) = 3
open("/dev/loop123", O_RDWR) = -1 ENOENT (No such file or directory)

It moves on with this patch:

diff --git a/scripts/run.py b/scripts/run.py
index 1a4957f..0f24845 100755
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -233,7 +233,7 @@ def start_osv_xen(options):
"vcpus=%s" % (options.vcpus),
"maxcpus=%s" % (options.vcpus),
"name='osv-%d'" % (os.getpid()),

  •    "disk=['/dev/loop%s,raw,hda,rw']" % os.getpid(),
    
  •    "disk=['%s,qcow2,hda,rw']" % (options.image_file),
     "serial='pty'",
     "paused=0",
     "on_crash='preserve'"
    

    @@ -253,7 +253,7 @@ def start_osv_xen(options):
    stty_save()

     #create a loop device backed by image file
    
  •    subprocess.call(["losetup", "/dev/loop%s" % os.getpid(), options.image_file])
    
  •    # subprocess.call(["losetup", "/dev/loop%s" % os.getpid(), options.image_file]
     # Launch qemu
    

can't we instead check the result of the call and adjust the xen file
accordingly ?

     cmdline = ["xl", "create" ]
     if not options.detach:


Reply to this email directly or view it on GitHub
#344.

@slivne slivne added the bug label Jul 31, 2014
@slivne slivne added this to the release 0.14 milestone Sep 29, 2014
@slivne slivne modified the milestones: release 0.15, release 0.14 Oct 28, 2014
@sthgrau
Copy link

sthgrau commented Apr 5, 2016

I ran into a similar losetup issue. I ended up having to compile a new version of losetup. The version I had (for LinuxMint 17) was 2.20.1-5.1ubuntu20.7. I compiled 2.27 (from ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.27/util-linux-2.27.tar.gz) and got past this problem.

@wkozaczuk wkozaczuk added the xen label Jun 30, 2021
wkozaczuk added a commit to wkozaczuk/osv that referenced this issue Aug 14, 2024
This patch eliminates use of losetup in run.py when running OSv
on Xen. Instead of creating a loop device pointing to qcow2 or
raw image, run.py adds an entry to the xl config file pointing
directly to the OSv disk image like so:

disk=['/home/wkozaczuk/projects/osv/build/last/usr.img,qcow2,hda,rw']

or:

disk=['/home/wkozaczuk/projects/osv/build/last/usr.raw,raw,hda,rw']

In addition, we also enhance run.py to support 2nd disk when running
OSv on Xen. Finally, when executing run.py with '--dry-run', one can
see content of the xl config file which can be useful for
troubleshouting or manually running OSv using the xl utility.

Examples to run OSv on Xen:

./scripts/run.py -p xen #uses default qcow2 image build/last/usr.img

./scripts/run.py -nv -c 1 -p xen --script vif-bridge -b virbr0

./scripts/run.py -p xen --second-disk-image ./disk.raw

Fixes cloudius-systems#285
Fixes cloudius-systems#344

Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants