francescotescari / XiaoMiToolV2

XiaomiTool V2 - Modding tool for xiaomi devices
https://www.xiaomitool.com
Apache License 2.0
627 stars 123 forks source link

Fix/linux login url #41

Open edd34 opened 2 years ago

edd34 commented 2 years ago

This fixes #40 for linux branch

heysagnik commented 2 years ago

Please release the new build

edd34 commented 2 years ago

Hi @devgossips you can still run the program with the fix by compiling it yourself. Please perform the following instructions :

Tell us if you succeed !

renefritze commented 2 years ago

I end up with this:

./gradlew build

> Configure project :
Project : => no module-info.java found

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x6e875475) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x6e875475

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

on

java --version
openjdk 18-ea 2022-03-15
OpenJDK Runtime Environment (build 18-ea+15-Ubuntu-4)
OpenJDK 64-Bit Server VM (build 18-ea+15-Ubuntu-4, mixed mode, sharing)

I've tried both openjdk 17 and 16 too, with same results

gastonmatias commented 2 years ago

I end up with this:

./gradlew build

> Configure project :
Project : => no module-info.java found

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x6e875475) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x6e875475

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

on

java --version
openjdk 18-ea 2022-03-15
OpenJDK Runtime Environment (build 18-ea+15-Ubuntu-4)
OpenJDK 64-Bit Server VM (build 18-ea+15-Ubuntu-4, mixed mode, sharing)

I've tried both openjdk 17 and 16 too, with same results

Same Here, any suggestion?

edd34 commented 2 years ago

Have you tried with "sudo" ?

renefritze commented 2 years ago

Have you tried with "sudo" ?

Kinda. I can reproduce the issue with this Dockerfile where the build runs as root:

FROM ubuntu:21.10
RUN apt update ; apt install -y openjdk-18-jdk git
RUN git clone --branch=fix/linux_login_url https://github.com/edd34/XiaoMiToolV2 /src
RUN cd /src/ && ./gradlew build
renefritze commented 2 years ago

After realizing that the README mentions java 11, I tried again with an older base image where one can install openjdk-11

FROM debian:stable-slim as builder
RUN apt update ; DEBIAN_FRONTEND=noninteractive apt install -y openjdk-11-jdk git x11-apps xserver-xorg-video-amdgpu \
    gtk2-engines libswt-gtk-4-java libxslt1.1 libxtst6 libxxf86vm1
RUN git clone --branch=fix/linux_login_url https://github.com/edd34/XiaoMiToolV2 /src
RUN cd /src/ && ./gradlew --no-daemon build

WORKDIR /src
CMD [ "./gradlew", "--no-daemon", "run" ]

This actually builds successfully. I can run that with

docker run -it --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix  --net=host -e DISPLAY=$DISPLAY  the_image_name

and successfully unlock my device. That's pretty rough since I mount the entire /dev tree. There's a nicer solution for that which still makes the phone usb device available to the container after fastboot/adb switch. For some reason you need to login before selecting your device. If you try to login after the process started the browser component hangs on "loading". The Dockerfile includes the amd driver, which is specific to my setup.

skylabhalo commented 2 years ago

I just can't this to build on ArchLinux which annoys me so much...

bunchofdutch commented 2 years ago

Hi @devgossips you can still run the program with the fix by compiling it yourself. Please perform the following instructions :

* Clone the project locally : `git clone git@github.com:edd34/XiaoMiToolV2.git` -> the fix exists within my fork and not yet within the official project.

* Checkout to the branch that contains the fix : `git checkout fix/linux_login_url`

* Compile and run the program using the gradlew executable with  `sudo ./gradlew build && sudo ./gradlew run` and then you should be good to go !

Tell us if you succeed !

Thanks a lot, thanks to this I was able to build fine on MX Linux 21. The fix gets me around the Xiaomi token error of XMT2_Linux_20.7.28.run. However, now I'm stuck on "Failed to unlock your device, Xiaomi server returned error 10000, request parameter error"

bunchofdutch commented 2 years ago

Correction: tried again with device in fastboot mode (earlier, I had to boot MIU to pick of the code that Xiaomi SMSed me for device verification and I was trying unlock from there). Now I get error 20045: Please use the common user tool on the official website

unfairDude commented 2 years ago

i guess another dead tool. i keep gettijg serviceToken error