-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Armbian boot partition unreadable on Windows machines due to weird partition type #5962
Comments
Jira ticket: AR-1975 |
Some relevant links to this discussion would be: https://en.wikipedia.org/wiki/Partition_type - which lists the MBR partition types that are IBM PC compatible (any relevant OS will likely support identifying ones in this list) https://uapi-group.org/specifications/specs/boot_loader_specification/ - The Linux Userspace API docs (from freedesktop and systemd devs) Suggest the use of 0xEA, however I am yet to actually see this utilized in any distribution by default. pbatard/rufus#609 - Popular image flashing tool Rufus, uses 0xEA as extra metadata partition for itself. The developers claim they've used it for longer than the UAPI spec. Users might be using this tool to image their SDcards which might lead to potential conflicts. |
@meganukebmp Which board have you tried this with? Most boards should use GPT and not the ancient msdos partition table. GPT shouldn't have such a problem. |
The aml-s9xx-box builds have a fat boot partition (so users can edit the extlinux.conf file for their specific type of TV Box). I've see reports of issues in the forums (since the move to armbian-next where I think this change was introduced) that users can no longer see the fat partition on Windows machines (often TV Box users don't have other linux machines to use to pop their sd card into to edit). |
Do you know if there is a specific need to use the ancient msdos partiton table instead of standard GPT partition tables? I don't have insights into all SoC families. But with GPT we wouldn't have this issue. If Armbian could switch to GPT-only, this would not only get rid of that specifi issue but also simplify things and reduce complexity. Not sure if I'm opening a rats nest trying to remove this though 😅 |
I don't know. For my use case, as long as the SD card boot partition is readable by modern Windows OSs and MacOS that is my particular issue. I can't speak for the original author of this particular issue as to what his use case was. |
No worries there, even Windows XP can read a device with a GPT partition table 😄 https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-and-gpt-faq |
@ColorfulRhino I think you are really discussing a separate issue (MBR vs GPT). This issue could probably be solved by changing the partition type from 0xEA to either 0x0B or 0x0C. The change to 0xEA occurred in the move to the new framework. I don't know if @rpardini had a particular reason for the change or not. |
On Amlogic, we can't have GPT and u-boot on the same media, as the load offsets conflict. |
Nah. That is for legacy BIOS -- a x86 thing controlled by |
That's done here: https://github.com/armbian/build/blob/main/lib/functions/image/partitioning.sh#L200-L210 I can't remember writing this code. |
See above. I'm fine with changing it. I personally don't use /boot partition as much as possible, as their presence is generally indicative of legacy bootloaders. |
Yes, apologies for the confusion. Changing the partition type is probably the "easy" fix, but when seeing this I thought "do we even need to support MBR at all"? Since not using MBR would get rid of this issue as well (GPT is using totally different IDs for partitions).
I believe the link is just not correct anymore since it doesn't link to the old version of the code :) But yes, in addition there is legacy BIOS stuff, which is again different than MBR. This is why this is a bit complex imo. Which is why I was thinking, if there is no real reson to support all this legacy stuff (MBR as well as legacy boot), we could simplify the code massively :) But I have no idea if this stuff is maybe needed for something? This is why I was asking instead of just rushing to remove more stuff again xD
But from this, I assume MBR is needed for Amlogic? What a shame :( Whyyyy Amlogic? I am disappointed yet again by vendors doing weird stuff. |
I believe /boot will also be created if you choose a different filesystem than ext4 for root. In that case, /boot is ext4 and / is whatever you chose. |
This has a long history. Even MBR was a challenge. https://github.com/u-boot/u-boot/blob/master/doc/board/amlogic/boot-flow.rst & LibreELEC/amlogic-boot-fip#8 I've no idea if Amlogic changed this for their new (S4/T7+) SoCs though. |
That is all absolutely needed, either for x86 legacy BIOS (part of |
Sounds rough 😅
I see, thanks for the insights! |
This is why: util-linux/util-linux@d0c4300 BTW, IIRC, Windows doesn't mount boot partition by default. As you can see that the EFI boot partition doesn't be shown in explorer. It maybe a safety feature. |
It's... mashed together. Some machines, even though they're in theory UEFI, use a CSM -- the CSM will end up booting a legacy BIOS thing. Other machines (eg virtual machines), without OVMF, will also default to BIOS booting. |
Yeah this makes total sense! I forgot about that. Maybe the best would be to document how to make /boot discoverable in Windows in its current state?
Oh god, whyyyyyy are they doing this 😭 |
Actually, I think something in Armbian's logic is not correct. As per https://uapi-group.org/specifications/specs/boot_loader_specification/
So our GPT partitioned images should not have a /boot partition (Extended Boot Loader Partition) at all, or am I reading this wrong? Edit: I think I'm wrong after some further research, e.g. https://wiki.archlinux.org/title/Partitioning#/boot |
Getting back to the original issue that was logged. The above behavior (which isn't really intended for classic u-boot senarios from my understanding) breaks existing functionality. It is desired and has long been the case that you can take an SD card with an Armbian image (for those builds that still use a FAT partition for /boot) and pop it into a windows machine to tweek things (armbianEnv being one and extlinux.conf being another). This change breaks that long standing capability. So until we move to modern booting systems, we really need to go back to the /boot partition being 0x02 for MBR cases when the board configures the boot partition as a fat file system type. (I'm not sure what should be done for GPT cases as my boards are MBR). |
It depends how you define "existing", since this 0xEA has been in use for 2 years now 😅
For GPT, this specific partition type has a special flag for boot (I checked earlier with fdisk) and is likely important to keep functionality. Arch wiki says
|
We just need to change the (MBR-only) type back and be done with it for a while. Further changes should be carefully considered -- we've already lost capabilities that were result of hard labor and were removed in the interest of "keeping it simple". It's a thin line, but booting on exotic hardware is one of Armbian's strengths -- let's not throw that away. |
Keeping it simple/not too complex is important for maintainability in my opinion. But of course, throwing stuff away is also not so good. It's a thin line indeed and Armbian should always keep maintanability in balance. So far I've had multiple encounters of almost throwing the towel because some stuff was too complex and I had to spend hours just to understand/follow the current logic so that I could find a good way to implement a change. Newcomers often won't have the time or patience, so keeping the complexity in balance should not be underrated.
I believe this can at least sometimes be prevented by careful design considerations from the beginning, instead of just starting to implement something. Of course, this will take more time 😅 |
What happened?
Armbian build sets the boot partition as type 0xEA. This partition type is not standard in any specific distribution or operating system. As such Windows is unable to discover and mount the partition which makes it impossible to mount and modify the network config or other first boot configurations on Windows machines. After changing the partition type to either 0x0B or 0x0C, for DOS FAT32, the partition mounts correctly and is editable fine.
I haven't observed any side effects of doing so, u-boot seems to correctly discover and use these partitions regardless.
I tried tracking down this change and why it was set to 0xEA but found no definitive answer, it might very well be intentional and in that case, I'd like to know as to why.
How to reproduce?
N/A
Branch
main (main development branch)
On which host OS are you observing this problem?
Jammy
Relevant log URL
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: