Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIT hangs when starting a backup as root #1580

Closed
jim-moe opened this issue Dec 8, 2023 · 12 comments
Closed

BIT hangs when starting a backup as root #1580

jim-moe opened this issue Dec 8, 2023 · 12 comments
Assignees
Milestone

Comments

@jim-moe
Copy link

jim-moe commented Dec 8, 2023

BackInTime v1.4.1 (from opensuse OSS main repo)
Opensuse tumbleweed v20231130
linux 6.6.3-1-default x86_64
python 3.11.6
rsync version 3.2.7 protocol version 31

BIT hangs when starting a backup as user root. This is not a problem for non-privileged users.
It is similar to the issue with xdpyinfo; I could bypass that by killing the xdpyinfo instance.

The hang occurs here, shown by ps. When this process is killed, BIT proceeds to backup.
root 31136 35.7 0.0 190892 26960 ? SNl 09:00 19:36 \_ /usr/bin/python3 /usr/share/backintime/common/qt5_probing.py
There was nothing unusual in the system journal. There was nothing noted in takesnashpot_.log.

$ backintime --diagnostics
Traceback (most recent call last):
  File "/usr/share/backintime/common/backintime.py", line 1190, in <module>  startApp()
  File "/usr/share/backintime/common/backintime.py", line 507, in startApp
    args = argParse(None)
           ^^^^^^^^^^^^^^
  File "/usr/share/backintime/common/backintime.py", line 568, in argParse
    args, unknownArgs = mainParser.parse_known_args(args)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/argparse.py", line 1902, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/argparse.py", line 2114, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/argparse.py", line 2054, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib64/python3.11/argparse.py", line 1978, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/share/backintime/common/backintime.py", line 742, in __call__
    diagnostics = collect_diagnostics()
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/backintime/common/diagnostics.py", line 74, in collect_diagnostics
    'OS': _get_os_release()
          ^^^^^^^^^^^^^^^^^
  File "/usr/share/backintime/common/diagnostics.py", line 398, in _get_os_release
    return osrelease['os-release']
           ~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'os-release'
@aryoda
Copy link
Contributor

aryoda commented Dec 9, 2023

Thanks a lot for your detailed issue report!

Q1: Are you using wayland or X11?
You can check this in the console with echo $XDG_SESSION_TYPE.

Q2: Have you also installed the BiT GUI (backintime-qt) or only the command line backend (backintime)?

Q3: Could you please show me the output of

python3 /usr/share/backintime/common/qt5_probing.py; echo $?

and

# In case of X11:
pkexec env DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 /usr/share/backintime/common/qt5_probing.py; echo $?

# In case of Wayland:
pkexec env QT_QPA_PLATFORM=wayland-egl XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 /usr/share/backintime/common/qt5_probing.py; echo $?

This is an isolated test of the python code that seems to block as root but not as normal user...

Edit: The qt5_probing.py code tries to find out if Qt5 is installed and works (mainly to be able to show the BiT systray icon)

@buhtz --diagnostics does fail, do you see an obvious reason for that?

@buhtz
Copy link
Member

buhtz commented Dec 9, 2023

@buhtz --diagnostics does fail, do you see an obvious reason for that?

I am working on it.

Easy to reproduce on a fresh Suse Tumble... VM. Fixed via #1581

Note to @jim-moe : The bug was covered by a unit test. So I assume you have not run unit tests before packaging BIT for Suse. No offense. Even Debian/Ubuntu do not run the tests. We do work on an easier handling of the test suite, too. But until then I would suggest you to run the unit test manually on your own machine before finishing the packaging.

@jim-moe
Copy link
Author

jim-moe commented Dec 9, 2023

Q1: Are you using wayland or X11?

wayland

Q2: Have you also installed the BiT GUI (backintime-qt) or only the command line backend (backintime)?

BiT GUI is installed.

Q3: Could you please show me the output of

$ python3 /usr/share/backintime/common/qt5_probing.py; echo $?
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
1
$ sudo python3 /usr/share/backintime/common/qt5_probing.py; echo $?
[sudo] password for root: 
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.

1
 pkexec env QT_QPA_PLATFORM=wayland-egl XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 /usr/share/backintime/common/qt5_probing.py; echo $?
qt.qpa.plugin: Could not load the Qt platform plugin "wayland-egl" 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.

1

@aryoda
Copy link
Contributor

aryoda commented Dec 9, 2023

