mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
751 stars 40 forks source link

Windows 11 Insider Builds required for script? #45

Closed traycerb closed 1 year ago

traycerb commented 1 year ago

Device info

Manufacturer: google Android version: 11 Custom ROM/rooted? No Model: Pixel 4a5g

System info

Available disk space: 80gb Operating system: Microsoft Windows 10 [Version 10.0.19045.2364] WSL2 Ubuntu

I get the following error in the script, when it gets to thee part about loading the graphical file chooser for the backup location


Note: Backups will first be made on the drive this script is located in, and then will be copied to the specified location.
Running on Windows (WSL) - a graphical file chooser dialog will be open.
You will be prompted for the backup location. Press Enter to continue.

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Can't find directory ''
Please re-enter the path, or hit ^C to exit
Note: Backups will first be made on the drive this script is located in, and then will be copied to the specified location.
Running on Windows (WSL) - a graphical file chooser dialog will be open.
You will be prompted for the backup location. Press Enter to continue.

I haven't upgraded to Windows 11 (honestly mostly because I would like to keep my taskbar on the side >_<) but it seems that most recent Windows 11 (and specifically Insider Builds) are required for the script as the directory choosing option requires a Linux GUI to choose the backup destination. Is this the case? If so, is it possible to enter the directory manually instead? I have no problem with GUIs, but for choosing an install directory, I don't think commandline is too far behind (I suppose it depends on if it's freetext vs completion). Is my understanding of the situation correct?

mrrfv commented 1 year ago

I wrote this feature on Windows 10 and it worked perfectly in my testing, so this shouldn't occur. Could you try installing libqt5x11extras5 on your Ubuntu container and see if it fixes the issue?

traycerb commented 1 year ago

Thanks for answering. It looks like I had it installed already. Sorry, I know debugging this kind of thing is frustrating, so many different enviroments to account for, esp multi-platform. I just tried again, same result. Tried both running the .ps1 file by double-clicking in explorer, and from MS Term's Powershell.

|~\> sudo apt install libqt5x11extras5
Reading package lists... Done
Building dependency tree
Reading state information... Done
libqt5x11extras5 is already the newest version (5.12.8-0ubuntu1).
libqt5x11extras5 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I did find some reference to setting the DISPLAY variable export DISPLAY=:0. Before setting this when I echo $DISPLAY it shows nothing, but after setting it, it shows :0. Since I'm doing on the command line, this change doesn't persist. I could put it in one of the various config files, but I'm not sure which one, or even if its relevant at all.

EDIT: I tried adding the export line to my .profile, exited restarted terminal confirmed with echo $DISPLAY, and re-ran the ps1 script and same error.

EDIT2: I worked around this by removing the kdialog section in functions\backup_func.sh:


    # Check if we're running on Windows.
    # If we are, then we will open a file chooser instead of asking the user for the file path thru CLI
    # due to compatibility issues.
    # TODO: also do this on Linux if KDialog is available
    #if [ "$(uname -r | sed -n 's/.*\( *Microsoft *\).*/\1/ip')" ];
    #then
    #   cecho "Running on Windows (WSL) - a graphical file chooser dialog will be open."
    #   cecho "You will be prompted for the backup location. Press Enter to continue."
    #   wait_for_enter
    #   archive_path=$(kdialog --getexistingdirectory /mnt/c || true)
    #else
        text_input "Please enter the backup location. Enter '.' for the current working directory." archive_path "."
    #fi

This is very crude naturally, but it did allow the backup to progress, seems to be working, will see if it completes successfully. Also, after execution, the .sh file is reverted back to original? Not sure exactly. In any case, this seems to be easier solution than debugging the above, but getting the GUI part working would of course also be preferred.

traycerb commented 1 year ago

I got an error, on the Exporting Contacts section:


Exporting contacts (as vCard).
2.37MiB 0:00:02 [ 927KiB/s] [         <=>                                                                                                                                                    ]
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
Errors occurred while backing up . - this file (or multiple files) might've been ignored.
Removing temporary files created by the companion app.
Exporting internal storage - this will take a while.

Related in any way? If not, any ideas about this? I don't really need my contacts exported, but just don't want it to affect any other part of the backup, either the actual backing up, or down the line, any restoration.

mrrfv commented 1 year ago

I got an error, on the Exporting Contacts section:


Exporting contacts (as vCard).

2.37MiB 0:00:02 [ 927KiB/s] [         <=>                                                                                                                                                    ]

tar: Unexpected EOF in archive

tar: Unexpected EOF in archive

tar: Error is not recoverable: exiting now

Errors occurred while backing up . - this file (or multiple files) might've been ignored.

Removing temporary files created by the companion app.

Exporting internal storage - this will take a while.

Related in any way? If not, any ideas about this? I don't really need my contacts exported, but just don't want it to affect any other part of the backup, either the actual backing up, or down the line, any restoration.

This is a known issue. Use the adb exporting method.

mrrfv commented 1 year ago

I can reproduce this on Windows 11 22H2 (works just fine on Windows 10 for me though)

mrrfv commented 1 year ago

It seems like WSL doesn't auto-update and sometimes even ships with an outdated version that's incapable of running GUI apps. The latest commit (https://github.com/mrrfv/linux-android-backup/commit/b61945de1b68268081ab933f26ccc2f55478e1e9) fixes this by ensuring WSL is fully up-to-date before continuing.