Skip to content

Allows boostrap systemd check to pass if either systemd or systemctl are found #1032

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dpritchett
Copy link

@dpritchett dpritchett commented May 3, 2025

Closes #1019.

Test log

Ubuntu 24.10 box with systemd installed

Correctly identifies the existence of systemctl.

daniel@dp-rb-jupyterhub:~$ cat /proc/version
Linux version 6.11.0-9-generic (buildd@lcy02-amd64-093) (x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-4ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.43.1) #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024
daniel@dp-rb-jupyterhub:~$ ./check_systemd_exists.test.py
INFO:tljh_test:testing systemd binary locator check	python=3.12.7 (main, Feb  4 2025, 14:46:03) [GCC 14.2.0]
INFO:tljh_test:found at least one of systemctl or systemd
INFO:tljh_test:/usr/bin/systemctl
INFO:tljh_test:None

Darwin box with no systemd

Correctly identifies no systemd present.

> uname -a
Darwin johnny-mnemonic 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:40 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6031 arm64 arm Darwin

the-littlest-jupyterhub on  djp-adjust-systemd-check [?] via 🐍 v3.12.4
> ./check_systemd_exists.test.py
INFO:tljh_test:testing systemd binary locator check	python=3.12.4 (main, Jul 25 2024, 22:11:22) [Clang 18.1.8 ]
ERROR:tljh_test:did not find either systemctl or systemd

Test script used

Full test script for your reference:

#!/usr/bin/env python3

import sys
import shutil
import logging

logger = logging.getLogger('tljh_test')
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)


logger.info(f'testing systemd binary locator check\tpython={sys.version}')

if not any([shutil.which("systemctl"), shutil.which("systemd")]):
    logger.error("did not find either systemctl or systemd")
else:
    logger.info("found at least one of systemctl or systemd")
    logger.info(shutil.which("systemctl"))
    logger.info(shutil.which("systemd"))

@dpritchett dpritchett changed the title Allows boostrap systemd check to pass if either systemd or systemctl are found #1019 Allows boostrap systemd check to pass if either systemd or systemctl are found May 3, 2025
@dpritchett dpritchett changed the title #1019 Allows boostrap systemd check to pass if either systemd or systemctl are found Allows boostrap systemd check to pass if either systemd or systemctl are found May 3, 2025
@@ -205,6 +205,14 @@ def get_os_release_variable(key):
)


def host_has_systemd() -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've added this function, but it's not used

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye, whoops. I was contemplating breaking out more pieces to test before I noticed you already have an integration test suite running on GitHub Actions. I've stripped that part out, now to see if the other failures are relevant to this PR or not.

@dpritchett dpritchett marked this pull request as draft May 4, 2025 15:09
@dpritchett
Copy link
Author

Switching to Draft until I sort out the build matrix failures

@manics
Copy link
Member

manics commented May 14, 2025

The integration tests are flakey, they've passed after a rerun.

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

Successfully merging this pull request may close these issues.

Systemd as command not available on ubuntu 24.10, only have systemctl
2 participants