SUSE / suse-migration-services

GNU General Public License v3.0
7 stars 11 forks source link

Robust detection of root device #136

Closed schaefi closed 5 years ago

schaefi commented 5 years ago

Use the findmnt tool to detect the currently active root device This is related to Issue #134

schaefi commented 5 years ago

This is just a start, I guess there might be more changes needed to make the loop boot entry more robust. See #134 for details. We are also hitting a limit here since there could be really strange system root setups which we can't tackle all. But anything we can do to increase the current code should be imho done.

schaefi commented 5 years ago

The loading of the filesystem module of the rootfs should be not needed and is also flaky because the return value from blkid does not necessarily be in line with the grub module name used to support this filesystem. Therefore I deleted this part.

tserong commented 5 years ago

I just tried those two commands on my desktop system (Tumbleweed with btrfs root), and got:

# lsblk -p -n -r -o NAME,MOUNTPOINT | grep -E "/$" | uniq | cut -f1 -d" "
/dev/sda3
# findmnt -n -f -o SOURCE /
/dev/sda3[/@/.snapshots/1/snapshot]

Is the [/@/.snapshots/1/snapshot] bit going to cause trouble?

schaefi commented 5 years ago

grmbl I would say yes. The device string is used later in a blkid call. I don't think it will work with

blkid /dev/sda3[/@/.snapshots/1/snapshot]

tserong commented 5 years ago

I don't think it will work with

blkid /dev/sda3[/@/.snapshots/1/snapshot]

Correct:

# blkid /dev/sda3[/@/.snapshots/1/snapshot]
# echo $?
2
schaefi commented 5 years ago

yeah we can't do it the way I thought it would be nicer :( Let's close this