You are not logged in.

#1 2019-10-02 15:59:30

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

[SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

Hallo,
since kernel 5.3 i have occasional swapped harddisk device names (/dev/sda <> /dev/sdb). The first one is GPT/EFI with 9 partitions. The other one is MBR with 2 partitions. When they are swapped the boot process ends in a recovery environment/shell. What can i do to make the mapping static? There already is a root=<UUID> entry in GRUB.

Any ideas?

grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt6' --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  11111111-1111-1111-1111-111111111111
else
  search --no-floppy --fs-uuid --set=root 11111111-1111-1111-1111-111111111111
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=800x600x32,auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=de_DE
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=2
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-11111111-1111-1111-1111-111111111111' {
	savedefault
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt6'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt6' --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  11111111-1111-1111-1111-111111111111
	else
	  search --no-floppy --fs-uuid --set=root 11111111-1111-1111-1111-111111111111
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=11111111-1111-1111-1111-111111111111 rw  threadirqs
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-11111111-1111-1111-1111-111111111111' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-11111111-1111-1111-1111-111111111111' {
	savedefault
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt6'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt6' --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  11111111-1111-1111-1111-111111111111
		else
		  search --no-floppy --fs-uuid --set=root 11111111-1111-1111-1111-111111111111
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=11111111-1111-1111-1111-111111111111 rw  threadirqs
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-11111111-1111-1111-1111-111111111111' {
	savedefault
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt6'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt6' --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  11111111-1111-1111-1111-111111111111
		else
		  search --no-floppy --fs-uuid --set=root 11111111-1111-1111-1111-111111111111
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=11111111-1111-1111-1111-111111111111 rw  threadirqs
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

# BEGIN Copied from /etc/grub.d/30_os-prober ###

# END Copied from /etc/grub.d/30_os-prober ###

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

fstab:

# /dev/sda6
UUID=11111111-1111-1111-1111-111111111111	/			ext4	rw,relatime,data=ordered,commit=30	0 1

# /dev/sda11
UUID=22222222-2222-2222-2222-222222222222	/media/LinuxPart2	ext4	rw,relatime,data=ordered,commit=30	0 1

# /dev/sda5
UUID=33333333-3333-3333-3333-333333333333	/media/LinuxPart3	ext4	rw,relatime,data=ordered,commit=30	0 1

# NTFS-3G

/dev/sda3	/media/Volume-C		ntfs-3g 		rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=111,dmask=000,uhelper=udisks2,noauto
/dev/sda4	/media/Volume-D		ntfs-3g 		rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=111,dmask=000,uhelper=udisks2,noauto
/dev/sda8	/media/Volume-F		ntfs-3g			rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=111,dmask=000,uhelper=udisks2
/dev/sda9	/media/Volume-G		ntfs-3g 		rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=111,dmask=000,uhelper=udisks2

Last edited by Maniaxx (2019-10-02 17:09:44)


sys2064

Offline

#2 2019-10-02 16:02:18

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: [SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

Pretty normal. That's why you shouldn't be using /dev/sda in fstab, you already have some using the UUID, why not all?

Offline

#3 2019-10-02 16:12:15

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

Didn't know Linux derives one from serial number for NTFS.
Will try that. Thanks.

Edit:
On a 2nd thought...
Wouldn't that still allow sda<>sdb to be swapped? I have more tools like Veracrypt that rely on proper sda/sdb mapping. Its not just the boot process. Would a grub 'device.map' help here or a udev rule? What exactly is responsible for the "BIOS to sdx" mapping (systemd, udev, grub, kernel...)?

Last edited by Maniaxx (2019-10-02 16:26:37)


sys2064

Offline

#4 2019-10-02 16:28:16

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

https://bugs.archlinux.org/task/63984 any change would need to come from upstream.  can-veracrypt-use-persistent-mount-points-on-linux.
Edit:
The sda/sdb assignment is done by the kernel,  the persistent identifiers by udev.

Last edited by loqs (2019-10-02 16:34:05)

Offline

#5 2019-10-02 16:33:58

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: [SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

sda/sdb assignments are somewhat random. Don't use them in configs, end of story

Offline

#6 2019-10-02 17:08:42

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] sda<>sdb mapping is swapped sometimes and breaks booting

Thanks. Will try to make the best out of it.
Loqs references are exactly what i experience here.


sys2064

Offline

Board footer

Powered by FluxBB