Error creating Encrypted SSD / Migrating

Hi, I added a SSD to my pocket.

/dev/nvme0n1

Creating the encrypted device with reform-setup-encrypted-nvme works fine, the migrationtool copies everything…

But the boot-selection tool is failing. I choose to install the boot partion to eMMC …

/dev/mmcblk0p1 doesn’t exit

Any hints?

2 Likes

I think /usr/share/reform-tools/machines/MNT Pocket Reform with i.MX8MP Module.conf is incorrect, it contains:

# name of devices in /dev
DEV_MMC="mmcblk0"
DEV_SD="mmcblk1"
DEV_SSD="nvme0n1"
DEV_USB="sda"

But on my machine EMMC is at mmcblk2 and when I pop in an SD card it ends up at mmcblk0. I don’t know how these device numbers are determined but “machine” file appears to be some static resource here so I guess editing it should work?

Hi,

I’m responsible for the /usr/share/reform-tools/machines/*.conf entries in the reform-tools package. I do not own a Pocket Reform though, so the data in that file might be false. Maybe a Pocket Reform owner can help correcting this information? It would help me if I could have the following information from a vanilla (without customizations) Pocket Reform:

  • The output of ls -lha /dev/mmcblk*
  • The output of findmnt

But on my machine EMMC is at mmcblk2 and when I pop in an SD card it ends up at mmcblk0.

If this is indeed true, then we should install a udev rule, so that the eMMC and SD-Card always end up as the same device independent of whether an SD-Card was present at boot or not.

I don’t know how these device numbers are determined but “machine” file appears to be some static resource) so I guess editing it should work?

If you edit files in /usr, they will be switched back to their original version on your next apt upgrade of reform-tools. Lets better fix this at the source.

Maybe @minute can give some authoritative information on the topic of device names on the Pocket Reform?

1 Like

I hope everything is still vanilla, but I think so…

ls -lha /dev/mmcblk*

brw-rw---- 1 root disk 179,   0 Jun  2 12:46 /dev/mmcblk2
brw-rw---- 1 root disk 179, 256 Jun  2 12:46 /dev/mmcblk2boot0
brw-rw---- 1 root disk 179, 512 Jun  2 12:46 /dev/mmcblk2boot1
brw-rw---- 1 root disk 179,   1 Jun  2 12:46 /dev/mmcblk2p1
brw-rw---- 1 root disk 179,   2 Jun  2 12:46 /dev/mmcblk2p2
crw------- 1 root root 240,   0 Jun  2 12:46 /dev/mmcblk2rpmb

findmt:

TARGET                           SOURCE    FSTYPE   OPTIONS
/                                /dev/mmcblk2p2
│                                          ext4     rw,relatime,errors=remount-ro
├─/sys                           sysfs     sysfs    rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security         securityfs
│ │                                        security rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup               cgroup2   cgroup2  rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_re
│ ├─/sys/fs/pstore               pstore    pstore   rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/bpf                  bpf       bpf      rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/tracing          tracefs   tracefs  rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/debug            debugfs   debugfs  rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/fuse/connections     fusectl   fusectl  rw,nosuid,nodev,noexec,relatime
│ └─/sys/kernel/config           configfs  configfs rw,nosuid,nodev,noexec,relatime
├─/proc                          proc      proc     rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc     systemd-1 autofs   rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxpro
│   └─/proc/sys/fs/binfmt_misc   binfmt_misc
│                                          binfmt_m rw,nosuid,nodev,noexec,relatime
├─/dev                           udev      devtmpfs rw,nosuid,relatime,size=3899244k,nr_inodes=974811,mo
│ ├─/dev/pts                     devpts    devpts   rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=00
│ ├─/dev/shm                     tmpfs     tmpfs    rw,nosuid,nodev,inode64
│ ├─/dev/hugepages               hugetlbfs hugetlbf rw,nosuid,nodev,relatime,pagesize=2M
│ └─/dev/mqueue                  mqueue    mqueue   rw,nosuid,nodev,noexec,relatime
├─/run                           tmpfs     tmpfs    rw,nosuid,nodev,noexec,relatime,size=810444k,mode=75
│ ├─/run/lock                    tmpfs     tmpfs    rw,nosuid,nodev,noexec,relatime,size=5120k,inode64
│ ├─/run/credentials/systemd-journald.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/credentials/systemd-udev-load-credentials.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/credentials/systemd-tmpfiles-setup-dev.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/credentials/systemd-sysctl.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/credentials/systemd-tmpfiles-setup-dev-early.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/credentials/systemd-tmpfiles-setup.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ ├─/run/user/1000               tmpfs     tmpfs    rw,nosuid,nodev,relatime,size=810440k,nr_inodes=2026
│ │ └─/run/user/1000/doc         portal    fuse.por rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ ├─/run/credentials/serial-getty@ttymxc1.service
│ │                              tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
│ └─/run/credentials/getty@tty1.service
│                                tmpfs     tmpfs    ro,nosuid,nodev,noexec,relatime,nosymfollow,size=102
├─/tmp                           tmpfs     tmpfs    rw,nosuid,nodev,size=4052220k,nr_inodes=1048576,inod
└─/boot                          /dev/mmcblk2p1
                                           ext4     rw,relatime,errors=remount-ro

Indeed, SD card on imx8mp is mmcblk0 and eMMC is mmcblk2. @josch The part about udev rule etc is not necessary, it is always like this. What they were meaning to say is that mmcblk0 is populated once an SD card is inserted. mmcblk2 is always there.

2 Likes

Thank you! The problem should be fixed in reform-tools 1.43 with this commit:

3 Likes

Just to be sure. can I migrate running from the emmc or do I have to boot from SD card?

According to your findmnt output, your system is on /dev/mmcblk2p2 which is eMMC. Your /boot is on /dev/mmcblk2p1, so also on eMMC. According to /usr/share/reform-tools/machines/MNT Pocket Reform with i.MX8MP Module.conf, the imx8mp cannot boot from SD-card. Where do you want to migrate to?

I have to nitpick: you can boot from MicroSD, via u-boot on eMMC. If you insert a MicroSD with the System Image, u-boot prefers it over the eMMC. But you can’t load u-boot from MicroSD.

I want my system on nvme and boot on emmc.

I know that you know this but this for anybody who might find this interesting: “booting from X” can mean multiple things. It can mean:

  1. boot u-boot from X (where you can flash u-boot)
  2. boot linux from X (where your /boot partition lives)
  3. boot a root filesystem from X (where your root filesystem lives)

All of these have different limitations. The first is limited by what the SoM is capable of, the second by what u-boot is capable of and the third by what Linux is capable of. In /usr/share/reform-tools/machines/MNT Pocket Reform with i.MX8MP Module.conf there is the entry SD_BOOT=false which talks about the first item. This is important for scripts like reform-flash-uboot which need to be able to distinguish where it’s allowed to flash u-boot to. I think Christoph might’ve talked about the third item when they asked whether they have to boot from SD card?

I want my system on nvme and boot on emmc.

Yes, this is possible. Do you your system on nvme be encrypted with LUKS?

1 Like

Yes, this is possible. Do you your system on nvme be encrypted with LUKS?

Yes :slight_smile: That is the plan. I want the system on an encrypted nvme

Then I think the script reform-setup-encrypted-nvme might be what you are looking for. It will set up luks on your nvme with lvm2 inside with a swap partition. You current system will be copied to the new root partition on nvme and at the end it will run reform-boot-config to configure the /boot partition on eMMC to load your system from nvme.

I successfully ran the script two weeks ago on the big Reform of debacle and would love to hear your feedback from the pocket reform.

I think it should be safe to test this once you have upgraded to reform-tools 1.43 (not yet released).

3 Likes

Thanks @josch!

Looking at the reform-setup-encrypted-nvme script, it also sets up swap and the resume kernel parameter to point to that, does that allow hibernating the machine? Because that would be very helpful because I can’t find a way to put it to sleep apart for shutting down. Can somebody confirm hibernating to SSD works?

I do not know of anybody having performed successful hibernation with the pocket reform. Though I think @minute said in the past that suspend should work.

If you want to experiment with either, please overwrite the contents of /usr/lib/systemd/sleep.conf.d/reform-sleep.conf by copying that file as /etc/systemd/sleep.conf.d/reform-sleep.conf and change its content to at least say:

[Sleep]
AllowSuspend=yes
AllowHibernation=yes
1 Like

Thanks. Then I will just wait a bit :slight_smile:

Is there an ETA on the release of reform-tools 1.43? It’s not like I’m running ‘apt update’ a couple times per day or anything… :slight_smile:

@minute just pressed the merge button :slight_smile:

2 Likes

1.43 is online. I migrated from emmc to nvme

I had to umount dev/mmcblk2p1, then the script runs fine.

But now the screen stays black after the reboot

Same here. Tried non encrypted on nvme (one partition with ext4 fs with root fs) too with the same effect. Screen stays black.