Skip to content

unsquashfs >= 4.7 fails on devices with less than 683MB RAM, breaking rauc info #1958

@chrthi-work

Description

@chrthi-work

Describe the bug
unsquashfs >= 4.7 fails on devices with less than 683MB RAM, breaking rauc info.

Background information
i.MX27 device with 128 MiB RAM
RAUC 1.15.1
unsquashfs 4.7.5
Yocto Wrynose

To Reproduce
Steps to reproduce the behavior:

  1. Copy a valid bundle to the target
  2. Run rauc info on the bundle

Expected behavior
The usual output of rauc info

Logs
rauc info mybundle.raucb fails with

rauc-Message: 14:00:44.858: Using central status file /data/rauc.status
rauc-Message: 14:00:44.920: Using system config file /etc/rauc/system.conf
rauc-Message: 14:00:44.924: Reading bundle: mybundle.raucb
rauc-Message: 14:00:45.392: Verifying bundle signature...
rauc-Message: 14:00:51.959: Verified detached signature by '...'
Total memory requested is more than 75% of physical memory.
Unsquashfs uses memory to cache data from disk to optimise performance.
It is pointless to ask it to use more than this amount of memory, as this
causes thrashing and it is thus self-defeating.
FATAL ERROR: Requested memory size too large
Failed to extract manifest from bundle: Failed to run unsquashfs: Child process exited with code 1

Additional context
I've bisected the unsquashfs failure to a stricter check that was introduced in plougher/squashfs-tools@fc06653. The default for fragment_buffer_size and data_buffer_size is 256 each, so for the 75% check to pass, "physical memory" must be at least 683M. On my device unsquashfs calculates 116M.

The failure can be avoided by passing a smaller buffer size to unsquashfs with e.g., -mem 2. That is the minimal size it accepts and still works fine for retrieving the manifest.

Suggestions
One could

  1. add the -mem 2 option to the hardcoded unsquashfs command line in rauc
  2. allow adding unsquashfs options in rauc.conf
  3. Remove the unsquashfs dependency and just mount the bundle instead
  4. leave it up to users to patch unsquashfs on affected devices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions