Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Drive letter changes when booting with external monitor
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
itsdrike
n00b
n00b


Joined: 19 Jul 2021
Posts: 4

PostPosted: Mon Jul 19, 2021 10:16 pm    Post subject: Drive letter changes when booting with external monitor Reply with quote

So, this is pretty weird, basically until now I've been using the distribution kernel, which worked well, but I wanted to try and use my own kernel. I managed to set everything up, however I'm having a really weird issue:

I'm using grub as my boot manager, and it has this line in it linux /boot/vmlinuz-5.13.1-gentoo root=/dev/sda4 ro, I'm not sure why it isn't using UUIDs, but that's not really the issue here, this works fine and I can boot using it without any problems. However for some really weird reason, if I boot while having an external HDMI monitor plugged to my laptop, it goes to kernel-panic, complaining that there's no such drive and showing me a list of partitions, that are now under /dev/sdb instead of /dev/sda. When I change the grub config to use that partition instead, it works and gets me into the system without issues.

I see no real reason why plugging and HDMI display should in any way change the drive letter to /dev/sdb, when I booted like this and checked fdisk -l, there was no other drive detected which would take the up place, it simply only listed my main single drive as /dev/sdb. This issue does not happen with the distribution kernel, which means it must be an issue with my kernel configuration, but I can't seem to be able to figure out which setting could be causing something like this.

Any suggestions?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Mon Jul 19, 2021 10:32 pm    Post subject: Reply with quote

You should be using UUID to get around this problem. It's an option in /etc/default/grub GRUB_DISABLE_LINUX_UUID - hopefully that's commented out or set to no. Also it may be affected by whether or not you use an initramfs like from dracut or genkernel... at least in the past UUID required initramfs to parse.

Device number changing is actually quite possible with docking stations and how fast each (USB) device takes to respond when things are connected or not. I'd imagine PCI/PCIe/mPCIe enumerate fast enough whether or not devices are connected or not that it shouldn't matter.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
itsdrike
n00b
n00b


Joined: 19 Jul 2021
Posts: 4

PostPosted: Mon Jul 19, 2021 10:43 pm    Post subject: Reply with quote

eccerr0r wrote:
You should be using UUID to get around this problem. It's an option in /etc/default/grub GRUB_DISABLE_LINUX_UUID - hopefully that's commented out or set to no.


I did do that, I've set that variable to false, so that it isn't disabled, and in fact I also use os-prober and for my arch system, it did use the UUID, I'm really unsure as to why wouldn't it be used with gentoo. I also didn't notice this at first, but even the distribution kernel is using UUID definition in grub, so for some reason grub is using the `/dev/sdXY` definitions only for my compiled kernel binaries. I could of course adjust the /boot/grub/grub.cfg file myself, but I'd rather not do that as I'd have to be adjusting it every time after I run `grub-mkconfig`

EDIT: Maybe it's because all of those other systems did you initramfs? You mentioned something about it being required to use UUIDs?

eccerr0r wrote:

Also it may be affected by whether or not you use an initramfs like from dracut or genkernel... at least in the past UUID required initramfs to parse.
Device number changing is actually quite possible with docking stations and how fast each (USB) device takes to respond when things are connected or not. I'd imagine PCI/PCIe/mPCIe enumerate fast enough whether or not devices are connected or not that it shouldn't matter.


I don't use initramfs, the distribution kernel however does, how does this affect it?
I didn't use genkernel and I don't even know what dracut is.

In any other linux system I've ever used my main disk always got recognized as /dev/sda, never anything else, so it is really weird to me that it would just suddenly get assigned to /dev/sdb because of something as simple as booting while having my external monitor plugged.
Back to top
View user's profile Send private message
itsdrike
n00b
n00b


Joined: 19 Jul 2021
Posts: 4

PostPosted: Mon Jul 19, 2021 11:18 pm    Post subject: Reply with quote

itsdrike wrote:


I did do that, I've set that variable to false, so that it isn't disabled, and in fact I also use os-prober and for my arch system, it did use the UUID, I'm really unsure as to why wouldn't it be used with gentoo. I also didn't notice this at first, but even the distribution kernel is using UUID definition in grub, so for some reason grub is using the `/dev/sdXY` definitions only for my compiled kernel binaries. I could of course adjust the /boot/grub/grub.cfg file myself, but I'd rather not do that as I'd have to be adjusting it every time after I run `grub-mkconfig`

EDIT: Maybe it's because all of those other systems did you initramfs? You mentioned something about it being required to use UUIDs?



Turns out it indeed was initramfs, I tried using dracut as you mentioned and with it grub-mkconfig is now automatically using UUID for my custom kernel image too, however it still happens that with the external monitor, my disk changes to /dev/sdb and without it, it's /dev/sda. While I can now boot easily in either of those cases, I'm still not a huge fan of having my main disk be /dev/sdb while /dev/sda is free.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Mon Jul 19, 2021 11:21 pm    Post subject: Reply with quote

The other possibility is that the other distributions have drivers in the initramfs and yours are hardcoded. The hardcoded ones are pulling in drivers for your expansion box and video in a different order, shifting enumeration a bit...

TBH I don't even notice sdX devices unless working with physical devices... root filesystem is agnostic to the device it's installed on!
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
itsdrike
n00b
n00b


Joined: 19 Jul 2021
Posts: 4

PostPosted: Mon Jul 19, 2021 11:23 pm    Post subject: Reply with quote

eccerr0r wrote:
The other possibility is that the other distributions have drivers in the initramfs and yours are hardcoded. The hardcoded ones are pulling in drivers for your expansion box and video in a different order, shifting enumeration a bit...


I don't suppose there is an easy way to force /dev/sda to be used easily then, right?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Mon Jul 19, 2021 11:27 pm    Post subject: Reply with quote

I think there is through udev rules (though not sure how well it works on root devices), but I never researched it, was never a problem for me.
That is, other than leaving all drivers out of the kernel and putting unneeded-for-boot driver in initramfs.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2006

PostPosted: Tue Jul 20, 2021 8:02 am    Post subject: Reply with quote

While most initramfs scripts can handle root=UUID=foo, without one, the kernel handles root=PARTUUID=bah, but not UUID=foo. Use blkid to get it.
The comments in the source code give full details.
_________________
Greybeard
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