Bullseye not loading disc drives in bus order?

Kernels & Hardware, configuring network, installing services

Bullseye not loading disc drives in bus order?

Postby ticketman » 2020-02-05 13:06

My system has a OS disc (sda) and a data disc (sdb).
Trouble is, the system randomly swaps the drive assignments when booting.
Sometimes sda is the system disc, sometime it is the data disc.
When sda is assigned to the data disc, I get
A start job is running for /dev/sdb1

After a time-out, I get
Dependency failed for drive

and I get dumped into emergency mode.
A reboot usually then works.

Configs:
Running 5.4.0-3-amd64 #1 SMP Debian 5.4.13-1 (2020-01-19) x86_64
My fstab is :
Code: Select all
# <file system> <mount point>   <type>  <options>          <dump>  <pass>
/dev/sda1        /                ext4     errors=remount-ro  0       1
/dev/sda5       none              swap    sw                         0       0
/dev/sdb1       /media/xyz/DATA0  ext4    defaults                 0        0


This issue was reported under Arch for kernel 5.3, but I am running 5.4 Debian Testing, so I am unsure if it is the same issue.
https://bugs.archlinux.org/task/63984.

If it is the same bug, will it get fixed, or do I now have to fiddle with label names (or use UUIDs that look like a horror show)?
ticketman
 
Posts: 90
Joined: 2012-06-30 11:06

Re: Bullseye not loading disc drives in bus order?

Postby p.H » 2020-02-05 13:27

ticketman wrote:Sometimes sda is the system disc, sometime it is the data disc.

This is to be expected. It is a feature, not a bug. Deal with it.
Do not use /dev/sd* in /etc/fstab and other config files. Use persistent identifiers such as UUID=<uuid>, LABEL=<label>, /dev/disk/by-id/<id>, aliases created with udev rules... instead.

PS : Permanent mounts of fixed disks should not be defined in /media. /media is intended for dynamic mounts of removable devices.
p.H
 
Posts: 1258
Joined: 2017-09-17 07:12

Re: Bullseye not loading disc drives in bus order?

Postby ticketman » 2020-02-05 20:07

Permanent mounts of fixed disks should not be defined in /media


Could you advise on the recommended path to use? Thanks!
ticketman
 
Posts: 90
Joined: 2012-06-30 11:06

Re: Bullseye not loading disc drives in bus order?

Postby sunrat » 2020-02-05 21:39

UUID is maybe the most commonly used. Find it with
Code: Select all
lsblk -f
and replace the sdX bit in fstab with UUID=<whatever-lsblk-shows>
I usually use UUID for / and LABEL for data drives. You have to give the partitions a LABEL with a partition editor to use that. I guess you could label your / partition too, but installer usually sets it up with UUID.
For data disks I mount them in a subfolder in /mnt eg. /mnt/music/ . You have to create those of course, and set correct permissions.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2956
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Bullseye not loading disc drives in bus order?

Postby p.H » 2020-02-05 21:47

ticketman wrote:Could you advise on the recommended path to use?

Wherever it makes sense for the contents according to the FHS. E.g. :
- user data -> /home/<somewhere>
- server data -> /srv/<somewhere>
etc.

PS : /mnt is not intended for permanent mounts either.
p.H
 
Posts: 1258
Joined: 2017-09-17 07:12

Re: Bullseye not loading disc drives in bus order?

Postby sunrat » 2020-02-05 22:26

p.H wrote:PS : /mnt is not intended for permanent mounts either.


It's fine if the mount police don't catch you. :mrgreen:
Yeah I know it's traditionally for temporary mounts, but I just use /mnt/temp/ on the extremely rare occasion I need to do that.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2956
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Bullseye not loading disc drives in bus order?

Postby ticketman » 2020-02-06 15:14

I have modified my fstab to:
Code: Select all
# <file system> <mount point>   <type>   <options>         <dump>  <pass>
/dev/sda1        /               ext4    errors=remount-ro  0       1
/dev/sda5       none             swap    sw                 0       0
#
# -- Data discs --
LABEL=DATA0     /home/xyz/DATA0  ext4    defaults           0       0


This seems to work, as there is now no ambiguity as to the system drive.

I am still befuddled as to why this is necessary (been fine since Jessie).
https://wiki.debian.org/fstab says:
The advantage of using UUIDs or labels is that they are not dependent on disk order. This is useful if you change your storage device order in the BIOS, you switch storage device cabling, or because some BIOS's may occasionally change the order of storage devices.

However I have no need to change my device order in the BIOS, or to switch around the cabling, and my BIOS does not change order of storage devices. The only thing that is randomly changing the order is the OS since either 5.3 or 5.4.
Now I have to be extra careful when using the dd command. I use :
Code: Select all
dd if=/dev/sda of=/dev/sdd bs=1M 

to backup my system disk, but under Bullseye, sda is no longer likely to be the system disk! So one could accidentally overwrite one's system disc unless one checks what is what using fdisk -l.
ticketman
 
Posts: 90
Joined: 2012-06-30 11:06

Re: Bullseye not loading disc drives in bus order?

Postby Head_on_a_Stick » 2020-02-06 15:43

ticketman wrote:I am still befuddled as to why this is necessary

See https://github.com/torvalds/linux/commi ... 903f804c22 & https://github.com/torvalds/linux/commi ... ef104d255a

In the linked Arch bug report loqs suggests messaging Linus and asking for a revert. He's nicer these days so that might even work.

Or just add a udev rule (using the information is sysfs) to force consistent device naming.

Another option would be a custom kernel with the mentioned commits reverted: https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official. But that's a lot more work.
User avatar
Head_on_a_Stick
 
Posts: 11114
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Bullseye not loading disc drives in bus order?

Postby p.H » 2020-02-08 08:41

ticketman wrote:I have modified my fstab to:
Code: Select all
# <file system> <mount point>   <type>   <options>         <dump>  <pass>
/dev/sda1        /               ext4    errors=remount-ro  0       1
/dev/sda5       none             swap    sw                 0       0
#
# -- Data discs --
LABEL=DATA0     /home/xyz/DATA0  ext4    defaults           0       0


This seems to work, as there is now no ambiguity as to the system drive.

There is still ambiguity with / and the swap which use unreliable device file names.
ticketman wrote:The only thing that is randomly changing the order is the OS since either 5.3 or 5.4.

Random order has been observed with much older kernels too. This is not new.

ticketman wrote:Now I have to be extra careful when using the dd command.

"Now" ? One has always had to be extra careful when using dd to write on raw devices.
p.H
 
Posts: 1258
Joined: 2017-09-17 07:12

Re: Bullseye not loading disc drives in bus order?

Postby Head_on_a_Stick » 2020-02-08 10:41

p.H wrote:Random order has been observed with much older kernels too. This is not new.

I'm curious, have you ever actually observed random device naming in a machine for which the bus addresses remained constant? The old behaviour did seem to be based on the address of the devices.
User avatar
Head_on_a_Stick
 
Posts: 11114
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Bullseye not loading disc drives in bus order?

Postby p.H » 2020-02-09 11:57

Yes. Even if disk probing by a single driver was synchronous and predictable, driver modules are loaded asynchronously by udev and run in parallel, so disks connected to host controllers managed by different drivers may be discovered in any order.

Maybe this has become less common now, but I had a machine with 3 different SATA/eSATA/PATA controllers (JMicron AHCI, Intel SATA and Marvell PATA IIRC) using 3 different drivers. I have even seen USB drives named before ATA internal drives despite the default 1-second delay penalty applied to USB storage.
p.H
 
Posts: 1258
Joined: 2017-09-17 07:12

Re: Bullseye not loading disc drives in bus order?

Postby Head_on_a_Stick » 2020-02-09 17:34

^ Fascinating, thanks!
User avatar
Head_on_a_Stick
 
Posts: 11114
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Bullseye not loading disc drives in bus order?

Postby ticketman » 2020-02-13 12:13

p.H wrote:
There is still ambiguity with / and the swap which use unreliable device file names.


After many successful boots, today it decided to assign sdb to the system disc, so I can confirm what p.H said, that there is still ambiguity with '/' and 'swap'.
Amazed I haven't hit this issue until now, after so many years!

So to fix this, do I boot a live disc and use gparted to apply labels to sda1 and sda5, and echo that in my fstab?
ticketman
 
Posts: 90
Joined: 2012-06-30 11:06

Re: Bullseye not loading disc drives in bus order?

Postby p.H » 2020-02-13 15:15

You can do that, but you don't need to boot a live system. You can set an ext4 label with e2label and a swap label with swaplabel. Make sure to choose rather "unique" labels, not just "root" and "swap", e.g. including the system name.

Or you can just use the UUIDs shown by blkid.
p.H
 
Posts: 1258
Joined: 2017-09-17 07:12

Re: Bullseye not loading disc drives in bus order?

Postby sunrat » 2020-02-13 19:01

p.H wrote:You can do that, but you don't need to boot a live system. You can set an ext4 label with e2label and a swap label with swaplabel.

So you can do that for a mounted file system? I usually set LABEL when I create a partition. LABELs are 8)
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2956
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable