LXD loses track of its /dev/sdx if an external USB 3.0 or USB3.1c external USB-SATAIII Disk is on before boot

I wanted to share a somewhat corner case issue but one that might create a problem for someone.

I think everyone now and then encounters a puzzle that at first stumps you but after looking

into whatever it is … you find useful information.

This is one of those instances. I’ve used LXD for a long time and have used an

external USB2.0/SATAIII dual docking station to plug in HD’s and SSDs as I need them but

apparently I never encountered this one particular operational sequence till this past weekend

when I booted my system but had already turned on the USB/SATAIII external dock/drive.

All of a sudden my LXD didn’t work. Couldn’t find its socket. It took me a while to realize

the problem was related to the sequence of steps I used to boot my system.

  1. Boot with external USB/SATAIII OFF and LXD works.
  2. Boot with external USB/SATAIII Dock already ON and a Disk in it and LXD fails.
  3. Boot with external USB/SATAIII OFF and after boot completes Turn ON USB/SATAIII and LXD works.

So what made the above different outcomes?

image.png

Above, Ubuntu Disks application output of my disks…

image.png

The 480GB SSD is what I originally configured sudo lxd init to use as storage which at the time

was ( /dev/sdc )

However, now its /dev/sdd not the original /dev/sdc that it was before I BOOTed with the

the external 4TB USB 3.0 HD already ON (re its USB/SATAIII docking station turned on).

image.png

If the USB/SATAIII disk is ON when I boot then as you can see from above that init

automatically names the externally attached USB disk as /dev/sda.

This means, on boot, if the external USB/SATAIII disk is already ON then all of the previous

disk devices get " bumped " by one /dev/sdx letter.

What was my LXD storage (/dev/sdc) has now become (/dev/sdd) and LXD no longer knows

where it lives.

So when I now execute ( lxc list ) it errors iyr:

$ lxc list
Error: Get “http://unix.socket/1.0”: EOF

and LXD/LXC is not functional any longer as no - $ lxc works any longer.

There there is a workaround to avoid this…

Wait until after your system boots to turn on the External USB/SATAIII docking station and its disk(s)

This works best because those USB attached SATAIII disks will just be added as the next available

/dev/sdx drive letter not /dev/sda

image.png

So booting into Ubuntu first, then turning on the external USB/SATAIII docking station and its Disk(s)

now the 4TB HD gets assigned /dev/sdd and all is good for LXD.

Hope this makes sense and perhaps helps someone else.

Brian

Yeah, that’s why you’ll usually see howtos using stable entries under /dev/disk/by-id/ when possible rather than using /dev/sdX as the sdX order is entirely dependent on detection order and so can vary even with the same hardware plugged in.

1 Like