Sometimes eMMC losses the partition table after a hard power cycle.

Options
dhu
dhu New Member Posts: 23
I have Up Board 4G/32G variant installed with SuSE Linux distribution. It is in working condition and stable condition. After a hard power cycle (plugging off/on power supply ) the partition table is lost. I needed to re-install the again. I could not recover it since the partition were lost.
Does any one face similar issue?

Comments

  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Options
    Are you sure that the partition table was lost? What was the exact symptom of your issue?
  • dhu
    dhu New Member Posts: 23
    Options
    This is the scenario:
    - The Up Board 4G/32G is up and running. Its running SuSE Linux 12 kerenl 4.4.21.
    - I plug out the power-supply cable from the UpBoard. The board is now completely power-off.
    - After 1-2 day I power-up the board again. It enters the UpBoard BIOS.
    - In the BIOS it does not see SuSE Linux OS in boot option. The eMMC is visible in the South Bridge.
    - I used a bootable usb to fix the issue. I see only mmcblkboot0/1 partition. No OS partition/information is visible.
    - I had to install the OS again.

    The issue is it not easily reproducible. I noticed only when you do hard power cycle this issue comes up once in a while.
    I am working with UpBoard from Oct 2016 and this issue happened twice where it boot in the BIOS.
  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Options
    Ah ok. If you're not seeing partitions on /dev/mmcblk0 when you checked from the bootable USB stick, then I guess they're gone alright. :-(

    The reason I ask is because we have sometimes seen an issue where some BIOS EFI variables get reset (similar to what would happen if the RTC battery was unplugged), and one of those variables contains the boot sequence for the BIOS that would have probably been set when the OS was installed. Without this boot sequence information, the BIOS may not find your EFI bootloader. The boot sequence information can be manually restored in that case. So I was wondering if it might be that issue, but it seems not.
  • dhu
    dhu New Member Posts: 23
    Options
    The other issue I know when the RTC battery is removed you need to manually load the kernel for booting up the system.
    This issue is different. I dont for some reason if a proper shutdown procedure is not followed the partition table are lost.
    I found something similar on here but this is for tablet with eMMC Card.
    https://techtablets.com/forum/topic/please-help-tbook-10-missing-emmc-problem/
    "
    Finally I figured it out that the problem with missing eMMC is semi hardware/software issue.
    The main reason is incorrect behavior of so-called MMC sdhci-acpi host controller driver (kernel: drivers/mmc/host/sdhci-acpi.c)
    MMC host controller serves as an operating buffer between NAND flash and host processor. Sometimes it happens that it ‘sticks’ in incorrect state and that results in incorrect I/O operations.
    In the very case with Tbook 10 it gives incorrect output information about phisical size of NAND flash to BIOS when the system starts up. It gives to BIOS NAND flash physical size as big as 8GB of unallocated memory instead of 64GB and also makes impossible for eMMC to be correctly recognized by BIOS.
    That’s why:
    – UEFI can’t detect eMMC
    – map -r in EFI Shell doesn’t show any mmcblk acpi device
    – when You try to install original (not costomized) Windows 10 from WINPE bootable USB it shows You only 8GB of unallocated memory
    This problem was recognized by Intel with its BayTrail platform and now with CherryTrail platform.
    But the situation isn’t so bad as it seems. There are several methods to get MMC Controller back to the normal state.
    The are soft reset and hard reset methods. To speak about soft reset methods they all about kernel programming and there are many patches but I am not familiar with kernel at all.
    So I kindly ask someone with appropriate knowledge to advise me how to hard/soft reset MMC Interface Controller.
    "
    In my case I was able to reinstall the OS and it worked normal.

    Secondly this issue is not always it happens at randomly.
  • dhu
    dhu New Member Posts: 23
    Options
    I have figured out the solution and tested it. It worked for me.I am using a customized BIOS without the RTC battery and it worked perfectly fine.
    You need to use mmc utils tool from google.
    https://kernel.googlesource.com/pub/scm/linux/kernel/git/cjb/mmc-utils/
    After tool is installed you can block protect the /boot or /boot/efi partition and the UpBoard does not lose partition table.
    You can use the mmc --help command to uses of the tool. The command is used is for enable/read/info.

    mmc blockprotect enable -p /dev/mmcblk0 58722304

    Here is permanently enable block protect started from 58722304 block until 58738687 (58722304 + 16383).

    mmc blockprotect read /dev/mmcblk0 58722304
    Sector 58722304 write protection: PERMANENT

    mmc blockprotect read /dev/mmcblk0 58738687
    Sector 58738688 write protection: PERMANENT

    mmc blockprotect info /dev/mmcblk0
    Write protect block size in sectors: 16384
    Permanent write protection: allowed
    Power-on write protection: allowed
    16834: These sector means when the command is executed once
  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Options
    dhu, that's excellent news! Thanks for sharing that update.