Issue #123: Errors with NVMe on Compute Module 4. #147
Reference in New Issue
Block a user
No description provided.
Delete Branch "geerlingguy/123-nvme"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #123. Allows users to work with NVMe drives on the CM4.
Looks good to me, thank you!
@@ -577,3 +576,4 @@
if [[ $disk == *"mmcblk"* || $disk == *"nvme"* ]]
then
SD_slot_boot=1
disk=${disk:0:7}
Just a comment: I first thought this line will fail for nvme but it works fine 👍 . It works for nvme only as long as for /dev/nvme<x>n<y> x and y has only one digit. But that's a restriction also on the previous code which extracts the partition number.
Testing it on one of my Pis with eMMC boot and an NVMe drive:
Note that I was testing with an 8 TB NVMe drive, and it was only sized to 2 TB...
I just tested the PR on my CM4 with the 04-04 lite image. Boot from the cloned nvme works perfect 👍
Unfortunately my CM4 doesn't boot any more from nvme with later images. I created an issue on this.
I'm trying this on CM4 with eMMC storage and /dev/nvme0n1 and it fails despite the manual changes made to the rpi-clone file. I changed the 576 and 1060 line with the same OR condition, but without much luck. Pointers appreciated
pi@ant1:~ $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 29.1G 0 disk ├─mmcblk0p1 179:1 0 256M 0 part /boot └─mmcblk0p2 179:2 0 28.9G 0 part / mmcblk0boot0 179:32 0 4M 1 disk mmcblk0boot1 179:64 0 4M 1 disk nvme0n1 259:0 0 232.9G 0 disk ├─nvme0n1p1 259:1 0 256M 0 part └─nvme0n1p2 259:2 0 232.6G 0 part
Syncing file systems (can take a long time) Syncing mounted partitions: Mounting /dev/nvme0n12 on /mnt/clone mount: /mnt/clone: special device /dev/nvme0n12 does not exist. Mount failure of /dev/nvme0n12 on /mnt/clone. Aborting!
Why didn't you grab the file from @geerlingguy s PR instead of updating the file? I suggest to compare your modified rpi-clone version with the one in the PR or grab the file from the PR and test again. Just to make sure you use the PR code 😉 .
I have exactly the same config other than a smaller NVMe disk and it works for me.
Both methods the file from PR and manually editing the script produce the same error.
😢 Well, then a bash debug log may help. Just invoke the script with
sudo bash -x rpi-clone <your args>
and attach the debug log.Plot thickens:
CM4 Lite 4GB RAM + WiFi = clone successful
CM4 4GB RAM + eMMC + WiFi = clone fails. I'll get the logs in a sec
I suggest to invoke the
script
command first, thenlsblk
then invokesudo bash -x rpi-clone nvme0n1
and finallyexit
. You now have created a filetranscript
which is the debug log I'm asking for.Right, I'm even more confused.
sudo bash -x rpi-clone -l nvme0n1
works on both types of CM4 modules, whilesudo rpi-clone -l nvme0n1
did not work. Getting late so I'll collect the logs tomorrow and share my findings.@notenoughtech Any updates on your issue?
Hi, @framps
I'm sorry for the late response. Here is the log as requested:
Right.
Even more confused now as this all worked well and I finally have the boot from NVMe.
log.txt
Oh good 😳 ... you can attach a file in a comment - just use drag and drop 😉
Please clean up your huge comment ... nobody will ever read this 😢
So there is no need any more for the debug log 😄
I thought the code would auto collapse or something. I cleaned it up. Now let's see if this works with non eMMC CM4s
No matter how many times I try, the CM4 Lite is not liking the boot from nvme. rpi-clone worked on CM4 and change of boot from eMMC to NVMe was easy enough. Same EEPROM firmware on CM4 Lite and boot sequence on CM4 Lite and no dice after rpi-clone.
While cloning appears to be working, I don't think the boot partition is able to boot. Without SD card it hangs but hot swapping sd card, proves that boot sequence is working as the CM4 Lite boots from card a moment later without a reboot.
Anyone had this much problems?
I can also confirm that I still have the issue of
sudo rpi-clone -l nvme0n1
not working whilesudo bash -x rpi-clone nvme0n1
works fineI don't have a CM4 lite to test rpi-clone in this environment.
Not sure why you actually use rpi-clone. If you just clone the SD card image to NVMe to be able to boot from NVMe why don't you install the OS directly on NVMe instead to the SD card first and then clone the SD to NVMe? See this page how I install RaspbianOS directly on NVMe.
Why we use tools?
We both know working with rpi-clone is dead easy instead of messing about
with dd.
That's for why.
I could just flash the NVMe drives via CM4 as this worked, but the idea is
to get it working properly rather than hack it working.
What I don't understand why executing rpi-clone via bash works on CM4 but
failed when same file runs from the command line.
Mat Zolnierczyk
Maker, Robotics Engineer
Owner | NotEnoughTech
@.***
notenoughtech.com
Teesside, North Yorkshire, UK
[image: facebook] https://www.facebook.com/NotEnoughTECH/
[image: twitter] https://twitter.com/NotEnoughTECH
[image: linkedin] https://www.linkedin.com/in/mat-zolnierczyk/
[image: instagram] https://www.instagram.com/notenoughtech/
On Fri, Nov 4, 2022 at 6:48 PM framp @.***> wrote:
This requires further debugging I'm not able to assist. @billw2 may be able to help. But given his last commit is 2.5 years ago I doubt he will.
This patch is now maintained in my fork: https://github.com/geerlingguy/rpi-clone
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.