I have fedora installed on an External SSD, boots externally but not when placed internally

I installed Fedora on an external ssd that I have attached inside a M.2 ssd enclosure so that I could simply unplug it and boot into windows and then simply plug and play back into linux whenever I needed to. I’ve had this setup for a good year at this point and it’s served me alright but I don’t use Windows all that much anymore so I wanted to make the external SSD go inside my pc for good now since Fedora keeps freezing up on me every now and then maybe because of this setup as my thinking. The issue though is that when I decided to move the M.2 ssd inside my pc the Fedora logo shows up but the circle loading icon just keeps on loading forever. When I plug it back into the usb slot externally it boots up just fine. When I click ESC on the forever botting up screen I get at first:

followed by this repeating over and over for a minute:

I guess my question is how do I get Fedora to boot as an internal drive instead of as an external one? From the little I can piece together, is it accurate to say that I need to edit GRUB or something similar to get it to work? I am an absolute beginner with the terminal so if I can get a very step by step guide it would be very appreciated. Or a none terminal approach would also be very much appreciated.

Edit: Info from inxi -Fzx:

  Kernel: 6.3.6-200.fc38.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.39-9.fc38 Desktop: GNOME v: 44.1 Distro: Fedora release 38 (Thirty
  Type: Desktop Mobo: Micro-Star model: Z390-A PRO (MS-7B98) v: 1.0
    serial: <superuser required> UEFI: American Megatrends v: 1.80
    date: 12/25/2019
  Info: 8-core model: Intel Core i7-9700K bits: 64 type: MCP arch: Coffee Lake
    rev: C cache: L1: 512 KiB L2: 2 MiB L3: 12 MiB
  Speed (MHz): avg: 3934 high: 4602 min/max: 800/4900 cores: 1: 4600 2: 800
    3: 3071 4: 4600 5: 4602 6: 4600 7: 4600 8: 4600 bogomips: 57600
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Device-1: NVIDIA GP104 [GeForce GTX 1080] vendor: Gigabyte driver: nouveau
    v: kernel arch: Pascal bus-ID: 01:00.0 temp: 38.0 C
  Display: wayland server: X.Org v: 22.1.9 with: Xwayland v: 22.1.9
    compositor: gnome-shell driver: dri: nouveau gpu: nouveau
    resolution: 1920x1080~75Hz
  API: OpenGL v: 4.3 Mesa 23.1.1 renderer: NV134 direct-render: Yes
  Device-1: Intel Cannon Lake PCH cAVS vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
  Device-2: NVIDIA GP104 High Definition Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel bus-ID: 01:00.1
  API: ALSA v: k6.3.6-200.fc38.x86_64 status: kernel-api
  Server-1: PipeWire v: 0.3.71 status: active
  Device-1: Intel Ethernet I219-V vendor: Micro-Star MSI driver: e1000e
    v: kernel port: N/A bus-ID: 00:1f.6
  IF: eno1 state: down mac: <filter>
  Device-2: Intel Wireless 8260 driver: iwlwifi v: kernel bus-ID: 03:00.0
  IF: wlp3s0 state: up mac: <filter>
  IF-ID-1: ipv6leakintrf0 state: unknown speed: N/A duplex: N/A
    mac: <filter>
  IF-ID-2: proton0 state: unknown speed: 10000 Mbps duplex: full mac: N/A
  IF-ID-3: pvpnksintrf0 state: unknown speed: N/A duplex: N/A mac: <filter>
  Device-1: Intel Bluetooth wireless interface driver: btusb v: 0.8 type: USB
    bus-ID: 1-7:2
  Report: rfkill ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
  Local Storage: total: 2.27 TiB used: 132.28 GiB (5.7%)
  ID-1: /dev/sda vendor: Western Digital model: WD10EZEX-22MFCA0
    size: 931.51 GiB temp: 35 C
  ID-2: /dev/sdb model: SSK SSK Storage size: 465.76 GiB type: USB
  ID-3: /dev/sdc vendor: Seagate model: BUP Slim Mac SL size: 931.51 GiB
    type: USB
  ID-1: / size: 464.16 GiB used: 118.31 GiB (25.5%) fs: btrfs dev: /dev/dm-0
    mapped: luks-5dee9348-f3db-4021-8f7a-a5ba289fc61b
  ID-2: /boot size: 973.4 MiB used: 285.4 MiB (29.3%) fs: ext4
    dev: /dev/sdb2
  ID-3: /boot/efi size: 598.8 MiB used: 17.4 MiB (2.9%) fs: vfat
    dev: /dev/sdb1
  ID-4: /home size: 464.16 GiB used: 118.31 GiB (25.5%) fs: btrfs
    dev: /dev/dm-0 mapped: luks-5dee9348-f3db-4021-8f7a-a5ba289fc61b
  ID-1: swap-1 type: zram size: 8 GiB used: 581.2 MiB (7.1%) dev: /dev/zram0
  System Temperatures: cpu: 69.0 C pch: 43.0 C mobo: N/A gpu: nouveau
    temp: 39.0 C
  Fan Speeds (RPM): N/A gpu: nouveau fan: 680
  Processes: 390 Uptime: 4h 23m Memory: available: 15.54 GiB
  used: 4.21 GiB (27.1%) Init: systemd target: graphical (5) Compilers:
  gcc: 13.1.1 Packages: 34 note: see --rpm Shell: Bash v: 5.2.15 inxi: 3.3.27

Hello @sadraccoon ,
Welcome to :fedora: , sorry to hear about your issue. You are correct in that the grub boot menu needs some editing. And, it will need to be done in the terminal. Basically what has happened when you moved the ssd internal, is that the boot image it has for Fedora is no longer located where Grub is told it will be so you get a partial boot since the root filesystem cannot be located. I will look into how to best approach this. It will require some time on my part, so I’ll try to get back at it today. Maybe some one else here will step in, in the meantime @glb would know how to get those final steps probably off the top of his head.

M.2 form factor drives can be SATA or NVME. Check vendor sites for the specifications of your original and new drives and also the computer documentation (older systems may only support SATA M.2, many newer systems can support either type). You can also try searching the Linux Hardware Database (LHWDB) to see if your new drive has been used in your computer.

Can you boot with a F38 Live Installer USB key? Does the Windows drive work in the external case?

Assuming you computer does support the type of M.2 drive you are using, we need to see how it is configured. It would be best if you could post text output for sudo fdisk -l using the </> button so it can be found in searches, but a picture of the Gnome disks display for each disk may be adequate.

If you are seeing service startup messages and dracut errors, then you have successfully passed the bootloader stage and execution has been handed off to dracut. Does the root=... value on your kernel command line point to a filesystem UUID? Normally it does, but if you installed this to an external enclosure, one possibility is that you customized that to point to a device node (i.e. root=/dev/...). The correct device node path will likely change when you move the drive from an external attachment to an internal one and that could be one source of the error you are seeing.

Another possibility (and probably the more likely one) is that your dracut image does not contain the correct device driver to access your M.2 drive. While attached externally, the drive was probably using the generic “mass storage” driver. But that driver is a little slower and it is not designed for internal devices.

To fix the initramfs not having the right storage driver, you need to regenerate your dracut image while your root file system is mounted via the internal connection.

But first, try selecting the rescue image from the GRUB boot menu. It is supposed to have all the drivers you would need for exactly this sort of situation.

Another way to accomplish this is to boot a Live image from a thumb drive, then mount the root and boot file systems from your internal drive to something like /mnt and /mnt/boot (and, unfortunately, you’d probably also need to mount /mnt/boot/efi). Then you would run something like chroot /mnt and dracut -f /boot/<path to the initramfs> <kernel version string>. Then you would exit the chroot env, unmount the file systems, reboot, and hope for the best. (Sorry those directions are a little vague. I haven’t tried to do this with GRUB for a very long time. sd-boot is much simpler when it comes to this sort of thing; especially if you have everything on one ESP. But Fedora Linux hasn’t switched to sd-boot yet.)

When you generate the initramfs, it looks at what kernel modules are currently loaded to figure out what to include. Since the correct storage driver would have to load when you mount your root file system from the Live image, that should be enough to get the right driver included in the initramfs.

Edit: actually, another option, that is much simpler would be to run sudo dracut --force --no-hostonly while you have the M.2 drive mounted externally. That will regenerate the initramfs with all the known drivers and then it should just work when you move the drive to your internal connection.

I’m using a NVME m.2 SSD. If there’s a command to show my computer specs I can do that as well, I just don’t remember what it was.
Here’s the code from sudo fdisk -l when using it externally.

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-22M
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5A61AB3E-52C7-4FAE-BA07-7BD279CBDDE8

Device     Start        End    Sectors   Size Type
/dev/sda1     34      32767      32734    16M Microsoft reserved
/dev/sda2  32768 1953523711 1953490944 931.5G Microsoft basic data

Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model:                 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 854911FC-7520-4591-9C79-EEC0E64A5579

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1230847   1228800   600M EFI System
/dev/sdb2  1230848   3327999   2097152     1G Linux filesystem
/dev/sdb3  3328000 976773119 973445120 464.2G Linux filesystem

Disk /dev/mapper/luks-5dee9348-f3db-4021-8f7a-a5ba289fc61b: 464.16 GiB, 498387124224 bytes, 121676544 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

I have my Fedora 38 installed on the luks one I believe

I also went ahead and edited my original post with pictures of what I get when I click ESC on the fedora loading icon boot screen.

I’ve installed linux on an external nvme in a USB case on a system with Windows. The Windows drive showed as /dev/nvme... so I’m surprised to see Windows as /dev/sda.

Where was the Windows drive when you ran fdisk? We can see fdisk output for the Windows nvme drive, but it is called /dev/sda. If the Windows drive is in the internal slot it should show /dev/nvme.... Do you see /dev/nvme... using the rescue kernel?

Does the images I edited in show this happening?

How do I check?

When I first installed fedora I think I sicked to all the default options in the installation menu if this info helps. I think encrypting the drive was the only thing I changed about it but it’s been awhile so don’t really remember the whole process either.

Will doing this command impact/prevent me from doing any of the other approaches you mentioned before the posit edit if it doesn’t work out? I only have my files backed up and unsure how to backup the system if things go wrong.

Yes. The [ OK ] ... lines are a format that systemd outputs. When you see those, it means GRUB has completed its role and whatever is happening or not happening is the consequence of some other system component.

The command cat /proc/cmdline from your system while it is in a running state is a good way to see what parameters are being passed to your kernel on system startup.

That is an important detail about your configuration. Looking back at the images you posted, I see that the service that is failing is 90-crypt.sh. So it might be that something about that extra layer of encryption is what is failing when the interface changes. I don’t know enough about LUKS to be of much help there though if that is where the problem lies.

No. That command is pretty safe and it will have no effect on other troubleshooting methods you might try afterwards. That is probably the best command to try first.


I ended up using the

sudo dracut --force --no-hostonly

and it worked! I can insert the ssd into my computer and boots normally and also took it back out again to see if I can still use it externally as well and both options now work. Thank you to all those who helped get this fixed.

Be aware that that dracut command only affects the current kernel/initramfs. So if you intend to be switching this drive between the internal and external connection in the future, and you want it to work after your next kernel update, then you will need to set that configuration option permanently so that it will be automatically applied to future kernel/initramfs installs. You can do so with the following command:

echo 'hostonly=no' | sudo dd of=/etc/dracut.conf.d/hostonly.conf