Bugzilla – Bug 959181
fatresize: SD card resize fails due to incorrect /dev/mmcblk* path
Last modified: 2019-12-26 16:55:44 UTC
When resizing an SD card FAT filesystem via YaST partitioner, I encountered the error: fatresize '/dev/mmcblk0p1' Error: Could not stat device /dev/mmcblk0p - No such file or directory. fatresize incorrectly assumes that a base /dev/ path for a given partition can be obtained by stripping the trailing numeric suffix from the partition /dev path. Such an assumption works for /dev/sdX# paths but not for SD cards, which are assigned /dev/mmcblkXp# paths.
I've no business with fatresize in any way.
Hi Gertjan, would you like taking a look at this issue please? Please feel free to reassign whenever necessary, thank you.
Who assigned this bug to me and why?
I'm the right assignee for fatresize stuff as it is part of the parted package. It is quite easy to find out: > # zypper wp `which fatresize` > $ osc bugowner -e parted The expert partitioner is part of yast2-storage. So +CC Arvin Schnell. Thanks for reporting! I'm able to reproduce this on Leap 42.3 now. Moving to Leap 42.3 as 42.1 is already dead. I've tried to shrink my FS on a 32GB SD card to 5GB. YaST called this: > # /usr/sbin/fatresize '/dev/mmcblk0p1' 5245221 > Error: Could not stat device /dev/mmcblk0p - No such file or directory. > ped_device_get failed I'll work on this.
fatresize 0.1 included with parted must be ancient if version 1.0.2 at > https://sourceforge.net/projects/fatresize/files/fatresize/ is from 2005 already. The project seems to be dead. Everybody but us forks version 1.0.2 and applies custom patches on top but usage is different. Shouldn't be too hard to support the old usage with new fatresize with a custom patch. @Arvin: Can fatresize be replaced with something different? Can we upgrade to version 1.0.2 at least? Should I create a Fate for this? TIA
Looks like the original author created a version 1.0.3 last year and continues work on GitHub: > https://github.com/ya-mouse/fatresize
Latest upstream at commit 46cf019fe771 is also affected. > # ./fatresize -s 5245221 /dev/mmcblk0p1 > fatresize 1.0.3 () > Error: Could not stat device /dev/mmcblk0p - No such file or directory. I had to remove man page auto-generation to make it compile as it fails on Leap 42.3 with our docbook packages. Reported to upstream at: https://github.com/ya-mouse/fatresize/issues/2
(In reply to Sebastian Parschauer from comment #6) > @Arvin: Can fatresize be replaced with something different? Can we upgrade > to version 1.0.2 at least? Should I create a Fate for this? TIA Using another command in upcoming releases (including SLE 15) is no problem for me. We just have to coordinate so that "fatresize" and YaST are updated at the same time. I do not need a feature request for that.
Only internal SD card readers like the one in my Lenovo Thinkpad X250 laptop are affected. Possible workaround: Use a USB SD card reader presenting SCSI devices to the OS.
I've used my leisure time for this as I wouldn't get enough priority for this otherwise. Here is the fix for upstream: > https://github.com/ya-mouse/fatresize/pull/4
Created attachment 751168 [details] fatresize: Fix getting device name from partition name Backport for Leap 42.3 and SLES12-SP3.
This is queued in home:sparschauer:branches:Base:System/parted together with the upgrade to 1.0.3. I've reworked it again to use platform independent ped_device_get() instead of POSIX open(). What still does not work is partition guessing when providing the disk device path. But I think we can live with that as YaST should always provide a partition path. # fatresize -i /dev/sdb fatresize 1.0.3 () FAT: fat32 ... Can't get partition number. /dev/sdb1 is assumed. # fatresize -i /dev/mmcblk0 fatresize 1.0.3 () You must specify exactly one existing device. Partition number 0 and disk device /dev/mmcblk is assumed.
Created attachment 753712 [details] fatresize: Fix getting device name from partition name Updated patch backport for fatresize 0.1. This one uses ped_device_get() instead of open() now. We stick to version 0.1 in SLE15 as version 1.0.3 is plain too unstable and behaves differently. Tested with YaST against an SD card in internal SD card reader (/dev/mmcblk0p1) and external USB SD card reader (/dev/sdb1). Works absolutely the same way now.
@maint-coord: Please tag for parted SLE12-SP3 maintenance. TIA
(In reply to Sebastian Parschauer from comment #16) > @maint-coord: Please tag for parted SLE12-SP3 maintenance. TIA Done. Thanks for the heads-up.
Merged upstream: > https://github.com/ya-mouse/fatresize/commit/cf12400b5231e8a2eafc18c81428da618f741bb6 v1.0.4 has been released with all my fixes merged at upstream by now. This is also in SLE15 already. So closing as fixed.
SUSE-RU-2019:2741-1: An update that has 9 recommended fixes can now be installed. Category: recommended (moderate) Bug References: 1023818,1032562,1056508,1078820,1081547,1092327,1104667,959181,969165 CVE References: Sources used: SUSE CaaS Platform 3.0 (src): parted-3.1-35.3.17 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.