Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readlink -f from busybox is broken for kernel version < 3.6 #5530

Closed
honk0504 opened this issue Mar 3, 2022 · 25 comments
Closed

readlink -f from busybox is broken for kernel version < 3.6 #5530

honk0504 opened this issue Mar 3, 2022 · 25 comments
Assignees
Labels
confirmed Issue confirmed to exist and the reason is known regression Something works in previous versions but not in the current one

Comments

@honk0504
Copy link

honk0504 commented Mar 3, 2022

Device: Nexus 7 (2013) WiFi (flo)
Android version: Android 11 (lineage 18.1 - lineage-18.1-20220228-nightly-flox-signed)
Magisk version name: 7cfce9f
Magisk version code: 24201

I patched the boot.img and got an magisk patched boot file. I booted into TWRP (twrp-3.6.0_9-0-flo) and installed the patched boot image. No errors. After booting the device freeze. I have to re-install org boot.img to make it work again.
I took magisk.apk and renamed it to magisk.zip. I trying to install magisk.zip with TWRP.
ERROR!

Magisk 24.2 Installer

! Cannot mount /system
'- Unmount partition
Prozess Updater endet mit FEHLER: 1
Fehler beim Installieren von ZIP '/sdcard/Download/magisk-v24.2.zip'
Partitions-Informationen werden aktualisiert...
... Fertig

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 3, 2022

More than likely this: #5516

It's already fixed for the next Canary and point release.

@osm0sis osm0sis added the duplicate Duplicate of existing issue label Mar 3, 2022
@osm0sis osm0sis closed this as completed Mar 3, 2022
@osm0sis
Copy link
Collaborator

osm0sis commented Mar 3, 2022

Oh wait, that recovery install issue is new..

I recall this used to work fine.

@osm0sis osm0sis reopened this Mar 3, 2022
@osm0sis osm0sis changed the title after patching and installing boot.img the device freeze Nexus 7 flox install in TWRP broken Mar 3, 2022
@osm0sis osm0sis added regression Something works in previous versions but not in the current one and removed duplicate Duplicate of existing issue labels Mar 3, 2022
@disc0nct
Copy link

disc0nct commented Mar 3, 2022

Same error!, I had to re-flash Magisk v24.1 back to make it work again.

@Displax
Copy link
Contributor

Displax commented Mar 3, 2022

Duplicate #5439
But nobody seems to want fix it...

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 3, 2022

It used to work though, so still should

@schneemaier
Copy link

I have the same issue

@StickyDigit
Copy link

Same here on Flox with LOS 18.1.

Magisk 24.2 resulted in stuck boot. Reinstalled 24.1 via TWRP. All ok.

Magisk 24.3 updated from app and worked, but did not survive routine LOS firmware update via TWRP.

24.3 wouldn't re-install from TWRP (couldn't find /system after umount). Had to reinstall 24.1 with TWRP, then update to 24.3 from the app.

@canyie
Copy link
Collaborator

canyie commented Mar 18, 2022

Reverting busybox binary can fix this issue. Further investigation tells the busybox's readlink command with -f option doesn't work for now.
Screenshot_2022-03-18-22-18-57-415_bin mt plus
IMG_20220318_222413_327
I guess the upgrade of ndk triggers some bugs in busybox.

@StickyDigit
Copy link

Following, I adb'd into twrp (3.5.2_9.0)

~ # busybox  | grep "BusyBox v"
BusyBox v1.22.1 bionic (2021-04-06 01:17 +0000) multi-call binary.

~ # echo ":$( readlink /system ):"
:/system_root/system:

~ # echo ":$( readlink -f /system ):"
::

"readlink -f" fails as you describe. Returns empty. FWIW, readlink -f /system || echo bad, echoes bad.
TWRP has not changed, and AFAIK the busybox is in/from that.
The same "readlink -f" is in util_functions.sh find_block() on 24.1, which somehow installs ok on TWRP.

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 18, 2022

Magisk's busybox (in its apk/zip) is where the regression lies, TWRP's busybox has no effect on it.

@yujincheng08
Copy link
Collaborator

This is because of android/ndk#1260

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 19, 2022

That issue sounds pretty old, though, and might not directly affect a static busybox? Also interesting how it worked fine in Magisk 24.1.

@yujincheng08
Copy link
Collaborator

@osm0sis I have fixed it. But I need you to make the change to busybox kitchen. Could you help me?

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 19, 2022

Nice! Same as here on Magisk repo we don't merge without John, but I can review PRs, etc.

@yujincheng08
Copy link
Collaborator

(off topic: could you review #5618?

@yujincheng08
Copy link
Collaborator

Try artifacts of #5620.

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 19, 2022

(off topic: could you review #5618?

Running it already as we speak, and taking a look. 👍

@yujincheng08 yujincheng08 changed the title Nexus 7 flox install in TWRP broken readlink -f from busybox is broken Mar 19, 2022
@Displax
Copy link
Contributor

Displax commented Mar 19, 2022

Can confirm this patch fix installation from TWRP. But not fix #5555, magisk still half-workable. su works, but other stuff broken (logs, normal setup, additional setup, etc.).
Log from #5620 : log.txt

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 21, 2022

Try artifacts of #5620.

Can also confirm this fixes flashing in flox TWRP. The PR CI build and 24303 both have broken root on flox however, but I can also confirm that's fixed upstream by the latest CI. 👍

recovery.log

@yujincheng08 if you rebase on HEAD I can try it again and make sure all is fully working with addon.d, etc. 🙌

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 21, 2022

Follow-up: Not a complete test, but I was able to try out addon.d by copying the arm busybox from your PR CI build over a HEAD CI installation's /data/adb/magisk/busybox and all worked perfectly. 🎉

@yujincheng08 yujincheng08 added the confirmed Issue confirmed to exist and the reason is known label Mar 21, 2022
@yujincheng08 yujincheng08 changed the title readlink -f from busybox is broken readlink -f from busybox is broken for kernel version < 3.6 Mar 21, 2022
@yujincheng08
Copy link
Collaborator

Fixed here: b1faa5e

@arch-user-france1
Copy link

Still no new release.. How can I get this patch?

@osm0sis
Copy link
Collaborator

osm0sis commented Mar 24, 2022

Wait patiently or run the latest CI build from GitHub Actions.

@tfft
Copy link

tfft commented Mar 29, 2022

Based on the number of people that have noted this issue/problem/bug and have downgraded, it might make sense to spin-off a 24.3.1 release simply to address this one problem allowing ample time for 24.4 to run its course.

@vvb2060
Copy link
Collaborator

vvb2060 commented Oct 11, 2022

pub fn realpath(path: &CStr, buf: &mut [u8]) -> isize {
if let Some(fd) = open_fd!(path, O_PATH | O_CLOEXEC) {
let mut st1: libc::stat;
let mut st2: libc::stat;
unsafe {
st1 = std::mem::zeroed();
if libc::fstat(fd.as_raw_fd(), &mut st1) < 0 {
*errno() = ENOENT;
return -1;
}
}

regression on 25204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Issue confirmed to exist and the reason is known regression Something works in previous versions but not in the current one
Projects
None yet
Development

Successfully merging a pull request may close this issue.