I am trying to make a custom Raspberry Pi image, using the following program https://github.com/RPi-Distro/pi-gen.
I am using Debian 9 Lite release as a base.
A little brief, this program goes through stages while building the image, and as mentioned in the documentation, in order to use the Lite image I have to start trimming my image in stage2 and add SKIP to the following stages, that is stage3, stage4, and stage5. I also have to add SKIP_IMAGES to stage4 and stage5 as these stages contain an export_image file.
I have added two new files in the stage2 following the architecture, in order to add the packages that I want. Including these packages, there is php7.2 and some other php7.2 packages. The problem is the following, the Debian 9 includes php up to 7.0 and in order to install up to 7.2, I had to update the repo of apt, following this guide: https://ayesh.me/Ubuntu-PHP-7.2, and many other sources.
So i have to run :
sudo apt install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
before being able to install php7.2.
Thanks for reading this far, now is the real issue. I have found that after doing the following commands and building the image, after inserting it in the Raspberry Pi Zero that I have, I get the error "Could not expand filesystem, try raspi-config or rc_gui."
To solve this, I removed the line nit=/usr/lib/raspi-config/init_resize.sh from /boot/cmdline.txt and remove /etc/init.d/resize2fs_once
as indicated by : https://github.com/raspberrypi/linux/issues/2775
and then I expanded the image using gparted.
I plug the sd card in the Raspberry Pi again and the result is: I get nothing. I get the rainbow image flash, then the raspberry icon and a dash show up.