Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
boot system with m.2 ngff SSD connected with ngff-to-usb?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 265

PostPosted: Tue Dec 19, 2023 6:19 am    Post subject: boot system with m.2 ngff SSD connected with ngff-to-usb? Reply with quote

The issue was originally posted here https://forums.gentoo.org/viewtopic-p-8810017.html#8810017. Since now i think it may be more a kernel or driver issue, i rephrased the issue here:

I have an acer laptop, legacy BIOS, single SATA 75G HDD, with gentoo installed.

Recently, i bought a new SSD, m.2, ngff, 256G, and a ngff to usb cable, so that i can connect the SSD to laptop via USB.

I boot the laptop with a temperary usb drive(SLAX linux), the use dd command to clone the 75G HDD into new 256G SSD.

And i have a SATA to usb cable, i can connect the HDD with this cable to laptop and boot the system in this way. That is to say, i can boot the system with the HDD no matter its connected with SATA or via a SATA to usb cable.

But i cannot boot the system using the cloned SSD. If i boot with SSD connected to the laptop with USB, i got:
Code:

error: invalid arch-independent ELF magic.
Entering rescue mode...
grub rescue>


If i boot with supergrub2 disk, enabing all native disk drivers in supergrub2, and then select the gentoo OS detected on SSD, i can see kernel loaded but stops with:
Code:

Determining root device (trying UUID=94db66xxxxxx
Root device detected as /dev/sdb3!
Mounting /dev/sdb3 as root ...
Using mount -t ext4 -o ro /dev/sdb3 /newroot
!! init (/sbin/init) not found in mounted root device (/dev/sdb3)!



so, what can be wrong? any kernel configuration i need for this new m.2 ngff 256G SSD connected via ngff to usb cable?


Last edited by guyuming on Thu Dec 21, 2023 1:22 am; edited 1 time in total
Back to top
View user's profile Send private message
alexander-n8hgeg5e
n00b
n00b


Joined: 02 Nov 2019
Posts: 58

PostPosted: Tue Dec 19, 2023 12:01 pm    Post subject: Reply with quote

With supergrub2, It looks like you try to use the boot partition as root partition.
the kernel loads from the boot partition but then you need to tell grub where /init is
usually on the /root partition

Easiest would be to boot from the hdd and then install a full grub on the new disk, can be done without using "dd" again.
Back to top
View user's profile Send private message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 265

PostPosted: Thu Dec 21, 2023 1:21 am    Post subject: Reply with quote

@alexander-n8hgeg5e

but the message above says 'Mounting /dev/sdb3 as root ... '

and /dev/sdb3 is the root partition, not boot partition

in rescueshell, i can run ls and can see that /sbin/init is there.


I had suspected that the ngff ssd has something wrong and cannot be used as boot drive. However, if i clone SLAX linux ISO into the ngff ssd, i can boot with it.
Back to top
View user's profile Send private message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 265

PostPosted: Thu Dec 21, 2023 7:27 am    Post subject: Reply with quote

in rescueshell, a file /run/initramfs/gksosreport.txt is mentioned. I don't know how to copy this file out in rescueshell.

At the end of the file, around the error message i posted above, there is following error message:
Code:

FAILED (1) : 'mountpoint -q /newroot/usr'


The /newroot is where /dev/sdb3, the root partition is mounted.

I was trying to cp the gksosreport.txt file into the /newroot directory, however, it said read-only file system
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1641
Location: Richmond Hill, Canada

PostPosted: Thu Dec 21, 2023 3:53 pm    Post subject: Reply with quote

guyuming,

On /dev/sdb3, is there a file etc/initramfs.mounts?

If there is such file do you know why it exist?
Gentoo by default does not have this file unless you have essential directories (/usr, /var, etc...) in a separated file system. And you follow some instructions created this file.

Quote:
!! init (/sbin/init) not found in mounted root device (/dev/sdb3)!
Is this file actually exist on /dev/sdb3's /sbin/init and the file permission is executable?

Quote:
FAILED (1) : 'mountpoint -q /newroot/usr'
May be /dev/sdb3 is not the right root file system, this message may be indicate /bin/mountpoint file does not exist.
Back to top
View user's profile Send private message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 265

PostPosted: Fri Dec 22, 2023 5:56 am    Post subject: Reply with quote

It seems that there is something wrong with dd.

I just tried dcfldd, after first run of something like:
Code:

dcfldd if=/dev/sda3 of=/dev/sdc3 hash=md5,sha1 hashlog=/root/hashlog.txt

and verify again with:
Code:

dcfldd if=/dev/sda3 vf=/dev/sdc3 verifylog=/root/verifylog.txt

it says mismatch!

If there is anything wrong with the SATA to USB cable, why i can connect the original HDD to this cable and boot system with it?
Back to top
View user's profile Send private message
alexander-n8hgeg5e
n00b
n00b


Joined: 02 Nov 2019
Posts: 58

PostPosted: Fri Dec 29, 2023 8:00 am    Post subject: Reply with quote

The original hdd is already written, so this could be the reason,...
I don't know this dd command you are using but
it seems wrong that it can't be verified.
Is your disk mounted read only during the copy?
If you copy from a rw mounted disk then the filesystem
is likely to change the disk and then the verify fails.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 55185
Location: 56N 3W

PostPosted: Fri Dec 29, 2023 12:33 pm    Post subject: Reply with quote

guyuming,

Quote:
I boot the laptop with a temperary usb drive(SLAX linux), the use dd command to clone the 75G HDD into new 256G SSD.


This makes the UUIDS, PARTUUIDs and so on *identical* between the the original and copy.
UUID means Universally Unique ...

That's safe only if both the original and clone are not connected to the same system at the same time as there is no way to tell them apart - They are clones.

Quote:
Recently, i bought a new SSD, m.2, ngff, 256G, and a ngff to usb cable, so that i can connect the SSD to laptop via USB ... And i have a SATA to usb cable, i can connect the HDD with this cable to laptop and boot the system in this way. That is to say, i can boot the system with the HDD no matter its connected with SATA or via a SATA to usb cable.


Maybe. Mounting root from USB requires extra steps.
Normally root is mounted before USB is started. With root on USB, that can't happen.

You need a extra kernel parameter for root over USB.
Until it works, use rootdelay=30. Once it works change to rootwait.
The first will wait 30 seconds, then panic if root is not ready. The second will wail until root appears ... or forever. The panic message is useful.
The USB drivers required to to mount root must be built into the kernel to mount root over USB.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 265

PostPosted: Fri Jan 05, 2024 5:22 am    Post subject: Reply with quote

Thanks all. It works now, although i still don't know why it failed before.

I just cloned it again this time succeed. because i had never used m.2 SSD to boot via USB before, i was not sure whether it can be done. I had cloned it more than once before and failed.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum