2

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.

  • well it sems after you expand the filsesystem something busts. So that says something went wrong with the expansion. Maybe you need to mark a bootable flag... or it get removed. You can boot a Linux Live image and try and fix the SD using gparted in that OS. Just sounds like a boot flag or resize wiping something used on the boot. – Piotr Kula Feb 26 at 7:13
  • thank you for your insight, I will look into – Birdy Kun Feb 26 at 7:15
  • It seems that the php7.2 packages I am installing are not compatible with armh which is what is causing the problems. I will look for a way to isntall the php7.2 for raspbian. – Birdy Kun Feb 26 at 7:26
  • Oh right. Ok-I dont use PHP so have verry little knowledge on that. I suppose doing step by step and checking each time boot where the problem is. It is pretty bad that you can install non compatible binaries that break the entire boot. – Piotr Kula Feb 26 at 7:27
  • 1
    yes of course, looking into it. I am currently building the image will take a while and I will be back hopefully with a solution. :) – Birdy Kun Feb 26 at 7:48
1

For someone who might be reading this, the problem was indeed the incompatible php7.2 packages that i was trying to add.

I followed this time a guide made for How to Add php7.3 on your raspberry pi, as I should have done in the first place, https://janw.me/2019/installing-php7-3-rapsberry-pi/. And I installed my php packages, plugges the sd card, my custom image is working. I do not know why silly me didn't notice that I was trying to install debian packages on my raspberry pi. I hope no one makes the same mistake as I did.

  • That could not have caused the problem you describe. – goldilocks Feb 26 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.