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

Raspberry Pi 5 OS - Impossible to boot #44

Open
kikaragyozov opened this issue Sep 18, 2024 · 40 comments
Open

Raspberry Pi 5 OS - Impossible to boot #44

kikaragyozov opened this issue Sep 18, 2024 · 40 comments

Comments

@kikaragyozov
Copy link

kikaragyozov commented Sep 18, 2024

I'm trying to ditch my current SD card and switch entirely to a portable SSD connected via USB.

Things I did:

  1. Deleted all partitions on my SSD.
  2. Manually created partitions equal to the ones on my SD card, with minimum space matching the ones on the SD card:
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS           FSTYPE UUID                                 PARTUUID                             LABEL
sda           8:0    0 931.5G  0 disk
├─sda1        8:1    0   512M  0 part /media/pi/FF61-CD85   vfat   FF61-CD85                            deb0b539-01
└─sda2        8:2    0   931G  0 part /media/pi/Extreme Pro ext4   335884ab-a981-4e26-a064-d61879180b66 deb0b539-02                          Extreme Pro
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0   512M  0 part /boot/firmware        vfat   D735-E67D                            41d867f7-01                          bootfs
└─mmcblk0p2 179:2    0  14.4G  0 part /                     ext4   b69628b0-b5d6-474c-9bed-477305ae01ad 41d867f7-02                          rootfs
  1. Ran sudo rpi-clone sda
  2. Process completed successfully.
  3. Used raspi-config to change boot order to USB.
  4. Realized I should have done this before cloning/syncing.
  5. Restarted device.
  6. Ran again sudo rpi-clone sda without literally doing anything else.
  7. Process completed successfully.
  8. Shut down Raspberry Pi.
  9. Setup failed to boot into SSD, and as a fallback it booted into my SD card.
  10. Verified via an HDMI cable connection that the issue for not booting into the SSD (with an unplugged SD card) was due to a unable to read partition as FAT (partition 0) error.

I'm at a complete loss. Any help would be appreciated. I verified fstab entries - they seem to be correct. PARTUUIDS match with the ones specified there. I'm really not sure what's going on.

Fstab file:

proc            /proc           proc    defaults          0       0
PARTUUID=deb0b539-01  /boot/firmware  vfat    defaults          0       2
PARTUUID=deb0b539-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
@kikaragyozov
Copy link
Author

I've solved my issue by utilizing the built-in SD copier. Still no clue what went wrong with rpi-clone.

@wboerhout
Copy link

same issue here. rpi-clone works on bookworm an all my raspberries (running the prescribed Debian), but boot fails on the one Raspberry Pi 5.

@framps
Copy link

framps commented Nov 27, 2024

all my raspberries

Do you also have a RPi4 and tried to clone a SD card to nmve?

I unfortunately don't own a RPi5 and cannot try to reproduce your issue. But it sounds to me it's not related to RPi4 but to clone an SD card to a nvme drive. If I'm right the same scenario will fail if you use a RPi4. Would be great if you can double check with a RPi4.

@wboerhout
Copy link

wboerhout commented Nov 27, 2024 via email

@wboerhout
Copy link

RPi 4 works fine with the new Sandisk (not Samsung, sorry) USB 3.2 SDCZ430 drives

@framps
Copy link

framps commented Nov 27, 2024

Did you test the ssd to nvme move with RPi4? If it fails I'm able to try to reproduce the issue because I have a RPi4 with nvme storage.

@wboerhout
Copy link

As I said, I have no NVME. I have a Kingston SSD on a USB 3 adapter as source (the Debian system I'm running rpi-clone on, and a Sandisk USB 3.2 USB stick as target. This setup runs fine on RPi4 bookworm (i.e., rpi-clone runs error free and new target will boot the copy)

On Rpi 5, rpi-clone runs error free as well, but the target disk is stuck early in the boot cycle (in a state where I cannot find a log from), but the on screen messages suggest that (the copy of) partition 1 is not bootable for some reason

@framps
Copy link

framps commented Nov 27, 2024

rpi-clone unfortunately misses logging which makes it - at least for me who has no RPi5 - impossible to recreate and debug your issue :-(

Crossing fingers somebody else owns a RPi5 and can recreate and debug your issue.

If you're willing to donate to get me to buy a RPi5 - please see this page

@wboerhout
Copy link

I will think about it. I really appreciate the work you are doing.

@framps
Copy link

framps commented Nov 28, 2024

I got a donation from @geerlingguy (Thank you very much!!!) and just ordered a RPi5 which will arrive next week.

No NVMe hat and SSD but I expect your issue is not nvme related and I can reproduce your issue when I clone the SD card to an USB disk attached via USB.

@geerlingguy I tried to contact you on X but you don't accept any PN 😢

@geerlingguy
Copy link
Owner

@framps - Odd! What's your X username? I thought I had DMs open but I guess not!

@framps
Copy link

framps commented Nov 29, 2024

I just checked my DM settings and it was disabled. It's obviously the default setting. My username is @linuxframp.

@wboerhout
Copy link

OK this is the issue more documented. Same process works fine on all Rpi execept Rpi5

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0    92M  1 loop /snap/core/17201
loop1    7:1    0    20K  1 loop /snap/hello-world/29
sda      8:0    0 111,8G  0 disk
├─sda1   8:1    0   512M  0 part /boot/firmware
└─sda2   8:2    0 111,3G  0 part /
sdb      8:16   1  57,3G  0 disk
├─sdb1   8:17   1   512M  0 part
└─sdb2   8:18   1  56,8G  0 part

sda is my Kingston SATA SSD connected via a SATA/USB adapter to the bottom USB-3 port on the Rpi 5. This is my usual boot setup.
sdb is the new SanDisk Ultra Fit USB 3.2 Flash Drive and the target for rpi-clone and it is in the top USB-3 port.

Now sudo rpi-clone -f sdb works without errors, and upon manual inspection, all files seem to be in place. However, booting the new disk fails. See the attached screenshot (literally, with a camera) of what happens. The Rpi 5 keeps trying and the last few lines reappear in what seems to be an endless loop.

IMG_7176

@framps
Copy link

framps commented Nov 29, 2024

Which OS do you use? Please show the output of cat /etc-os-release and uname -a.

@wboerhout
Copy link

pi@raspi5 ~ $ cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

pi@raspi5 ~ $ uname -a

Linux raspi5 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux

@framps
Copy link

framps commented Nov 29, 2024

Ok. Thx. Now I wait for my RPi5 which should arrive mid next week to reproduce and debug this issue 😃

@wboerhout
Copy link

since I suspect that it is maybe related to the USB device itself, I include the following info:

pi@raspi5 ~ $ lsusb

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

pi@raspi5 ~ $ sudo lsusb -D /dev/bus/usb/004/002

Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.20
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         9
  idVendor           0x0781 SanDisk Corp.
  idProduct          0x5583 Ultra Fit
  bcdDevice            1.00
  iManufacturer           1  USB
  iProduct                2  SanDisk 3.2Gen1
  iSerial                 3 00023808042724041242
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               3
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               3
        MaxStreams              4
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams              4
        Data-out pipe (0x04)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               3
        MaxStreams              4
        Status pipe (0x02)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      HIRD Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat         256 micro seconds
Device Status:     0x0000
  (Bus Powered)

@framps
Copy link

framps commented Nov 29, 2024

since I suspect that it is maybe related to the USB device

I frankly don't think it's related to the USB device.

I got a PN in the German Raspberry forum where somebody told me rpi-clone doesn't work for him on a RPi5. Given I don't own a RPi5 .. will own one next week - I wasn't able to help him. He tried to clone form SD card to SD card on an USB adapter. I think there is some basic issue with RPi5 - but I frankly have no idea what's the root cause. I have to recreate the issue on a RPi5 next week.

Did you try another USB device?

@wboerhout
Copy link

I am sorry :-) to report that the issue has disappeared. Frankly, I have no idea why. The clone will now boot successfully.

Even with me, the problem sometimes seems to be located between the chair and the keyboard.

I am happy to assist in further troubleshooting

@framps
Copy link

framps commented Nov 30, 2024

NP.

I recently suggested a user in the German Raspberry forum to use rpi-clone to create a clone of his SD card he runs on a RPi5. He also mentioned the cloned SD card didn't boot. Then he executed rpi-clone a second time without option -f or -f2 and then the clone booted. Because I don't have a RPi5 I didn't start to debug the issue. Maybe that's what you also did.

So there seems to be an issue with RPi5 and I will try to reproduce and then debug the issiue when I have my RPi5.

@wboerhout
Copy link

wboerhout commented Nov 30, 2024

Possibly yes. It failed a few days ago, but several times. Then this morning, it suddenly went ok.

There may have been a (kernel header?) update in between.

@framps
Copy link

framps commented Nov 30, 2024

When I came back home today I detected my RPi5 and the required power supply was delivered today even it was anounced to be delivered next week 😃 So I started immediately to try to reproduce your issue.

I was able to reproduce it twice - but now I'm not able to reproduce it any more to debug the issue 😢 Looks like there is some race condition involved.

I have no issue on my RPi4 and so I compared the kernel used on RPi4 and RPi5 :

Linux raspberrypi-bookworm64-lite-rpi5 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux
and
Linux asterix 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

Not sure whether there is something different in the kernel which causes the issue.

I noticed the mount update messages - not sure whether they cause the issue.

At least I think there is a temporary workaround available: Execute rpi-clone a second time without option -f or -f2. I know that's inconvenient and has to be fixed, But a race condition is difficult to fix 😢

@wboerhout
Copy link

For now, I can live with it. Thanks for your support!

@framps
Copy link

framps commented Dec 1, 2024

I think I'm one step further. I was able to recreate the issue and detected when rpi-clone finished /boot/firmware wasn't mounted any more. I don't know why this happens intermittently but I added some code in my fork to check whether the partitions are mounted and mount them again if they disappeared.

Everybody who faces the issue should grab my fix and test again. A quick check whether the clone of the boot partition without any reboot can be done with

sudo mount <cloneDevice>1 /mnt
# or
sudo mount <cloneDevice>p1 /mnt
ls -la /mnt
sudo umount /mnt

If it's empty the clone will not boot. If somebody still faces the issue with my fix please execute following command

sudo ./rpi-clone -x <otherOptions> <cloneDevice> | tee rpi-clone.log

This will create a lot of debug output on the screen and in rpi-clone.log. When rpi-clone finished please attach rpi-clone.log in this issue.

@framps
Copy link

framps commented Dec 1, 2024

Thank you very much again @geerlingguy for your donation which enables me to make progress on this issue.

It's not that I have not enough money to buy a RPi5. But it's my principle to buy any required HW for any OS projects I work on with donations only.

@sbhadr
Copy link

sbhadr commented Dec 18, 2024

I just so happen to be wanting to move from my microSD to the external SSD. Was there ever a fix? Does the current repo not work? This thread has a lot of words and confusing.

I am on Rasp pi OS lite (64 bit) on RPi 5.

@framps @geerlingguy

@framps
Copy link

framps commented Dec 19, 2024

Does the current repo not work?

Everything is fine with an RPi4 or older RPi. There is an intermittent issue with RPi5 and therefore I updated rpi-clone in my fork. Please grab my updated version to clone your microSD.

Please let me know whether the SSD boots or fails to boot. If it fails please show the console output.

@framps
Copy link

framps commented Dec 23, 2024

@sbhadr Would be great to get an update 😉

@fjpdevries
Copy link

fjpdevries commented Dec 23, 2024 via email

@sbhadr
Copy link

sbhadr commented Dec 25, 2024

@sbhadr Would be great to get an update 😉

I just used Balena Etcher, cloned the drive and it picked up the SSD without the microSD attached.

@framps
Copy link

framps commented Dec 25, 2024

Ok. So you didn't use the updated rpi-clone from my fork to test it works for you - unfortunately. Would be great if you could try the clone again with the updated rpi-clone to verify the fix.

@roman-sakh
Copy link

@framps I am going to test your forked version right away.
I have only one question, do I need to do mounting for certain partitions?
Or just cloning should be enough.

I have RPi5 with HAT pcb and Kingston NVMe SSD installed.
Thank you

@framps
Copy link

framps commented Jan 13, 2025

I have only one question, do I need to do mounting for certain partitions?

No. Just use rpi-clone as it's documented.

If you check my workaround you'll see I check whether the boot partition is mounted and mount it if it's not mounted.

@roman-sakh
Copy link

this is what i have after cloning
image

I do not like naming in /mnt folder
and also I do not see MOUNTPOINTS after running lsblk

@framps
Copy link

framps commented Jan 13, 2025

I do not like naming in /mnt folder

I see your point. Both mountpoints are created by rpi-clone and should be deleted at the end. I'll add the required rmdir statements in a PR.

and also I do not see MOUNTPOINTS after running lsblk

Well, rpi-clone assumes that you open another window when you see the inspecting message. Then you will find both partitions mounted. But when you press enter they are unmounted.

Are you sure you use my version? I expect to see the debug output of lsblk which I miss in your screenshot. Please check the md5sum of your version.

pi@raspberrypi-bookworm64-lite-beta:~ $ md5sum rpi-clone 
fbeb1ac90bc3ac0d3e2b8716dab722d7  rpi-clone

@roman-sakh
Copy link

Sorry for confusion, mountpoints is good.
rpi-clone is cloning evrything without issues, but RPi is still not booting from SSD.
I was doing everything via SSH, cause RPi is in another city =)
Today my bro will connect HDMI display and will see what it says.

regarding using your version, yes. I have cloned your repo, switched correct branch.
Will proceed today or tomorrow and update my findings.

@framps
Copy link

framps commented Jan 14, 2025

According your screenshot you don't use my version.

Just use wget https://raw.githubusercontent.com/framps/rpi-clone/refs/heads/rpi5/rpi-clone to download the code.

I updated my version yesterday and you now will get also a message it's my version 😉

@roman-sakh
Copy link

What I have achieved so far.
I have tried to clone with forked utility from @framps . CLoning is good, RPi5 is boting from SSD to desktop, but after that it is freezing, and screen turns to white background.
And after that it is just turning to black screen with blinking cursor on the top.
Seems the problem is in my m.2 HAT which has Switching chip on it.
Will proceed with findings, but they are not related to cloning process.

Thank you much for help.

@roman-sakh
Copy link

roman-sakh commented Jan 15, 2025

Latest update.
@framps your fork works as charm.
For some reson I had identical UUID for partiotions in SD-card and SSD.
After I did everything from scratch it worked from since 1st try.

What I put in /boot/firmware/config.txt

# Enable the PCIe External connector.
dtparam=pciex1
dtparam=pciex1_gen=2 # may be redundant, but let's be explicit
usb_max_current_enable=1

Bootloader

[all]
BOOT_UART=1
BOOT_ORDER=0xf416
#NET_INSTALL_AT_POWER_ON=1
#PCIE_PROBE=1

@framps
Copy link

framps commented Jan 15, 2025

@framps your fork works as charm.

Keep in mind this repository is the master repo for rpi-clone. My for is only required to be able to create PRs to fix issues in rpi-clone 😉 .

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

No branches or pull requests

7 participants