Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel panic when adding SATA drives
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
epig
n00b
n00b


Joined: 16 Feb 2005
Posts: 70

PostPosted: Tue Jan 23, 2018 7:58 pm    Post subject: Kernel panic when adding SATA drives Reply with quote

I have a Gentoo system installed on a M.2 SSD, placed in the M.2 slot on the motherboard. Seemed like a good idea until:

I have 6 spare 2 TB SATA drives, and want to set those up in an LVM configuration and later use the machine as a iSCSI target.

Problem is as follows:

When I add 1 or more SATA drives, I get a kernel panic on boot: https://1drv.ms/i/s!AtaKp_gIQ9i76F8UoOmW11Cz1mDW

It looks to me like my /dev/sda is somehow changed when I plug in the remaining drives. I looks like my /dev/sda is now /dev/sdb form the panic log.

BIOS tells me that the M.2 slot makes up SATA channel number 4, and I reckon that the lower SATA channels somehow mess up the disk designation.

So my question is, I guess, is there a way to force a higher /given SATA channel to be /dev/sda?

I could install again with all the drives in the computer, of course, but that is a time consuming and not very desirable workaround.

[Moderator edit: fixed [url] tag. Forum auto-linking does not work when the URL contains exclamation points. -Hu]
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7093
Location: Saint Amant, Acadiana

PostPosted: Tue Jan 23, 2018 8:25 pm    Post subject: Reply with quote

You could pass PARTUUID instead of /dev/sdaX to your kernel.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Jan 23, 2018 9:28 pm    Post subject: Reply with quote

epig,

PARTUUID gets you started. You will need to use something unique in fstab too.

Thats
PARTUUID, which is a property of a partition, assigned when the partition is createi
UUID, which is a property of a filesystem, assigned when the filesystem is created.
LABEL, which you assign yourself, so its your problem to make sure its unique.

blkid is your friend.
_________________
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
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13855

PostPosted: Wed Jan 24, 2018 2:54 am    Post subject: Reply with quote

epig, why would you reinstall over this? Whether or not you take the advice offered so far (to use stable identifiers), you can easily change the choice of disks without a reinstall. Even if you want to go with the fragile approach of letting your SSD become sdb (and probably eventually a later letter as more drives are added), you can fix that by modifying your fstab and boot process. If you pass root= on the kernel command line (common), change it in your bootloader configuration file. If you set root= inside the kernel or use an initramfs that ignores root= (uncommon, but supported), you might require a kernel or initramfs rebuild. None of these paths involve wiping or reinstalling all your packages.
Back to top
View user's profile Send private message
epig
n00b
n00b


Joined: 16 Feb 2005
Posts: 70

PostPosted: Wed Jan 24, 2018 7:14 am    Post subject: Reply with quote

Thank you all.

so here is what I did for now:

Code:
bombadil ~ # blkid
/dev/sda1: SEC_TYPE="msdos" LABEL="efi-boot" UUID="9B94-3DE6" TYPE="vfat" PARTLABEL="grub" PARTUUID="8904add4-963c-4cb9-b718-939506264abb"
/dev/sda2: UUID="652a9d9c-65d9-460c-90be-cdc93e0500ea" TYPE="ext2" PARTLABEL="boot" PARTUUID="c25de7d3-4823-4a18-9569-14c683254489"
/dev/sda3: UUID="48500666-166e-450e-9043-57c3956317f5" TYPE="swap" PARTLABEL="swap" PARTUUID="a599bbc5-4da9-4835-80a3-3508c1c53f69"
/dev/sda4: UUID="63790364-210d-4fb2-a266-9977a3eeb887" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="41bd1bff-09dc-46fd-88b2-92feb02650c2"


I made a custom grub entry in /etc/grub.d/40_custom

Code:

#!/bin/sh
exec tail -n +3 $0

menuentry "Gentoo" {
    set root=UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
        linux /boot/vmlinuz-4.9.76-gentoo-r1 root=UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
        }



And changed my /etc/fstab:

Code:
#/dev/sda1      /boot/efi       vfat            noauto,noatime  1 2

#/dev/sda2   /boot        ext2    defaults,noatime     0 2
#/dev/sda3   none         swap    sw                   0 0
#/dev/sda4   /            ext4    noatime              0 1



UUID=9B94-3DE6                                  /boot/efi       vfat    noauto,noatime          1 2
UUID=652a9d9c-65d9-460c-90be-cdc93e0500ea       /boot           ext2    defaults,noatime        0 2
UUID=48500666-166e-450e-9043-57c3956317f5       none            swap    sw                      0 0
UUID=63790364-210d-4fb2-a266-9977a3eeb887       /               ext4    noatime                 0 1


