busybox: tar applet fails to extract (some) symlinks
Created by: alive4ever
After upgrading busybox to version 1.28, busybox tar applet fails to extract (some) symlinks.
With my recycled device (armani/armhf), the failed symlinks extraction occurs
with busybox applets inside /bin directory. There are no symlinks to busybox
applets at all here. Even important applet such as /bin/ash and /bin/sh are not
available, causing chroot
inside the debug-shell to fail unless a specific
command is specified, such as /bin/bash
or /bin/busybox sh
.
/tmp/postmarketos/chroot/mnt/pmOS # ls -F bin/
bash* findmnt* lsmod@ mountpoint* umount*
bbsuid* groups* mksh* rc-status* uniso*
busybox* kmod* modinfo@ su* wdctl*
busybox-extras* login* more* tar*
dmesg* lsblk* mount* udevadm*
As comparison, here are files present inside device chroot (pmbootstrap chroot -r
)
/ # ls -F bin/
arch@ date@ fsync@ linux32@ more* rc-status* sync@
ash@ dd@ getopt@ linux64@ mount* reformime@ tar*
base64@ df@ grep@ ln@ mountpoint* rev@ touch@
bash* dmesg* groups* login* mpstat@ rm@ true@
bbconfig@ dnsdomainname@ gunzip@ ls@ mv@ rmdir@ udevadm*
bbsuid* dumpkmap@ gzip@ lsblk* netstat@ run-parts@ umount*
busybox* echo@ hostname@ lsmod@ nice@ sed@ uname@
busybox-extras* ed@ ionice@ lzop@ pidof@ setpriv@ uniso*
cat@ egrep@ iostat@ makemime@ ping@ setserial@ usleep@
chgrp@ false@ ipcalc@ mkdir@ ping6@ sh@ watch@
chmod@ fatattr@ kbd_mode@ mknod@ pipe_progress@ sleep@ wdctl*
chown@ fdflush@ kill@ mksh* printenv@ stat@ zcat@
conspy@ fgrep@ kmod* mktemp@ ps@ stty@
cp@ findmnt* link@ modinfo@ pwd@ su*
Another noticeable failure is missing /sbin/init
symlink, which causes
switch_root
to fail miserably.
/tmp/postmarketos/chroot/mnt/pmOS # ls -F sbin/
agetty* mpathpersist*
apk* multipath*
arptables-compat@ multipathd*
blkdiscard* nologin*
blockdev* openrc*
chcpu* openrc-run*
cryptsetup* pam_tally*
cryptsetup-reencrypt* pam_tally2*
ctrlaltdel* pam_timestamp_check*
dhcpcd* pivot_root*
dmsetup* raw*
dmstats@ rc*
e2fsck* rc-service*
eapol_test* rc-update*
ebtables-compat@ runscript*
fdisk* service*
findfs* setup-acf*
fsck* setup-alpine*
fsck.cramfs* setup-apkcache*
fsck.ext2@ setup-apkrepos*
fsck.ext3@ setup-bootable*
fsck.ext4@ setup-disk*
fsck.minix* setup-dns*
fsfreeze* setup-gparted-desktop*
fstrim* setup-hostname*
hwclock* setup-interfaces*
integritysetup* setup-keymap*
iptables@ setup-lbu*
iptables-compat@ setup-mta*
iptables-compat-restore@ setup-ntp*
iptables-compat-save@ setup-proxy*
iptables-restore@ setup-sshd*
iptables-restore-translate@ setup-timezone*
iptables-save@ setup-udev*
iptables-translate@ setup-xen-dom0*
kpartx* setup-xorg-base*
lbu* start-stop-daemon*
lbu_commit@ supervise-daemon*
lbu_exclude@ swapfile*
lbu_include@ swaplabel*
lbu_status@ swapoff*
lbu_update@ swapon*
ldconfig* switch_root*
losetup* udevd*
mke2fs* unix_chkpwd*
mkfs* unix_update*
mkfs.bfs* update-conf*
mkfs.cramfs* update-kernel*
mkfs.ext2@ veritysetup*
mkfs.ext3@ wipefs*
mkfs.ext4@ wpa_cli*
mkfs.minix* wpa_passphrase*
mkhomedir_helper* wpa_supplicant*
mkinitfs* xtables-compat-multi*
mkmntdirs* xtables-multi*
mkswap* zramctl*
Here are files inside sbin on device chroot
/ # ls -F sbin/
acpid@ iptables-restore-translate@ route@
adjtimex@ iptables-save@ runscript*
agetty* iptables-translate@ service*
apk* iptunnel@ setconsole@
arp@ klogd@ setup-acf*
arptables-compat@ kpartx* setup-alpine*
blkdiscard* lbu* setup-apkcache*
blkid@ lbu_commit@ setup-apkrepos*
blockdev* lbu_exclude@ setup-bootable*
chcpu* lbu_include@ setup-disk*
cryptsetup* lbu_status@ setup-dns*
cryptsetup-reencrypt* lbu_update@ setup-gparted-desktop*
ctrlaltdel* ldconfig* setup-hostname*
depmod@ loadkmap@ setup-interfaces*
dhcpcd* logread@ setup-keymap*
dmsetup* losetup* setup-lbu*
dmstats@ lsmod@ setup-mta*
e2fsck* mdev@ setup-ntp*
eapol_test* mkdosfs@ setup-proxy*
ebtables-compat@ mke2fs* setup-sshd*
fbsplash@ mkfs* setup-timezone*
fdisk* mkfs.bfs* setup-udev*
findfs* mkfs.cramfs* setup-xen-dom0*
fsck* mkfs.ext2@ setup-xorg-base*
fsck.cramfs* mkfs.ext3@ slattach@
fsck.ext2@ mkfs.ext4@ start-stop-daemon*
fsck.ext3@ mkfs.minix* supervise-daemon*
fsck.ext4@ mkfs.vfat@ swapfile*
fsck.minix* mkhomedir_helper* swaplabel*
fsfreeze* mkinitfs* swapoff*
fstrim* mkmntdirs* swapon*
getty@ mkswap* switch_root*
halt@ modinfo@ sysctl@
hdparm@ modprobe@ syslogd@
hwclock* mpathpersist* tunctl@
ifconfig@ multipath* udevadm@
ifdown@ multipathd* udevd*
ifenslave@ nameif@ udhcpc@
ifup@ nologin* unix_chkpwd*
init@ openrc* unix_update*
inotifyd@ openrc-run* update-conf*
insmod@ pam_tally* update-kernel*
integritysetup* pam_tally2* vconfig@
ip@ pam_timestamp_check* veritysetup*
ipaddr@ pivot_root* watchdog@
iplink@ poweroff@ wipefs*
ipneigh@ raidautorun@ wpa_cli*
iproute@ raw* wpa_passphrase*
iprule@ rc* wpa_supplicant*
iptables@ rc-service* xtables-compat-multi*
iptables-compat@ rc-sstat@ xtables-multi*
iptables-compat-restore@ rc-update* zramctl*
iptables-compat-save@ reboot@
iptables-restore@ rmmod@
Another failed symlink extraction occurs inside /etc/runlevels
, with no
symlinks inside boot
, default
, shutdown
, and sysinit
. The symlinks here
are important, as they indicate whether a service is enabled for the specific
runlevel.
/tmp/postmarketos/chroot/mnt/pmOS # ls -F etc/runlevels/*
etc/runlevels/boot:
etc/runlevels/default:
etc/runlevels/nonetwork:
etc/runlevels/shutdown:
etc/runlevels/sysinit:
For comparison, here are files inside /etc/runlevels inside device rootfs chroot.
/ # ls -F etc/runlevels/*
etc/runlevels/boot:
bootmisc@ hostname@ hwclock@ modules@ msm-fb-refresher@ swclock@ sysctl@ syslog@
etc/runlevels/default:
chronyd@ haveged@ networkmanager@ swapfile@ wcnss-wlan@
dbus@ local@ sshd@ udev-postmount@ wpa_supplicant@
etc/runlevels/nonetwork:
etc/runlevels/shutdown:
killprocs@ mount-ro@ savecache@
etc/runlevels/sysinit:
devfs@ dmesg@ udev@ udev-trigger@ wlanarmani@
This issue breaks installation using --android-bootable-recovery
method,
since it uses busybox tar
applet to extract rootfs tarball into root
subpartition.
When extracting the rootfs tarball into root subpartition, failure is not an option.
With this fatal error, I suggest including better tar
for use with
postmarketos installation, such as GNU tar or bsdtar
from libarchive-tools
package.