-
Notifications
You must be signed in to change notification settings - Fork 433
-
Notifications
You must be signed in to change notification settings - Fork 433
partition table conflicts when plugging SD card to newer ubuntu 15.04/14.04.2 kernel #262
Comments
This is obviously a bug that I ought to (attempt to) fix, but how critical is it? |
In my case, it is a very annoying bug: I always setup my Raspberry Pi "offline" because I use them headless and I never have a screen with me. Last time, I messed up the watchdog config over SSH (the rpi was basically always rebooting). The same kind of problem happened before with the network config. It is usually not a problem because I was expecting to be able to just change the config file from my linux box. So for now, I don't use NOOBS because being able to just mount the key on linux is a requirement. But I agree that it is a quite specific case and I can simply use dd. |
ah, it is a bug... i wouldn't say, it is a critical bug (in case, it will not corrupt the filesystem), |
It is written right after the MBR in the spare space between the MBR and the first partition. The way most flash storage works is that you cannot modify individual bytes. |
Thanks to the quirks of the MBR partitioning scheme, after NOOBS has done it's initial first-boot resizing, the MBR itself and the first partition never get modified. It's only files on the SETTINGS partition (mmcblk0p3) and all the logical partitions within the extended partition (mmcblk0p2) that get written to. I've not looked into this problem in detail yet, but I wonder if it could be considered a bug that (the kernel used by) Ubuntu is looking for an ADFS partition-table first, and ignoring the completely valid MBR at the start of the disk? I believe if the MBR was read first, it would/should simply skip over the location of the ADFS partition table (aka "RiscOS blob"). |
yes, i made a mistake by resolving the definition of RISCOS_BLOB_SECTOR_OFFSET my mistake was taking
but it is
so it will not corrupt the filesystem. |
...okay, I think I've managed to track down the 'culprit' ;-) As already (partially) mentioned, on a post-initial-boot NOOBS card, there's both an MBR partition table at bytes 1-512 inclusive, and an ADFS partition table at bytes 513-10240 inclusive (the 9728 bytes of In older versions of Ubuntu, running
shows:
And therefore the linux kernel ignores the ADFS table, and simply uses the MBR table (and all the regular partitions on your NOOBS card can be seen / mounted). However in newer versions of Ubuntu, the same grep command shows:
And as the comment at https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/block/partitions/check.c#n56 explains, the kernel partition-checking code looks for the Acorn partition table before looking for the msdos (MBR) partition table. Hence the cause of the problem as initially reported :-S As both partition tables are equally valid, and RISCOS is unable to boot without the ADFS partition table, there's nothing that can be done from within NOOBS to fix this. So closing this for now as "wontfix". However as a workaround you could either recompile your Ubuntu kernel to not include the ADFS / CUMANA options, or you could 'manually zero' the ADFS partition table with: As always, you need to be very careful what you're typing when using To check what's currently in the "ADFS area" of your SD card, run: Even though I'm closing this bug, feel free to add additional comments or questions. And if you feel like pointing your forum threads and launchpad bug-report back to here, that'd be great :) |
ok, no, i understand... then let it be like it is. i read also that it seems, that adfs/cumana is also in newer updated Debian 8 kernels enabled... i know, it is a debian/ubuntu question - but hopefully you can help as well. ... thank you anyhow, for taking time to looking at. |
CONFIG_ACORN_PARTITION_CUMANA=y means is is compiled in the kernel, and not as a module, so there is no way you can blacklist it... Anyway, good to know and to keep this bug as reference as it will avoid some headache to ubuntu/debian users. |
Yup, and those config options are both boolean (yes/no) and not tristate (yes/no/module) http://cateee.net/lkddb/web-lkddb/ACORN_PARTITION_CUMANA.html And I also just found this bug-report which has the same symptom, but a different cause. So goodness knows why Ubuntu has now decided to enable this kernel option by default... :-( |
I wanted to thank you, lurch, for the throughout explanation and workaround. Also, for finding the time to write about it. But if I may, I would strongly suggest looking into this and perhaps finding a solution to the problem without the use of command line partition byte jumping and partition zeroing which goes way beyond the regular or novice RPi user which NOOBS is aimed for (not even talking about kernel re-compiling). As this seems to me as a very, very common error and I'm sure a lot more people don't even write about it. I basically tried everything I got my hands on over the night to get it working / figure out the problem, but only this worked (perfectly even). I was now dressed up to go and return the MicroSD card as I came to the conclusion that it's malfunctioned (so I didn't even think to try a different image). Perhaps the RiscOS partition table is not necessary if it's not chosen to be installed? |
To conclude, this was more than a mouthful as I am trying to make a new kiosk start-up (reinstalled NOOBS 3 times because I wasn't able to fix or uncomment something in the xinitrc file). Right now I'm about to drink some whiskey, because I was up till 6 AM. |
Technically the RISC OS partition table isn't necessary if RISC OS isn't chosen to be installed; but as @maxnet explained earlier, writing the RISC OS partition table only if the user chooses to install it could risk corrupting the MBR, which is why it's only written to the card once (during the NOOBS first setup), to minimise the risk of "breaking" peoples' NOOBS setups. I don't want to sound arrogant, but as I explained here IMHO it's a bug that the Linux kernels included by more recent versions of Ubuntu have the Acorn partition-detection options enabled :-/ |
According to ff40607 NOOBS "now does rewrite the MBR", so presumably SD-corruption concerns are now a thing of the past, and theoretically future versions of NOOBS could be modified to only write the |
Yes, it would be possible to remove riscos-boot.bin from the NOOBS distribution, and move writing it to the post-installation script instead. Still not a full solution though, given that this issue would still occur if RiscOS is installed or once was. |
It's just occurred to me that that would also allow extra flexibility, and remove the need for code like Line 365 in bc6dc9e
riscos-boot.bin would then be "part of RiscOS" and update-able independently, rather than hard-baked into NOOBS).
I was once told by the RISC OS team that that was indeed on the cards, but I guess that project must have been shelved. But given what e.g. http://lkml.iu.edu/hypermail/linux/kernel/0501.2/0543.html says, I still find it bonkers that Ubuntu have enabled the |
Yes.
There does seems to be a 2.5k bounty for any developer willing to implement it: https://www.riscosopen.org/bounty/polls/10 |
I think this is causing one of my OS's not to work in NOOBS NOOBS 1.5 uname -r 3.12.26-quick ls /dev/mmcblk* /dev/mmcblk0 /dev/mmcblk0p2 /dev/mmcblk0p6 dmesg [ 1.016044] mmc0: no vqmmc regulator found /etc/fstab /dev/mmcblk0p7 / ext2 rw,noauto 0 1 fdisk /dev/mmcblk0 -l /dev/mmcblk0p1 129 9705 306451 e Win95 FAT16 (LBA) As you can see, Partion 8 is completely skipped. I need to package it up with NOOBs, so can't ship an image file with the DD "fix" applied. Any ideas on how to fix? |
Unrelated issue.
Recompile the kernel used by your Linux distribution with a higher CONFIG_MMC_BLOCK_MINORS kernel option to get mmcblk0 devices beyond p7. |
Yes I think i have the exact same issue. It also came out of nowhere and nobody tells you this. And simple ubuntu users (who decide for the good, not for the worse win10) will have the same problem. And I'd have no idea if lurch did not point me to this issue. There should be a way to fix this, since even people on the raspi irc did not know about this. And its hard to google such an issue. Since its caused by noobs, but its not obvious. And for even more confusing I think the other sd card really broke while playing with noobs (too many writes, not caused actually by noobs). And if you dont fix this, please add a big mark to the readme as "known bug" or so. Please. |
Without wanting to get into a 'blame game' IMHO the bug is caused by Ubuntu, not NOOBS. But yes, as the newer versions of Ubuntu (with their enabled-by-default |
Re-opening issue to remind myself to update README.md |
Can't we just blank the risc partition table if it is not used within the installation? Edit: |
Originally we couldn't, because the NOOBS 'prime directive' was to never write to the first partition (or MBR) in order to minimise the risk of data-corruption leading to a non-bootable SD card - see #262 (comment) But for NOOBS v1.5 this has changed, so it might be possible in future to change this behaviour - see #262 (comment) |
We should probably also add a bit of offset in the recovery partition (just a few, lets say 16-64mb) to make debugging and further developing easier. A few mb wont hurt anyone. |
Feel free to do that in your own fork of NOOBS, but that's a feature that won't be added to standard NOOBS. (again, because NOOBS is designed so that nothing ever writes to the first partition) |
according problems
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=111131
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=105437
with plugging a NOOBS sd card to a newer ubuntu (debian) desktop PC/Laptop
i reported an issue report to ubuntu team
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1457526
and the problem seems to be the combination of existence of MSDOS partitiontable and RISCOS (partitiontable?) at the same time on the SD card.
i was looking into the code of NOOBS 1.4 and the RsicOS blob (the content of the file "riscos-boot.bin") will always be written to the SD card, even if it is not needed, because there is no RiscOS in the list of installed OS'es...
the newer kernel of ubuntu will catch that RiscOS blob/partitiontable first and mess up the detection of msdos partition tables...
do you see any chance to change that partition 'casino'?
is the RiscOS blob used for something else than a RISC OS, when it is installed?
maybe then only write the RiscOS blob to the SD card, if somebody installs a RISC OS, and elsewise fill the region with zeros.
what i was testing was,
i filled up the "riscos-boot.bin" file with zeros and forced with 'runinstaller' in cmdline recreation of partitions,
so the function InitDriveThread::writeRiscOSblob() will write only zeros to the SD card...
and that solved the problem of detecting the msdos partition table under newer ubuntu.
but it was only to be sure, that it is really the RiscOS blob.
with zeroing out riscos-boot.bin
with normal riscos-boot.bin
The text was updated successfully, but these errors were encountered: