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:
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.
Hello @sadraccoon ,
Welcome to , 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’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?
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.
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: