Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#38487 - [os-prober] failed to work with "blkid" (util-linux 2.24-2)

Attached to Project: Community Packages
Opened by Ken Shaomu (kshaomu) - Monday, 13 January 2014, 13:46 GMT
Last edited by Timothy Redaelli (tredaelli) - Wednesday, 01 October 2014, 09:17 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Timothy Redaelli (tredaelli)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
the current blkid in util-linux-2.24 can now recognize the extend
partition, but os-prober relies on the return value "2" (exit_not_found)
of blkid to skip processing the extend partition.

so, os-prober will try to mount the extend partition with FS types
found in the system, which is dangerous.

# fdisk -l
....
Device Boot Start End Blocks Id System
/dev/sda1 * 63 252847034 126423486 7 HPFS/NTFS/exFAT
/dev/sda2 252847035 625137344 186145155 5 Extended
/dev/sda5 252847098 253425374 289138+ 83 Linux
/dev/sda6 385254828 482913899 48829536 83 Linux
....


blkid 2.24-2
---
# blkid /dev/sda2
/dev/sda2: PTTYPE="dos" PARTUUID="28b48ca1-02"
# echo $?
0

# blkid -o value -s TYPE /dev/sda2 # no output
# echo $?
0


blkid 2.20.0
---
# blkid /dev/sda2 # no output
# echo $?
2
# blkid -o value -s TYPE /dev/sda2 # no output
# echo $?
2


Affected os-prober code:
---
File: /usr/lib/os-probes/50mounted-tests
-
8 types="$(fs_type "$partition")" || types=NOT-DETECTED
9 if [ "$types" = NOT-DETECTED ]; then
10 debug "$1 type not recognised; skipping"
11 exit 0


With the old blkid (util-linux-2.20),
os-prober will just skip here when handling /dev/sda2,
but with the new version of blkid,
os-prober will go on and try to mount /dev/sda2 with
FS types found in the system, which causes lots of errors,
even kernel calltrace when trying xfs.


Additional info:
* os-prober 1.58-1
* util-linux 2.24-2


Steps to reproduce:
1. run os-prober
# os-prober

2. check the log
# journalctl
with util-linux-2.20, the log is like:
--
50mounted-tests: debug: /dev/sda2 type not recognised; skipping
--
but with util-linux-2.24, os-prober will try various FS types to
mount /dev/sda2

3. check dmesg
as xfs exists in the system, a kernel calltrace will show,
xfs tool would try to "fix" the "data corruption".
This task depends upon

Closed by  Timothy Redaelli (tredaelli)
Wednesday, 01 October 2014, 09:17 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in 1.58-3.
Patch taken from https://bugs.debian.org/cgi-bin/bugrepor t.cgi?bug=735169
Comment by Ken Shaomu (kshaomu) - Monday, 13 January 2014, 13:52 GMT
this should be an upstream bug, but other major distributions
are using the old util-linux-2.20, so they do not suffer this
problem.

for archlinux, i think we should at least have a workaround
note somewhere.


solutions i could think about:
1. change the way that os-prober detects devices.
2. make blkid return an error code when
# blkid -o value -s TYPE /dev/sdaX
returns no proper result.
3. use the old version of blkid (util-linux).
Comment by Dave Reisner (falconindy) - Monday, 13 January 2014, 14:20 GMT
This really needs to be fixed in os-prober -- the code is just bad. Attached patch should be a brought to upstream.
Comment by Ken Shaomu (kshaomu) - Tuesday, 14 January 2014, 03:30 GMT
Hi Dave,

your patch will make some code never be executed,
as in file:50mounted-tests, line 22:
---
18 elif [ "$types" = ntfs ]; then
...
22 elif [ -z "$types" ]; then
...


should also do some cleanup?

Loading...