[Bug]: Fails to compile on system if any parent above is shared and has se_linux labels applied for samba.
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 3.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 204
Description
### What happened?
I'm compiling on Fedora 44 KDE 6.7 Wayland, 128GB RAM. This is the coiline options I need but the options don't change the outcome as the bug is in the build script itself.
`./compile.sh build BOARD=rpi4b BRANCH=edge RELEASE=trixie KERNEL_TARGET=edge BUILD_MINIMAL=yes BUILD_DESKTOP=no BOOT_LOGO=yes KERNEL_CONFIGURE=no SHOW_DEBUG=yes`
But his throws the following error at the end:
```
🐳|🔨] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1347) [sender=3.4.1]
[🐳|💥] Error 23 occurred in main shell [ at /armbian/lib/functions/logging/runners.sh:276
run_host_command_logged_raw() --> lib/functions/logging/runners.sh:276
run_host_command_logged() --> lib/functions/logging/runners.sh:258
create_image_from_sdcard_rootfs() --> lib/functions/image/rootfs-to-image.sh:80
do_with_logging() --> lib/functions/logging/section-logging.sh:81
build_rootfs_and_image() --> lib/functions/main/rootfs-image.sh:98
full_build_packages_rootfs_and_image() --> lib/functions/main/default-build.sh:36
do_with_default_build() --> lib/functions/main/default-build.sh:42
cli_standard_build_run() --> lib/functions/cli/cli-build.sh:25
armbian_cli_run_command() --> lib/functions/cli/utils-cli.sh:136
cli_entrypoint() --> lib/functions/cli/entrypoint.sh:216
main() --> compile.sh:50
]
```
The issue here is that the following SE Linux extended attribute is applied to my home folder as it is shared via samba.
```
:~$getfattr -R -n security.selinux . 2>/dev/null | head -100
# file: .
security.selinux="unconfined_u:object_r:user_home_dir_t:s0"
```
I can compile for Qemu, Orange PI RV2 and Orange Pi Zero 2W, but not Raspberry Pi4b.
After some sleuthing, I found what appears to be source of the problem. The check at line 62 of **rootfs-to-image.sh** is currently:
`if [[ $(findmnt --noheadings --output FSTYPE --target "$MOUNT/boot" --uniq) == vfat ]]; then`
This check is failing because the **actual** folder it should looking at for the Pi4 is /boot/firmware. This causes the **If** statement to evaluate **false** which in turns tells the system to run `run_host_command_logged rsync -aHWXh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT"` #etx4 instead of `run_host_command_logged rsync -aHWXh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT" # ext4` which in turn pukes due to the -X being applied and FAT32 obviously not liking those flags.
In order to resolve, I changed the if block to `if [[ $(findmnt --noheadings --output FSTYPE --target "${MOUNT}${UEFI_MOUNT_POINT:-/boot}" --uniq) == vfat ]]; then
`
With this change, it properly evaulates the path and chooses the FAT32 rsync option. I can now build for rpi4b without issue and all of my other builds complete properly as well.
I've attached a patch file for other to test with.
[rpi4bfix.patch](https://github.com/user-attachments/files/31525610/rpi4bfix.patch)
### How to reproduce?
Create samba share for the parent folder where you have Armbian synced. Ensure the attribute **security.selinux="unconfined_u:object_r:user_home_dir_t:s0** was properly applied (command above). Then run a build for rpi4b.
### Branch
main (main development branch)
### On which host OS are you running the build script and observing this problem?
Other
### Are you building on Windows WSL2?
- [ ] Yes, my Ubuntu/Debian/OtherOS is running on WSL2
### Relevant log URL
https://paste.armbian.com/oduheyefun
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Review lib/functions/image/rootfs-to-image.sh around line 62 and compare the mount target with the Raspberry Pi 4 boot layout. Reproduce with the supplied compile.sh command and SELinux-labeled Samba parent, then confirm the rpi4b image completes without rsync error 23 and that the other listed boards still build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, shell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100