-
Notifications
You must be signed in to change notification settings - Fork 339
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
toybox blkid requires root (and still misses things) #239
Comments
The error message is saying it can't open the /dev nodes. This is really an Elliott question, but Android is covered with selinux, so binaries can require selinux annotations (extended attributes in the filesystem) to have permission to access a lot of stuff stuff. And unless you've rooted your device, the only way to add some of those annotations is at system image build time (I.E. by running AOSP or similar and installing a new image on your phone). When selinux is running, it won't let you add some of these attributes to new files, they have to be grandfathered in at install time. |
Does it mean that I've to build toybox using my Android device? |
it looks like the util-linux blkid works completely differently from toybox. it's not opening "/dev/" + name listed in /proc/partitions. it looks like it's opening "/sys/dev/block/" + device major/minor listed in /proc/partitions, and then getting the uuid from dm/uuid off that, and using /dev/mapper (though i don't know how it knows what to ask /dev/mapper for without also reading the dm/name file?). i see this on my desktop --- toybox blkid is just a list of "Permission denied"s, but util-linux blkid works as non-root. |
it looks like even if i run toybox blkid as non-root on my desktop, i still see less than i would with util-linux blkid. specifically: one device from /proc/partitions is missing completely, and util-linux additionally includes BLOCK_SIZE, PARTLABEL, and PARTUUID information. |
Hmmm. Design difference. Toybox is treating image files and block devices the same, that one's asking the kernel "what you have you identified" and passing on what the kernel tells it. https://en.wikipedia.org/wiki/Device_mapper And of course they buried the "how it actually works" part inside a magic shared library. https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/index.html Yup, rather than documenting the kernel api they documented the userspace tool's config file format IN THE KERNEL DOCUMENTATION. This looks like one of those "the power of strace compels you" and "read the kernel source" things. I'll throw it on the todo heap. |
The
toybox blkid
command doesn't seem to work on Android. I've tried the Android's default toybox binary and the prebuilt binaries from your website both of which have produced the same output. But theblkid
binary (which is a separate binary since it's not symlinked to toybox) that comes with Android works. Is there any particular reason for this?toybox blkid
Android built-in blkid
The text was updated successfully, but these errors were encountered: