Skip to content

Info

instar info displays image format information, as a drop-in replacement for qemu-img info.

# Display image format information (matches qemu-img info output)
instar info image.qcow2

# Discover and display the complete backing file chain
instar info --chain image.qcow2

# Inspect LUKS container with inner format detection
instar info --luks-passphrase 'secret' encrypted.luks

The --chain flag iteratively runs the sandboxed info operation on each image in the backing chain, validating paths against a security allowlist to prevent directory traversal attacks. See chain-discovery.md for the full chain discovery design.

A file:// input

An input that starts with a scheme and :// is a URL rather than a path. instar info file:///srv/images/disk.qcow2 reads the same image as instar info /srv/images/disk.qcow2 and prints the same bytes on stdout, in both human and json output. The difference is how the image is read: the host starts a separate, untrusted instar-fetch process and the sandbox's virtual disk is served from what that process sends back, rather than from a file the host opens itself. See fetch-protocol.md for how the two are joined and for the process's lifetime.

instar info file:///srv/images/disk.qcow2
instar info file://localhost/srv/images/disk.qcow2

What is accepted is deliberately narrow. After file:// comes either nothing or localhost, then an absolute path. These are refused, each with a message saying why:

  • another host (file://other.example/x), since instar reads local files only
  • a relative path (file://disk.qcow2) or no path at all (file://localhost)
  • a query (?) or a fragment (#), which would mean something other than the file name the user typed
  • a % escape, since instar does not decode them, so the path it opens is always the text that was typed
  • a NUL byte

file:/path, with one slash, is a path and not a URL. A URL is recognised by scheme://, so file:/srv/images/disk.qcow2 is taken as a relative path whose first component is a directory called file:, and reports No such file or directory. Write three slashes.

Every other scheme is refused by name: https, http, s3 and nbd each have a message saying that instar does not accept that scheme yet, and any other scheme gets a generic one. None of them works today. An argument with no ://, such as weird:name, is a path exactly as it always was.

--chain is refused over a URL. It would not fail to work -- chain discovery opens the image and each of its parents directly, so over file:// it would succeed without ever reading a byte through the fetcher, and look like a feature that is supported when it is not.

The fetcher's own stderr is shown only with --verbose. It reports what it is serving and that its peer closed the socket, even on a run that goes well, so a default run is silent on stderr for a URL exactly as it is for a path. Nothing is lost on a failure: the message the user reads is written by instar from the fetcher's status, not taken from its output.

The fetcher is confined before it reads anything from its peer: it can open no path and make only the system calls it serves with. --verbose prints one line per layer saying either that the kernel provides it and the fetcher has applied it, or that the kernel cannot and the fetcher runs without it, so on a kernel without Landlock or without the seccomp kill action the run still goes ahead and tells you which layer it lacked. If the fetcher is killed by a signal, instar reports it on stderr whatever verbosity was asked for, naming the signal and saying the input was not read to the end. SIGSYS means the fetcher made a system call its sandbox does not allow. That is a bug in instar, not a fault in your image or in how you ran the command, and worth reporting with the pid and the command line.

The virtual disk's size comes from the capacity the fetcher advertises. The disk size figure still comes from the host's stat of the file, because the fetcher reports an apparent size and nothing for how much of it is allocated. That is only possible because a file:// input has a local path; an input without one would have no such figure.

Version compatibility

Different qemu-img versions produce slightly different output formats:

  • qemu-img 6.0-7.2 (Debian 12 bookworm): No "Child node '/file'" section
  • qemu-img 8.0+ (Debian 13 trixie): Includes "Child node '/file'" section

By default, instar detects the installed qemu-img version and emits matching output. This ensures true drop-in replacement compatibility.

To explicitly specify which qemu-img version's output format to use:

# Emit output compatible with qemu-img 7.2 (no Child node section)
instar info --qemu-version 7.2 image.qcow2

# Emit output compatible with qemu-img 10.0 (includes Child node section)
instar info --qemu-version 10.0 image.qcow2

See output-formats.md for detailed documentation on output format profiles.

VHDX sizes

A VHDX's virtual size and block size (reported as the cluster size) are read from the File Parameters and Virtual Disk Size metadata items, which info finds by GUID in the metadata table. SPEC(VHDX) 2.6.1.2 gives metadata items no fixed order or position, so info never assumes one. If the metadata cannot be parsed (a missing required item, an item outside the file, or a block size that is not a power of two between 1 MiB and 256 MiB), info reports the file's size as the virtual size and no cluster size, rather than a value it could not trust.

Differencing images

A differencing VHD (disk_type == 4) or differencing VHDX (HasParent set) has its parent reported as a backing file, in both human (backing file: ...) and --output json (backing-filename / full-backing-filename) forms — the same fields qcow2's backing file already uses. convert, dd, compare, bench and rebase compose a differencing source against its parent; measure and check still refuse one outright, like map. instar info composes no sector data either way, so it has no wrong answer to give regardless of which of those applies, and it is what a user reaches for when an operation that does refuse declines to read the image. See the "VHD/VHDX differencing" section of quirks.md for the full per-op record.

backing-filename-format reports vpc or vhdx to match the child, not the qcow2 that field defaults to when no backing format is recorded. A differencing image records no backing-format field of its own, but SPEC(VHD) and SPEC(VHDX) both require a parent to be the same format as its child, so the format is known without one.

A reported parent is not a resolved parent. info on its own decodes a parent reference from the image's own header and prints what it finds; it does not open the result. For VHD that reference is the parent unicode name in the dynamic header, and only that -- the eight parent locator entries beside it are parsed by the vhd crate but no read path consults them, so a differencing VHD whose name field is blank reports no parent even when its locator table names one. For VHDX, which has no name field, it is the parent locator item. --chain does resolve a VHD or VHDX parent and walk into it, under the same allowlist and depth checks a qcow2 backing file gets — but only when it can: whenever a parent cannot be resolved, the walk ends at the last image it did resolve, and that image's own unresolved reference is reported rather than the command erroring (see chain-discovery.md for the reasons and the exact stderr line). A parent locator is attacker-controlled data — it can name an absolute path, a relative traversal, a UNC share or a URL — so treat backing-filename on a differencing image as a string the image claims, not a file instar has validated.

Known limitations

A Windows-convention parent has no "actual path"

info shows where a relative backing reference resolves, joined onto the image's directory, as qemu-img does. A parent recorded as a Windows absolute path -- a drive letter (C:\images\parent.vhdx) or anything rooted at \\ (a UNC share, or a \\?\Volume{...} path) -- is absolute in its own convention and names no file on this host, so it is treated as a POSIX absolute reference is: reported exactly as the image records it, with no "actual path", and JSON's full-backing-filename repeats it verbatim.

backing file: \\attacker\share\probe

It used to be joined onto the image's directory, producing an "actual path" such as /images/\\attacker\share\probe that cannot exist (issue #658). This applies to both differencing formats: a VHD parent unicode name and a VHDX absolute_win32_path or volume_path locator key are all reported as stored. A relative VHDX locator is rendered back into POSIX convention, so create -f vhdx -b parent.vhdx followed by info reports parent.vhdx and resolves correctly. A relative reference already in Windows convention, such as a VHD parent name of ..\parent.vhd, is still joined onto the image directory without being normalised. The full account, including which locator key info prefers and why the relative case is rendered back, is the "VHD/VHDX differencing" section of quirks.md.

This holds for a qcow2 or VMDK backing reference too, and info and the reading operations agree about it. A name such as C:\images\base.qcow2 is also a legal POSIX file name, and chain discovery used to join it onto the image's directory: a file of exactly that name sitting beside the image was opened as the backing file, while info reported the reference with no "actual path" and so showed nothing of the kind. Discovery now refuses such a reference, naming it, and the reading operations open nothing for it -- which is also what qemu-img does, for its own reason: it reads everything before the first colon as a protocol name and reports Unknown protocol 'C'. Both drive-letter spellings count, C:\images\base.qcow2 and C:/images/base.qcow2, as does a \\server\share root.

Plain info still describes such an image and exits zero, printing the reference as recorded with no "actual path": it reports what the header says and refuses nothing. info --chain on a qcow2 or VMDK overlay now exits non-zero instead, because a qcow2 chain is not fail-soft -- a listing that cannot be completed is an error rather than a short listing. A VHD or VHDX reporting walk still ends its listing at the child that records the reference, prints the reason on stderr, and exits zero, which is the fail-soft behaviour differencing parents have always had.

📝 Report an issue with this page