As I don't have physical access to the system right now, I will have to wait in order to see if the custom option boots....

I will do a little (or probably a lot) of reading and googling and update the thread as I make progress.
Or, just install FreeNAS or something :P

Anyway, stay tuned...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Jan 24, 2018 12:16 pm    Post subject: Reply with quote

epig,

I'll save you some pain.
Code:
menuentry "Gentoo" {
    set root=UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
        linux /boot/vmlinuz-4.9.76-gentoo-r1 root=UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
        }

Contains two errors, I think. I still use legacy grub so do a bit of reading.

set root= Is grubs root. Where you need it to read the kernel from. That's /boot.
Do check that with your other grub entries - that's the one I'm not certain of.

Your
Code:
linux /boot/vmlinuz-4.9.76-gentoo-r1 root=UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
seems to point to the right place but you must use an initrd to use root=UUID=
Either add an initrd or use root=PARTUUID= here.
The kernel understands PARTUUID on its own but not filesystem UUID. Don't forget to change the string too.
_________________
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
epig
n00b
n00b


Joined: 16 Feb 2005
Posts: 70

PostPosted: Wed Jan 24, 2018 1:04 pm    Post subject: Reply with quote

NeddySeagoon wrote:
epig,
I'll save you some pain.


Always appreciated :)


Code:
menuentry "Gentoo" {
    set root=UUID=652a9d9c-65d9-460c-90be-cdc93e0500ea
        linux /boot/vmlinuz-4.9.76-gentoo-r1 root=PARTUUID=41bd1bff-09dc-46fd-88b2-92feb02650c2
        }


Where
root=UUID now points to my /boot partition (used to be /dev/sda2)
and
PARTUUID points to my / partition (used to be /dev/sda4)

Quote:
The kernel understands PARTUUID on its own but not filesystem UUID. Don't forget to change the string too.


I did not know that. Again, thanks.

I will reboot and see what's what later today when I get access to the console.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jan 24, 2018 1:07 pm    Post subject: Reply with quote

also do care about the numbers you use, PARTUUID is not UUID
/dev/sda4: UUID="63790364-210d-4fb2-a266-9977a3eeb887" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="41bd1bff-09dc-46fd-88b2-92feb02650c2"

UUID=41bd1bff-09dc-46fd-88b2-92feb02650c2 -> invalid
PARTUUID=63790364-210d-4fb2-a266-9977a3eeb887 -> invalid
Back to top
View user's profile Send private message
epig
n00b
n00b


Joined: 16 Feb 2005
Posts: 70

PostPosted: Wed Jan 24, 2018 9:32 pm    Post subject: Reply with quote

Still no dice.

Error message reads:

Code:
error: disk 'UUID=652a9d9c-65d9-460c-90be-cdc93e0500ea' not found


Code:
bombadil ~ # blkid
/dev/sda1: SEC_TYPE="msdos" LABEL="efi-boot" UUID="9B94-3DE6" TYPE="vfat" PARTLABEL="grub" PARTUUID="8904add4-963c-4cb9-b718-939506264abb"
/dev/sda2: UUID="652a9d9c-65d9-460c-90be-cdc93e0500ea" TYPE="ext2" PARTLABEL="boot" PARTUUID="c25de7d3-4823-4a18-9569-14c683254489"
/dev/sda3: UUID="48500666-166e-450e-9043-57c3956317f5" TYPE="swap" PARTLABEL="swap" PARTUUID="a599bbc5-4da9-4835-80a3-3508c1c53f69"
/dev/sda4: UUID="63790364-210d-4fb2-a266-9977a3eeb887" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="41bd1bff-09dc-46fd-88b2-92feb02650c2"

bombadil ~ # more /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0

menuentry "Gentoo" {
    set root=UUID=652a9d9c-65d9-460c-90be-cdc93e0500ea
        linux /boot/vmlinuz-4.9.76-gentoo-r1 root=PARTUUID=41bd1bff-09dc-46fd-88b2-92feb02650c2



set root=UUID= points to grub's root (dev/sda2) while kernel root points to the system root PARTUUID (dev/sda4).
From what I can see, I have the UUID and PARTUUID identifiers right...?

Also, my /etc/fstab uses UUIDs for mounting with no problems:

Code:

UUID=9B94-3DE6                                  /boot/efi       vfat    noauto,noatime          1 2
UUID=652a9d9c-65d9-460c-90be-cdc93e0500ea       /boot           ext2    defaults,noatime        0 2
UUID=48500666-166e-450e-9043-57c3956317f5       none            swap    sw                      0 0
UUID=63790364-210d-4fb2-a266-9977a3eeb887       /               ext4    noatime                 0 1


What did I miss?
Does anyone have a similar system with a grub.cfg I can look at?
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