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

qubes-sync-time.service fails to start on Arch Linux because of Python2/3 issue #3872

Open
fishilico opened this Issue May 1, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@fishilico

Qubes OS version:

R4.0, with Arch Linux template built by following instructions from https://www.qubes-os.org/doc/building-archlinux-template/

Affected component(s):

qubes-sync-time.service (qvm-sync-clock systemd service)


Steps to reproduce the behavior:

  • Create a Arch Linux TemplateVM and an AppVM on Qubes OS R4.0.

  • Enumerate the services which failed to start (systemctl | grep failed). There is:

    * qubes-sync-time.service   loaded failed failed    Update time from ClockVM
    
  • Try to start the service, it fails again.

  • Start the program used by the service from a shell:

$ sudo /usr/bin/qvm-sync-clock
Traceback (most recent call last):
  File "/usr/lib/qubes/qubes-sync-clock", line 38, in <module>
    main()
  File "/usr/lib/qubes/qubes-sync-clock", line 35, in main
    stdout=subprocess.DEVNULL)
AttributeError: 'module' object has no attribute 'DEVNULL'

subprocess.DEVNULL only exists in Python 3, but /usr/lib/qubes/qubes-sync-clock starts with:

#!/usr/bin/python2

The source code used python3 (https://github.com/QubesOS/qubes-core-agent-linux/blob/v4.0.26/qubes-rpc/qubes-sync-clock#L1) but the Arch Linux package replaces every Python shebang with Python 2 (https://github.com/QubesOS/qubes-core-agent-linux/blob/v4.0.26/archlinux/PKGBUILD#L48-L52):

    # Force running all scripts with python2
    sed 's:^#!/usr/bin/python.*:#!/usr/bin/python2:' -i misc/*
    sed 's:^#!/usr/bin/env python.*:#!/usr/bin/env python2:' -i misc/*
    sed 's:^#!/usr/bin/python.*:#!/usr/bin/python2:' -i qubes-rpc/*
    sed 's:^#!/usr/bin/env python.*:#!/usr/bin/env python2:' -i qubes-rpc/*

As /usr/lib/qubes/qubes-sync-clock is not compatible with Python 2, /usr/bin/qvm-sync-clock fails, and so does the service qubes-sync-time.service.

Expected behavior:

qubes-sync-time.service works fine.

Actual behavior:

qubes-sync-time.service fails to start, because it tries to run Python 3 code with Python 2.

General notes:

There seems to be an ongoing effort to make Arch Linux packages use Python 3 Qubes libraries (e.g. QubesOS/qubes-core-qubesdb@5efa37d ). This issue may be solved by ensuring every Python library used to interact with Qubes OS from an Arch Linux template is installed in its Python 3 version.


Related issues:

I opened this issue because I have not found any issue related to migrating to Python 3.
It might be related to the more general "Archlinux template for QubesOS 4.0" issue, #3185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment