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

Error with NVME on RPi Compute Module 4 #123

Open
rubberychicken opened this issue Jul 6, 2021 · 14 comments · May be fixed by #147
Open

Error with NVME on RPi Compute Module 4 #123

rubberychicken opened this issue Jul 6, 2021 · 14 comments · May be fixed by #147

Comments

@rubberychicken
Copy link

Hi,

I am getting this when trying to close to a NVME SSD:

pi@raspberrypi:~ $ sudo sys-clone nvme0n1 -f2

Target disk nvme0n1 ends with a digit so may be a partition.
sys-clone requires disk names like 'sda' and not partition names like 'sda1'.

Continue anyway? (yes/no): yes

Booted disk: mmcblk0 31.9GB Destination disk: nvme0n1 256.1GB

Part Size FS Label Part Size FS Label
1 /boot 256.0M fat32 -- 1 256.0M fat32 --
2 root 29.5G ext4 rootfs 2 238.2G -- --

== Initialize: IMAGE partition table - forced by option ==
1 /boot (48.0M used) : MKFS SYNC to nvme0n11
2 root (1.8G used) : RESIZE MKFS SYNC to nvme0n12

-f2 : force initialize to first two partitions only.
Run setup script : no.

Verbose mode : no.
** WARNING ** : All destination disk nvme0n1 data will be overwritten!
-----------------------:

Initialize and clone to the destination disk nvme0n1? (yes/no): yes
Optional destination ext type file system label (16 chars max): gateway

Initializing
Imaging past partition 1 start.
=> dd if=/dev/mmcblk0 of=/dev/nvme0n1 bs=1M count=8 ...
Resizing destination disk last partition ...
Resize success.
Changing destination Disk ID ...
=> mkfs -t vfat -F 32 /dev/nvme0n11 ...
=> mkfs -t ext4 -L gateway /dev/nvme0n12 ...

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!

@mike-pisman
Copy link

mike-pisman commented Aug 16, 2021

Hi, I have the same issue. Have you found the solution?

Hardware: RPI CM4 (no wifi/ no mmc) + RPI IO Board, Samsung EVO 980, pci-m.2 adapter that is tested. I already managed to install and boot Raspbian 32 bit from NVMe; However, I am struggling to install Ubuntu Sever 64 bit in a similar fashion. I have tried "SD Copier" and "dd" but I could not boot, now I want to see if rpi-clone can do any different, but run into this issue...

ubuntu@ubuntu:~$ sudo rpi-clone nvme0n1

  Target disk nvme0n1 ends with a digit so may be a partition.
  rpi-clone requires disk names like 'sda' and not partition names like 'sda1'.

Continue anyway?  (yes/no): yes

Booted disk: mmcblk0 8.1GB                 Destination disk: nvme0n1 500.1GB
---------------------------------------------------------------------------
Part               Size    FS     Label           Part   Size  FS  Label
1 /boot/firmware   256.0M  fat32  --
2 root               7.3G  ext4   writable
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - partition number mismatch: 2 -> 0 ==
1 /boot/firmware      (126.0M used)  : MKFS  SYNC to nvme0n11
2 root                (3.3G used)    : RESIZE  MKFS  SYNC to nvme0n12
---------------------------------------------------------------------------
Run setup script       : no.
Verbose mode           : no.
-----------------------:
** WARNING **          : All destination disk nvme0n1 data will be overwritten!
-----------------------:

Initialize and clone to the destination disk nvme0n1?  (yes/no): yes
Optional destination ext type file system label (16 chars max): NVME-EXT

Initializing
  Imaging past partition 1 start.
  => dd if=/dev/mmcblk0 of=/dev/nvme0n1 bs=1M count=5 ...
  Resizing destination disk last partition ...
    Resize success.
  Changing destination Disk ID ...
  => mkfs -t vfat -F 32  /dev/nvme0n11 ...
  => mkfs -t ext4 -L NVME-EXT /dev/nvme0n12 ...

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!

@psistwu
Copy link

psistwu commented Aug 27, 2021

I think I have a solution to this issue. Here I highlight some lines of the return message of rpi-clone:

....

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.
Abouting!

The message above indicates that rpi-clone does not generate correct partition names for NVMe drive, which should be /dev/nvme0n1p1 and /dev/nvme0n1p2. In such a case, one can try the following modification in rpi-clone:

# begin at line 1060
if [[ ${chk_disk: -1} =~ ^[0-9]$ ]]
then
	if [[ $dst_disk == *"mmcblk"* || $dst_disk == *"nvme"* ]]    # update this line
	then
		SD_slot_dst=1
                ....

Unfortunately, I do not have an NVMe drive by my hand so that I cannot really test it. Can somebody verify if the solution works?

Beware that even the solution above works, it is not a rigorous one. If anyone can improve the solution, it will be much appreciated.

@psistwu
Copy link

psistwu commented Sep 4, 2021

[Update]
Finally, I had my solution tested with the following configuration:

  • Hardware: Waveshare Mini Base Board (A) + rpi compute module 4 lite (2Gb ram w/o wifi) + WD SN530 256GB
  • System: Manjaro-ARM-minimal-rpi4-21.08

With the correction, everything works quite well. I can now boot my rpi with NVMe drive.

@NajibNour
Copy link

NajibNour commented Nov 5, 2021

Hey hey! Im facing a similar issue. Im coping over from source "nvme0n1" to a "sda". The error I receive is "Error: Could not stat device /dev/nvme0n1p - No such file or directory." Seems like its messing up the partition names and moving "p1" to "1p". Could this be the same fix but for the source drive?

lsblk output:

sda           8:0    0 465.8G  0 disk 
└─sda1        8:1    0 465.8G  0 part 
nvme0n1     259:0    0 465.8G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 465.3G  0 part /

@psistwu
Copy link

psistwu commented Nov 12, 2021

I guess you can try to modify line 571--584 of rpi-clone using similar approach.

@NajibNour
Copy link

Yes this is exactly what i ended up doing! Had some issues with UUID's as this is on a ubuntu server but ended up resolving that with the following:
Then you have to edit "/etc/fstab" on the right volume with gedit, nano or else.

In a terminal, type:

sudo vim /mnt/clone/etc/fstab
and replace the old UUIDs by the new ones.

WARNING : Modifying "/boot/grub/grub.cfg" is very tricky. It should normally be generated with the command sudo update-grub.

Replace the old UUIDs by the new ones in "/boot/grub/grub.cfg" by entering the following in a terminal :

sudo vim /mnt/clone/boot/grub/grub.cfg

:%s/OLDUUID/NEWUUID/gc

If you use the tricky solution, I recommend you to launch sudo update-grub once you have successfully booted the system.

@mgrouch
Copy link

mgrouch commented Dec 21, 2021

@psistwu

[Update] Finally, I had my solution tested with the following configuration:

* Hardware: Waveshare Mini Base Board (A) + rpi compute module 4 lite (2Gb ram w/o wifi) + WD SN530 256GB

* System: Manjaro-ARM-minimal-rpi4-21.08

With the correction, everything works quite well. I can now boot my rpi with NVMe drive.

I did the same with raspberry pi buster. It copied file systems fine. But it doesn't boot from NVMe.
All up to date raspberry pi OS (armhf buster) and firmware.

Thanks

@psistwu
Copy link

psistwu commented Jan 1, 2022

@mgrouch
What is your hardware configuration?

Also, did you change the boot order with usbboot? You may refer to the following YouTube video for the detail.
https://youtu.be/4Womn10v71s

@mgrouch
Copy link

mgrouch commented Jan 1, 2022

@psistwu
CM4 with McuZone board.

@chaisaeng
Copy link

I think I have a solution to this issue. Here I highlight some lines of the return message of rpi-clone:

....

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.
Abouting!

The message above indicates that rpi-clone does not generate correct partition names for NVMe drive, which should be /dev/nvme0n1p1 and /dev/nvme0n1p2. In such a case, one can try the following modification in rpi-clone:

# begin at line 1060
if [[ ${chk_disk: -1} =~ ^[0-9]$ ]]
then
	if [[ $dst_disk == *"mmcblk"* || $dst_disk == *"nvme"* ]]    # update this line
	then
		SD_slot_dst=1
                ....

Unfortunately, I do not have an NVMe drive by my hand so that I cannot really test it. Can somebody verify if the solution works?

Beware that even the solution above works, it is not a rigorous one. If anyone can improve the solution, it will be much appreciated.

Your Solution is absolutely correct.

geerlingguy added a commit to geerlingguy/rpi-clone that referenced this issue Sep 21, 2022
@geerlingguy geerlingguy linked a pull request Sep 21, 2022 that will close this issue
@geerlingguy
Copy link

Opened a PR with the two changes discussed above: #147

@jaballarin
Copy link

Hey hey! Im facing a similar issue. Im coping over from source "nvme0n1" to a "sda". The error I receive is "Error: Could not stat device /dev/nvme0n1p - No such file or directory." Seems like its messing up the partition names and moving "p1" to "1p". Could this be the same fix but for the source drive?

lsblk output:

sda           8:0    0 465.8G  0 disk 
└─sda1        8:1    0 465.8G  0 part 
nvme0n1     259:0    0 465.8G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 465.3G  0 part /

I have the same configuration:
sda 8:0 0 465.8G 0 disk
└─sda1 8:1 0 465.8G 0 part
nvme0n1 259:0 0 465.8G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
└─nvme0n1p2 259:2 0 465.3G 0 part /

and it gives me the same error:
"Error: Could not stat device /dev/nvme0n1p - No such file or directory."
I have tried to edit the /mnt/clone/etc/fstab file, but I can't find it.

@framps
Copy link

framps commented May 4, 2024

This repository is no longer maintained. Please head over to this repository and make sure you use the latest code from there.

@jaballarin
Copy link

This repository is no longer maintained. Please head over to this repository and make sure you use the latest code from there.

Thanks a lot!

I will do so.
Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants