1

After installing Ubuntu 20.04 LTS on my Asus EP1501P, I found out my SDCard reader was associated with /dev/sda instead of /dev/mmcblk0 and my main SSD with /dev/sdb :

$ sudo fdisk -l /dev/sd[ab]
Disk /dev/sda: 59,9 GiB, 64289243136 bytes, 125564928 sectors
Disk model: STORAGE DEVICE  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1       32768 125564927 125532160 59,9G  7 HPFS/NTFS/exFAT


Disk /dev/sdb: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 870 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3175f771

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdb1         2048    534527    532480   260M  b W95 FAT32
/dev/sdb2  *    534528 976773119 976238592 465,5G 8e Linux LVM
$ lsblk -pf /dev/sd[ab] | grep -v VG_Samsung | column -t
NAME         FSTYPE       LABEL                                   UUID       FSAVAIL  FSUSE%  MOUNTPOINT
/dev/sda
└─/dev/sda1  exfat        XXXX-YYYY
/dev/sdb
├─/dev/sdb1  vfat         FUTURE_EFI                              E81C-0DBA
└─/dev/sdb2  LVM2_member  xxxxxx-yyyy-zzzzz-xxxx-yyyy-zzzz-xxxxxx
$ sudo hdparm -I /dev/sda

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ATA device, with non-removable media
Standards:
    Likely used: 1
Configuration:
    Logical     max current
    cylinders   0   0
    heads       0   0
    sectors/track   0   0
    --
    Logical/Physical Sector size:           512 bytes
    device size with M = 1024*1024:           0 MBytes
    device size with M = 1000*1000:           0 MBytes 
    cache/buffer size  = unknown
Capabilities:
    IORDY not likely
    Cannot perform double-word IO
    R/W multiple sector transfer: not supported
    DMA: not supported
    PIO: pio0 
$ sudo hdparm -I /dev/sdb | sed "s/Serial Number:\s.*/Serial Number:      XXXXXXXXXXXXXXX/" | head 

/dev/sdb:

ATA device, with non-removable media
    Model Number:       Samsung SSD 870 EVO 500GB               
    Serial Number:      XXXXXXXXXXXXXXX
    Firmware Revision:  SVT01B6Q
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
    Used: unknown (minor revision code 0x005e) 

And when there is no SD Card inside the SD Card reader, I get these errors when updating grub configuration :

$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
Found linux image: /boot/vmlinuz-5.13.0-40-generic
Found initrd image: /boot/initrd.img-5.13.0-40-generic
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
Found linux image: /boot/vmlinuz-5.13.0-39-generic
Found initrd image: /boot/initrd.img-5.13.0-39-generic
Found linux image: /boot/vmlinuz-5.13.0-35-generic
Found initrd image: /boot/initrd.img-5.13.0-35-generic
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
  /dev/sda: open failed: No medium found
done

EDIT0 : The SD Card reader is connected to the USB Bus instead of the PCI Bus :

$ lsusb | egrep -i "(sd|card).reader"
Bus 001 Device 005: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer
$ lsusb -d 05e3:0727 -v | egrep -i "(sd|card).reader|idVendor|idProduct"
Couldn't open device, some information will be missing
Bus 001 Device 005: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer
  idVendor           0x05e3 Genesys Logic, Inc.
  idProduct          0x0727 microSD Reader/Writer

How come the device connected to the USB controller appears before the device connected to the PCI controller (supposed to be faster than USB) ?

Is it possible to write an udev rule to assign /dev/sdb to this USB card reader and /dev/sda to my SSD so as to prevent os-prober errors (when calling update-grub) ?

EDIT1 : In the past, grub got installed onto the SDCard and my Ubuntu SSD disk could not boot without it.

So, to avoid confusion and future problems, I would love for my SDCard to be associated with a different device than /dev/sda

How do I switch the SSD back to /dev/sda and the SD Card reader to /dev/mmcblk0 ?

SebMa
  • 2,291

1 Answers1

1

The order of the block devices is set automatically early in the boot process. I would say that the first device that it ready is /dev/sda and the next is /dev/sdb ...

Block device names like /dev/mmcblk0 are reserved for devices connected via PCI, but internal card readers can also be connected via USB (like external card readers), and they are seen as /dev/sdx (where x is a single letter).

The order of the block device names should not be a problem. Ubuntu uses the UUID of the partitions in order to mount them (or use as swap). If you have some own tools, that depend on devices, you can mount partitions on them according to their UUID or label.

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Thanks for your answer. Can you take a look at my EDIT0 ? – SebMa Apr 28 '22 at 22:29
  • 1
    I think it is simple: the card reader is ready before the SSD, and therefore it is assigned to /dev/sda. I don't know how to change that, but if you are lucky, someone who knows will see your question and help you. But I don't know why it is important for you. Please tell me why you want the SSD to be '/dev/sda` (details about the os-prober errors?). – sudodus Apr 29 '22 at 08:18
  • 1
    Because, in the past, grub got installed onto the SDCard and my Ubuntu SSD disk could not boot without it. So to avoid confusion and future problems, I would love for my SDCard to be associated with a different device than /dev/sda. – SebMa Apr 30 '22 at 11:24
  • If that happens, you can clone the relevant parts of grub to the internal drive. But it is somewhat tricky, and I understand that you would like to make the computer get the internal ssd recognized as /dev/sda at least when booting into an installer SD card. - It might work (temporarily), if you wait a few seconds after boot until you insert (to connect) the SD card The time interval might be tight: too early and you get the current problem; too late and the SD card will not be listed as a bootable device. – sudodus Apr 30 '22 at 12:43
  • /dev/sda is always here on the filesysem, even when there is no SDCard in the SDCard reader slot. – SebMa Apr 30 '22 at 19:33
  • Try to find someone who knows enough about this by starting a bounty (for example offering 100 or 200 reputation points from your score). - A workaround might be to install Ubuntu into another computer (for example into an external USB drive), check that it boots in your Asus EP1501P, and if it works, clone it into the internal drive. This link (1) and this link (2) may be helpful for that process. – sudodus May 01 '22 at 11:50
  • How about a new udev rule instead so as to "move" the SDCard reader to a dynamically created device such as /dev/sdcard based on the idVendor (0x05e3) and the idProduct (0x0727) ? Can you help me create a specific udev rule for that ? – SebMa May 01 '22 at 12:29
  • Maybe it would work via udev, but I don't know the details well enough to help you. – sudodus May 01 '22 at 12:31
  • 1
    OK. Thanks a lot for all your help so far. I guess I might have to create another question for that. – SebMa May 01 '22 at 12:35
  • 1
    It might help to create another question here at AskUbuntu and focus on the method with udev rules. You can also ask at the Ubuntu Forums, where another group of helpers are active. – sudodus May 01 '22 at 14:48