FloatingSunfish Posted October 12, 2020 Posted October 12, 2020 We have added some custom files inside `/build/userpatches/overlay`, which is as follows: /build/userpatches/overlay /log-configurations log-config /scripts myscript.sh /services myservice.service We are building our image with the following command: sudo ./compile.sh CLEAN_LEVEL="" BOARD=zeropi BRANCH=dev RELEASE=buster BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img The build completes successfully, but when we open the Image file in PowerISO, we cannot locate our custom files inside the Image. We have the assumption that custom files should be located somewhere in the built Image. Is this assumption correct? If so, where should we expect to see our custom files?
Werner Posted October 12, 2020 Posted October 12, 2020 The userpatches folder is actually for patches that should be applied before building stuff like U-Boot or the kernel. If you want to include specific files into your image before it gets packed try utilizing the customization script: https://docs.armbian.com/Developer-Guide_User-Configurations/#user-provided-image-customization-script
FloatingSunfish Posted October 12, 2020 Author Posted October 12, 2020 (edited) 7 minutes ago, Werner said: The userpatches folder is actually for patches that should be applied before building stuff like U-Boot or the kernel. If you want to include specific files into your image before it gets packed try utilizing the customization script: https://docs.armbian.com/Developer-Guide_User-Configurations/#user-provided-image-customization-script We believe this is what we are already doing. We are including custom files inside `/build/userpatches/overlay`, and we are using `/userpatches/customize-image.sh` to access said custom files from the `/tmp/overlay` directory. We actually have 2 issues: 1. It seems `customize-image.sh` is not being run (we're creating a directory `/mydirectory` and it's not being created after installing the image). 2. Our custom files inside `/build/userpatches/overlay` are not being reflected inside the built Image. We decided to ask the easier question first, which is #2. Going back, is our assumption correct that our custom files should be visible somewhere inside the built Image? Also, are we using `/build/userpatches/overlay` and `/userpatches/customize-image.sh` correctly? We're going by what we understand from the link you provided. Edited October 12, 2020 by FloatingSunfish
Werner Posted October 12, 2020 Posted October 12, 2020 My bad, did not get it right. However from the detail provided I don't know what the cause could be. Did you explore the output/debug folder after the building is finished? You may find some information in the logs.
FloatingSunfish Posted October 12, 2020 Author Posted October 12, 2020 4 minutes ago, Werner said: Did you explore the output/debug folder after the building is finished? You may find some information in the logs. I see, noted. We will check the `output/debug` directory and get back with any weird details we find.
Igor Posted October 12, 2020 Posted October 12, 2020 30 minutes ago, FloatingSunfish said: It seems `customize-image.sh` is not being run It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ...
FloatingSunfish Posted October 12, 2020 Author Posted October 12, 2020 (edited) 8 minutes ago, Igor said: It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ... Our `customize-image.sh` contains the following custom code for `buster`: buster) # Update Repositories apt-get -y update apt-get -y upgrade apt-get -y dist-upgrade # ------------------------------------------ # Copy our files to the proper directories. # ------------------------------------------ # ---------------- # Logrotate Files # ---------------- cp -TR /tmp/overlay/log-configurations/ /etc/logrotate.d/ # -------- # Scripts # -------- mkdir -m 777 /scripts cp -TR /tmp/overlay/scripts/ /scripts/ # Enable Network-checking. systemctl start systemd-networkd systemctl enable systemd-networkd # Make our scripts executable by services (do for each script file). chmod a+x /scripts/myscript.sh # --------- # Services # --------- cp -TR /tmp/overlay/services/ /etc/systemd/system/ # Give our services the proper permissions. chmod 644 /etc/systemd/system/myservice.service systemctl daemon-reload # Start and run our services on startup (do for each service file). # Note that each line has TWO commands! systemctl start myservice && systemctl enable myservice ;; We're creating a new directory with `mkdir -m 777 /scripts`, but it is not being created. Also, is there any code in the above section that is incorrect or should not be there? Edited October 12, 2020 by FloatingSunfish
FloatingSunfish Posted October 12, 2020 Author Posted October 12, 2020 1 hour ago, Igor said: It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ... UPDATE: We managed to create a new directory by changing `mkdir -m 777 /scripts` to `mkdir -m 777 $SDCARD/scripts`. Although we are not sure if this will work for other developers, at least it resolved the "directories not being created" issue.
Igor Posted October 12, 2020 Posted October 12, 2020 26 minutes ago, FloatingSunfish said: We managed to create a new directory by changing And I wasted one hour for dealing with the bug that does not exits! Since I don't know who will pay that I might get seriously pissed off next time which is why I recommend you to get a subscription or hire someone that will deal with your problems https://www.debian.org/consultants/
FloatingSunfish Posted October 12, 2020 Author Posted October 12, 2020 19 minutes ago, Igor said: And I wasted one hour for dealing with the bug that does not exits! Since I don't know who will pay that I might get seriously pissed off next time which is why I recommend you to get a subscription or hire someone that will deal with your problems https://www.debian.org/consultants/ I wouldn't call it "wasting one hour," as not being able to create a directory with `mkdir -m 777 /scripts` feels like a legitimate issue. `/` being the root directory on any Linux system, I can imagine other developers being confused if the above command does not work for them. To be honest, `mkdir -m 777 $SDCARD/scripts` was a blind guess to see if something will work as we did not see it in the official documentation (or if it was, our apologies in advance if we somehow missed it). If prefixing `$SDCARD` to directories is always needed (which it might be, given how Armbian runs on development boards on devices that will most likely use SD cards), then it might need to be added to the documentation if it's not there already. Again, our apologies if we upset you.
Igor Posted October 12, 2020 Posted October 12, 2020 1 hour ago, FloatingSunfish said: was a blind guess to see if something will work as we did not see it in the official documentation We don't provide support for 3rd party applications that you plan to execute inside chroot on Debian or Ubuntu userspace. Which is why we don't provide documentation for that or help in case of troubles. 1 hour ago, FloatingSunfish said: I wouldn't call it "wasting one hour," This is free software and there is zero warranty that this software works at all.
Solution FloatingSunfish Posted October 13, 2020 Author Solution Posted October 13, 2020 (edited) UPDATE: It seems that changing `mkdir -m 777 /scripts` to `mkdir -m 777 $SDCARD/scripts` has resolved both issues: 1. `customize-image.sh` is now running as expected. 2. We can now see our custom files inside `/build/userpatches/overlay`. These were "copied" to where we told `customize-image.sh` to place them. Edited October 13, 2020 by FloatingSunfish
Recommended Posts