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

issue with eMMC #844

Open
cowboyai opened this issue Oct 22, 2024 · 5 comments
Open

issue with eMMC #844

cowboyai opened this issue Oct 22, 2024 · 5 comments
Labels
question Not a bug or issue, but a question asking for help or information

Comments

@cowboyai
Copy link

I have eMMC Booting, as in it boots and starts Stage 1, but fails to mount /dev/disk/by-partlabel/disk-sysboot-root
when targetting /dev/mmcblk0

if I target /dev/sda and put it on a usb, it works fine and boots correctly.

I have verified I am booting the correct device because I pull out the usb and it has to be booting from emmc.
I am deploying via nixos-anywhere with a disko configuration.

Here is my config:

{
  # This file is ONLY the system drive
  # NAS Settings are in disko-nas.nix

  # eMMC boots here, not the boot0/1 partitions, but we do need initial mbr offset for it to boot correctly, otherwise /boot doesn't mount either
   disko.devices = {
    disk = {
      # the bootable drive...
      sysboot = {
        # this is the emmc device
        device = "/dev/mmcblk0";
        type = "disk";
        content = {
          type = "gpt";
          partitions = {
            MBR = {
              type = "EF02"; # for MBR
              size = "1M";
              priority = 1; # Needs to be first partition
            };
            ESP = {
              type = "EF00";
              size = "500M";
              content = {
                type = "filesystem";
                format = "vfat";
                mountOptions = [ "umask=0077" ]; # make it NOT world readable
                mountpoint = "/boot";
              };
            };

            root = {
              size = "100%";
              content = {
                type = "filesystem";
                format = "ext4";
                mountpoint = "/";
              };
            };
          };
        };
      };
    };
  };
}

full configs are available at: https://github.com/TheCowboyAI/nixos-flashstor

Am I not setting something correctly for eMMC? as I understand, getting the offset right to initiate boot was the only difference.

@cowboyai cowboyai changed the title isue with eMMC issue with eMMC Oct 22, 2024
@iFreilicht
Copy link
Contributor

What's the error message?

@iFreilicht iFreilicht added the question Not a bug or issue, but a question asking for help or information label Oct 22, 2024
@cowboyai
Copy link
Author

waiting for device /dev/disk/by-partlabel/disk-sysboot-root to appear.........
Timed out waiting for device /dev/disk/by-partlabel/disk-sysboot-root
trying anyway....
mounting /dev/disk/by-partlabel/disk-sysboot-root on / ...
/dev/disk/by-partlabel/disk-sysboot-root: can't lookup block device

@cowboyai
Copy link
Author

is this helpful?

from writing to the eMMC with nixos-anywhere output:

/dev/mmcblk0: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/mmcblk0: 8 bytes were erased at offset 0x1d1fffe00 (gpt): 45 46 49 20 50 41 52 54
/dev/mmcblk0: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
+ dd if=/dev/zero of=/dev/mmcblk0 bs=440 count=1
Scudo ERROR: invalid alignment requested in aligned_alloc: 4096, alignment must be a power of two and the requested size 0x1b8 must be a multiple of alignment
++ realpath /dev/nvme0n1
+ disk=/dev/nvme0n1
+ lsblk -a -f

@cowboyai
Copy link
Author

full log, these are the only errors I see are alignment errors
deploy-emmc-20241022-152917.txt

@iFreilicht
Copy link
Contributor

So the installation logs look good. These alignment errors are a little suspicious, not sure where the weird blocksize of 440 bytes is coming from, but probably not the root of the issue.

I'm also suspicious of the size of the MBR partition, maybe the small size causes the alignment issues?

Does Linux offer you to enter a rescue prompt after failing to boot? If so, can you enter it and check the presence of the eMMC device and its by-partlabel symlinks?

I'm also wondering if you maybe have to add additional drivers at boot for eMMC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug or issue, but a question asking for help or information
Projects
None yet
Development

No branches or pull requests

2 participants