OK, I need to set up an OpenSuse VM to look deeper into the actual configuration that may cause problems.

  • Which desktop environment are you using?
  • Does the backup hang reproducibly on each run or only sporadically (and always in qt5_probing.py?)?

BIT hangs when starting a backup as user root.

How did you start the backup? Via BiT GUI, cmd line (manually) or scheduled (cron or similar)?

@jim-moe
Copy link
Author

jim-moe commented Dec 10, 2023

  • Which desktop environment are you using?

gnome 45.2

  • Does the backup hang reproducibly on each run or only sporadically (and always in qt5_probing.py?)?

Yes, quite reproducibly. Previously, it was xdptinfo that was the culprit.; now it is qt5_probing.py.

@jim-moe
Copy link
Author

jim-moe commented Dec 10, 2023

How did you start the backup? Via BiT GUI, cmd line (manually) or scheduled (cron or similar)?

Cron.

buhtz added a commit that referenced this issue Dec 10, 2023
This fix a minor bug (discovered in #1580) in context of diagnostic output handling os-release file.

Related: #1580
@aryoda
Copy link
Contributor

aryoda commented Dec 10, 2023

Yes, quite reproducibly. Previously, it was xdptinfo that was the culprit.; now it is qt5_probing.py.

Is there any kind of non-standard hardening enabled (beyond the standard installation)?

@jim-moe
Copy link
Author

jim-moe commented Dec 10, 2023

Is there any kind of non-standard hardening enabled (beyond the standard installation)?

No.

@ptilopteri
Copy link

I am running openSUSE Tumbleweed and have same problem with
qt5_probing.py hanging when running as root from a cron instance.
Sometimes killing that instance allows bt to complete, sometimes not.
I have found no why it sometimes fails to complete. But starting the
job from the GUI always completes (for me).

this action is recent but I cannot tell you when it began.

backintime-qt-1.4.1-1.1.noarch
backintime-1.4.1-1.1.noarch
installed Wed 15 Nov 2023 09:07:40 AM EST

but the hanging began prior to that.

@aryoda
Copy link
Contributor

aryoda commented Dec 11, 2023

I am still having problems to set up a working VM with Tumbleweed and Gnome with vagrant (getting support for this)
so it takes some time to try to reproduce and fix this...

@aryoda
Copy link
Contributor

aryoda commented Dec 21, 2023

@jim-moe I have set up a VM now but could not reproduce the problem.

For details see my post in another issue with the same problem: #1592 (comment)

Could you please provide me more details on how to reproduce this problem (see linked post above)? THX :-)

Edit: I am esp. interested if you are using anachron and if the problem occurs "only" when no user is logged into a desktop environment (eg. directly after booting)

aryoda added a commit to aryoda/backintime that referenced this issue Dec 29, 2023
…run as root and no user is logged into a desktop environment
aryoda added a commit to aryoda/backintime that referenced this issue Jan 4, 2024
…robing.py" hangs; Cannot launch BiT (root) on Wayland

- "qt5_probing.py" hangs when BiT is run as root and no user is logged into a desktop environment

- BiT (root) starter script does not set Qt5 wayland-egl plugin anymore but uses the default (like BiT userland)

- Improve logging (all sub process do now use the log context "backintime" too for easy journalctl grepping
aryoda added a commit to aryoda/backintime that referenced this issue Jan 4, 2024
…robing.py" hangs; Cannot launch BiT (root) on Wayland

- "qt5_probing.py" hangs when BiT is run as root and no user is logged into a desktop environment

- BiT (root) starter script does not set Qt5 wayland-egl plugin anymore but uses the default (like BiT userland)

- Improve logging (all sub processes do now use the log context "backintime" too for easy journalctl grepping
@aryoda aryoda added this to the 1.4.2 (upcoming release) milestone Jan 4, 2024
aryoda added a commit that referenced this issue Jan 4, 2024
…h BiT (root) on Wayland

* "qt5_probing.py" hangs when BiT is run as root and no user is logged into a desktop environment
*  BiT (root) starter script does not set Qt5 wayland-egl plugin anymore but uses the default (like BiT userland)
*  Different Wayland Qt plugin was used in BiT (root) vs. BiT user-space: Now no wayland is enforced anymore
*  Improve logging (all sub processes do now use the log context "backintime" too for easy journalctl filtering via the )

Was PR #1597
@aryoda
Copy link
Contributor

aryoda commented Jan 5, 2024

Closed with PR #1597

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants