You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a truly minimal system, so after reading documentation I decided to skip stages 2-5. Unfortunately, build process terminates with error during export-image step with the following error: E: Failed to fetch http://raspbian.raspberrypi.com/raspbian/dists/bookworm/main/binary-armhf/Packages Write error - write (28: No space left on device)
After closer investigation of code I've found that too small image file (IMG_SIZE) is allocated in export-image/prerun.sh. It appears that step export-image/02-set-sources installs additional packages into mounted image and fails.
Export stage shouldn't install new packages according to this comment: #620 (comment). But I'm not sure if it will be easy to remove install command, because some people may already rely on this "side effect" to build their own images. Also, in my opinion, increase of 0.2 coefficient will rather hide than than solve a problem.
I think it would be great to defer creation of image file to the later stage after all packages are installed. In other words, I propose to add support for a postrun.sh script and allocate image after all changes to the file system are done.
I plan to alter the behaviour to create a sparse image of a pre-defined size to start with (in stage 0), install everything there and then shrink it down to minimum size + a bit of padding.
You're right, the coefficient is just an ugly workaround and we shouldn't be installing packages in the export stage either.
Sorry, it will take me a while to get around to implementing these changes or testing a PR, so I don't think it's wroth sending one right now. I'd feel guilty leaving it to hang for months. There are some other major changes that I need to make to pi-gen, so I'll do these at the same time.
Problem description
I'm trying to create a truly minimal system, so after reading documentation I decided to skip stages 2-5. Unfortunately, build process terminates with error during
export-image
step with the following error:E: Failed to fetch http://raspbian.raspberrypi.com/raspbian/dists/bookworm/main/binary-armhf/Packages Write error - write (28: No space left on device)
After closer investigation of code I've found that too small image file (
IMG_SIZE
) is allocated inexport-image/prerun.sh
. It appears that stepexport-image/02-set-sources
installs additional packages into mounted image and fails.pi-gen/export-image/02-set-sources/01-run.sh
Line 7 in dca93d2
I was able to fix build by increasing coefficient used for calculation of
ROOT_MARGIN
inexport-image/prerun.sh
:pi-gen/export-image/prerun.sh
Line 21 in dca93d2
Steps to reproduce
Please, use following commands to reproduce the issue.
Proposed Solution
Export stage shouldn't install new packages according to this comment: #620 (comment). But I'm not sure if it will be easy to remove install command, because some people may already rely on this "side effect" to build their own images. Also, in my opinion, increase of 0.2 coefficient will rather hide than than solve a problem.
I think it would be great to defer creation of image file to the later stage after all packages are installed. In other words, I propose to add support for a
postrun.sh
script and allocate image after all changes to the file system are done.The only challenge I foresee is
export-image/04-set-partuuid/00-run.sh
which requires image blob being allocated and partitioned:https://github.com/RPi-Distro/pi-gen/blob/dca93d24c7dfb943d84601d2bc4a089f9b66b87f/export-image/04-set-partuuid/00-run.sh#L5C1-L5C6
But I'm happy to dedicate some time to search of alternative implementation.
Please, let me know what are your thoughts. I will be happy to prepare a PR once we reach an agreement on solution.
The text was updated successfully, but these errors were encountered: