Skip to content

/var/lib/dpkg/available missing when building Debian Buster rootfs (dpkg error) #119

@mxvisor

Description

@mxvisor

When building an image based on Debian Buster the rootfs installation fails with dpkg because /var/lib/dpkg/available is missing.
Log output:

...
The following packages will be REMOVED:
  localepurge*
dpkg: error: failed to open package info file '/var/lib/dpkg/available' for reading: No such file or directory
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
E: Sub-process dpkg --set-selections returned an error code (2)
E: Couldn't record the approved state changes as dpkg selection states
WARNING: exit code 100 from a shell command.
...
ERROR: Task ... do_rootfs_install) failed with exit code '1'
...

isar-mmdebstrap.inc tries to work around this by adding an mmdebstrap hook.
Current (non-working) code:

DPKG_HOOKS ?= "${@'--hook-dir='+d.getVar('MM_HOOK_JESSIE') \
              if os.path.isdir(d.getVar('MM_HOOK_JESSIE')) \
              else '--customize-hook=\'touch /var/lib/dpkg/available\''}"

The hook uses touch /var/lib/dpkg/available, but it runs on the host rather than inside the mmdebstrap rootfs.
The proposed fix is to use the hook parameter $1 (the mmdebstrap rootfs path) when creating the file:

DPKG_HOOKS ?= "${@'--hook-dir='+d.getVar('MM_HOOK_JESSIE') \
              if os.path.isdir(d.getVar('MM_HOOK_JESSIE')) \
              else '--customize-hook=\'touch $1/var/lib/dpkg/available\''}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions