How to import systemd under DNF package in Yocto?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to import systemd under DNF package in Yocto?

349 Views
zahir
Contributor I

I am trying to move DNF logging from the default filehandler(/var/log/dnf.log) to JournalHandler as part of a task.

My basic code snippet for this under my .py

import sys
import logging
from systemd.journal import JournalHandler
log = logging.getLogger('demo')
log.propagate = False
log.addHandler(JournalHandler())
log.setLevel(logging.INFO)


But I am seeing the below error,

from systemd import journal
ImportError: No module named 'systemd'
  • I am using the Yocto cross compiler
  • I have the below configuration already for yocto
inherit systemd
SYSTEMD_AUTO_ENABLE = "enable"
DISTRO_FEATURES_append = " systemd python3-systemd"


My system already supports systemd, the issue is with integrating systemd with DNF

ps -ef | grep systemd
root 2194 1 0 14:34 ? 00:00:01 /lib/systemd/systemd-journald
root 3567 1 0 14:34 ? 00:00:00 /lib/systemd/systemd-udevd
message+ 3799 1 0 14:34 ? 00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 3878 1 0 14:34 ? 00:00:00 /lib/systemd/systemd-logind
guest 7141 1 2 14:36 ? 00:00:00 /lib/systemd/systemd --user
guest 7174 7147 0 14:36 ttymxc3 00:00:00 grep --color=auto systemd
Is any solution for this plz...

 

Is there any solution for this?

0 Kudos
0 Replies