Skip to content

OpenNebula: Cannot parse image SIZE … (Permission denied)

Virtualizationtested on OpenNebula 7.4.1, Packer 1.16.3

A freshly built qcow2 image from Packer sits in your own home directory. If you register it straight from there, OpenNebula fails while reading the size – with a permission error, not a format error.

Symptom

oneimage create -d default --name notes-packer --type OS --format qcow2 \
  --path ~/one-lab/tag16/ausgabe/notes-basis.qcow2
[one.image.allocate] Cannot parse image SIZE: cannot access '/home/ubuntu/one-lab/tag16/ausgabe/notes-basis.qcow2' (Permission denied)

In the course Packer has just built the image in ausgabe/ (output).

Diagnosis

“Cannot parse image SIZE” sounds like a broken file – what matters is “Permission denied” at the end of the line.

[one.image.allocate] Cannot parse image SIZE: cannot access '/home/ubuntu/one-lab/tag16/ausgabe/notes-basis.qcow2' (Permission denied)

Causes

Permission deniedoneadmin may not enter your home directory

OpenNebula copies into the datastore as the user oneadmin. Your home directory is not readable for that user.

--pathThe path is right, only the reader differs

--path tells OpenNebula where to copy the file from. If it sits somewhere both users may read, the same command works.

Fix

Copy the file to /var/tmp, register it from there and remove the copy afterwards.
cp ausgabe/notes-basis.qcow2 /var/tmp/
oneimage create -d default --name notes-packer --type OS --format qcow2 \
  --path /var/tmp/notes-basis.qcow2
ID: 11

Don't: Make your home directory world-readable (chmod 755 ~) just so oneadmin gets in.

▶
Break it yourself and find it – free
OpenNebula hands-on, Day 16: build images with Packer and publish them in your own marketplace.
Go to day 16 →

FAQ

When may I delete the file in /var/tmp?

As soon as oneimage list shows the image as rdy – then the copy is in the datastore.

Can I use a URL instead of a file?

Yes, --path also accepts a URL; OpenNebula then downloads the image itself.

Related error patterns

More