Bug 29157 - fastboot-android fail to use mke2fs
Summary: fastboot-android fail to use mke2fs
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 8
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: David GEIGER
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-20 01:51 CEST by Morgan Leijström
Modified: 2022-11-21 19:53 CET (History)
2 users (show)

See Also:
Source RPM: android-tools-10.0.0_r2-3.mga8.src.rpm
CVE:
Status comment:


Attachments

Description Morgan Leijström 2021-06-20 01:51:22 CEST
Description of problem:
fastboot-android is looking for mke2fs in /usr/bin/ instead of /usr/sbin/

   Example usage and result :  (trying to manually upgrade /e/ on my Fairphone 3)

§ Using sudo here, because user rights are broken, Bug 28860
§ Use with USB attached Android phone in fastboot mode, unlocked
/!\ If you test and succeed you will have erased user data off that phone...

$ sudo /usr/bin/fastboot-android -w
Erasing 'userdata'                                 OKAY [  0.213s]
/usr/bin/mke2fs failed with status 1
fastboot: error: Cannot generate image for userdata

Checking: /usr/bin/mke2fs does not exist, and no package provides it at that location.
package e2fsprogs provides /sbin/mke2fs
Trying to work around it by linking mke2fs to the other folder fail, in another way

$ sudo ln -s /sbin/mke2fs /usr/bin/mke2fs
$ sudo /usr/bin/fastboot-android -w
Erasing 'userdata'                                 OKAY [  0.147s]
mke2fs 1.45.6 (20-Mar-2020)
/tmp/TemporaryFile-9wLxnZ: Unimplemented ext2 library function while setting up superblock
/usr/bin/mke2fs failed with status 1
fastboot: error: Cannot generate image for userdata


Now where "Unimplemented ext2 library function" comes from is beyond me.
Comment 1 Dave Hodgins 2021-06-20 02:42:57 CEST
Agreed the path needs to be fixed. Assigning to the registered maintainer.

I have no experience with android tools, however regarding the unimplemented
ext2 library function

It's trying to run mkfs -q on a file.

[dave@x8t tmp]$ dd if=/dev/zero of=testfs bs=1G count=2
2+0 records in
2+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 1.82026 s, 1.2 GB/s
[dave@x8t tmp]$ mkfs.ext4 -q testfs
[dave@x8t tmp]$

So the mkfs command should work provided a large enough file or device was
specified. It's run from ...
core-10.0.0_r2/fs_mgr/libfiemap_writer/fiemap_writer_test.cpp
which has ...
static constexpr uint64_t fs_size = 2147483648;
so it's expecting a 2GB file or device.

It also has ...
fs_path = std::string(getenv("TMPDIR")) + "/ext4_2G.img";

Normally TMPDIR is set to /tmp, a tmpfs filesystem kept in ram.

Please provide more info about how the preparations were set up, device
connections, output of "env|grep TMPDIR" and "df|grep /tmp"

CC: (none) => davidwhodgins
Assignee: bugsquad => geiger.david68210

Comment 2 Morgan Leijström 2021-06-20 03:54:52 CEST
Wow what analysis, so quick :)

Phone: Fairphone 3.
Connection: Full USB-C to USB2 on desktop machine running Mageia 8.

$ env|grep TMPDIR
TMPDIR=/tmp
GCONF_TMPDIR=/tmp

$ df|grep /tmp
tmpfs                          7,9G   8,0K   7,9G   1% /tmp


I do not remember this failing when i used it last september on same Phone, and from Mageia. I dont remember which PC/laptop or if i used mga7 or Cauldron (now mga8).  

Difference is that then i replaced the stock OS with /e/ development snapshot, now i write it over with current official, so maybe the partition is different between OS versions?

Anyhow, i need to use the phone now, and only problem seem to be that the procedure failed to clear old user data (want to because potentially something may be incompatible) so i opted for the built in factory reset instead for this part of procedure.
Comment 3 Morgan Leijström 2021-07-17 23:05:39 CEST
I see a fix of this noted as implemented in bug in progress:
https://bugs.mageia.org/show_bug.cgi?id=28860#c19

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=28860

Comment 4 Morgan Leijström 2021-07-22 10:35:33 CEST
Tested it works 

Performed reinstall of /e/ on my Fairphone 3, including issuing "fastboot -w" successfully.

(Per bug 28860 as normal user using "fastboot", not "fastboot-android")
Comment 5 Stig-Ørjan Smelror 2022-11-21 19:33:18 CET
Morgan, have you tried the latest version of android-tools to see if this issue has been fixed?

CC: (none) => smelror

Comment 6 Morgan Leijström 2022-11-21 19:36:08 CET
No.
And I am (trying to) have a vacation from IT stuff ;)
Comment 7 Stig-Ørjan Smelror 2022-11-21 19:53:49 CET
(In reply to Morgan Leijström from comment #6)
> No.
> And I am (trying to) have a vacation from IT stuff ;)

Happy IT-free holidays :-)

Note You need to log in before you can comment on or make changes to this bug.