Thank you both.
I tried
dpkg-query --show --admindir=/var/lib/snapd/hostfs/var/lib/dpkg
from
snap run --shell ubuntu-package-manifest
but I get a permissions error
dpkg-query: error: failed to open package info file '/var/lib/snapd/hostfs/var/lib/dpkg/status' for reading: Permission denied
I also tried to use a layout:
layout:
/var/lib/dpkg:
bind-file: $SNAP/var/lib/dpkg
But I am then unable to install the snap
$ sudo snap install --dangerous ./ubuntu-package-manifest_0.1_amd64.snap
error: cannot perform the following tasks:
- Setup snap "ubuntu-package-manifest" (unset) security profiles (cannot update mount namespace of snap "ubuntu-package-manifest": cannot update preserved namespace of snap "ubuntu-package-manifest": cannot update snap namespace: cannot use "/snap/ubuntu-package-manifest/x16/var/lib/dpkg" as bind-mount source: not a regular file)