redhat-performance / tuned

Tuning Profile Delivery Mechanism for Linux
GNU General Public License v2.0
814 stars 178 forks source link

Manually installing tuned from source doesn't work on Fedora 39 #599

Closed superm1 closed 7 months ago

superm1 commented 7 months ago

I originally tried to build an RPM, but I failed due to https://github.com/redhat-performance/tuned/issues/597 and then the follow on issue after that one is solved. So I shifted over to trying to install from source instead.

It installs fine:

$ git checkout https://github.com/redhat-performance/tuned/
$ cd tuned
$ sudo make install 
mkdir -p /usr/local/lib/python3.12/site-packages
mkdir -p /usr/lib/tuned
mkdir -p /var/lib/tuned
mkdir -p /var/log/tuned
mkdir -p /run/tuned
mkdir -p /usr/share/doc/tuned
mkdir -p /etc
mkdir -p /usr/lib/tuned/recommend.d
mkdir -p /etc/tuned/recommend.d
# library
cp -a tuned /usr/local/lib/python3.12/site-packages
# binaries
install -Dm 0755 tuned.py /usr/sbin/tuned && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|' /usr/sbin/tuned && touch -r tuned.py /usr/sbin/tuned;
install -Dm 0755 tuned-adm.py /usr/sbin/tuned-adm && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|' /usr/sbin/tuned-adm && touch -r tuned-adm.py /usr/sbin/tuned-adm;
install -Dm 0755 tuned-gui.py /usr/sbin/tuned-gui && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|' /usr/sbin/tuned-gui && touch -r tuned-gui.py /usr/sbin/tuned-gui;
install -Dpm 0755 systemtap/diskdevstat /usr/sbin/diskdevstat;  install -Dpm 0755 systemtap/netdevstat /usr/sbin/netdevstat;  install -Dpm 0755 systemtap/scomes /usr/sbin/scomes;
install -Dm 0755  systemtap/varnetload  /usr/sbin/varnetload && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|'  /usr/sbin/varnetload && touch -r  systemtap/varnetload  /usr/sbin/varnetload;
# glade
install -Dpm 0644 tuned-gui.glade /usr/share/tuned/ui/tuned-gui.glade
# tools
install -Dm 0755  experiments/powertop2tuned.py  /usr/bin/powertop2tuned && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|'  /usr/bin/powertop2tuned && touch -r  experiments/powertop2tuned.py  /usr/bin/powertop2tuned;
# configuration files
install -Dpm 0644 tuned-main.conf /etc/tuned/tuned-main.conf
# None profile in the moment, autodetection will be used
echo -n > /etc/tuned/active_profile
echo -n > /etc/tuned/profile_mode
echo -n > /etc/tuned/post_loaded_profile
install -Dpm 0644 bootcmdline /etc/tuned/bootcmdline
install -Dpm 0644 modules.conf /etc/modprobe.d/tuned.conf
# profiles & system config
cp -a profiles/* /usr/lib/tuned/
mv /usr/lib/tuned/realtime/realtime-variables.conf \
    /etc/tuned/realtime-variables.conf
mv /usr/lib/tuned/realtime-virtual-guest/realtime-virtual-guest-variables.conf \
    /etc/tuned/realtime-virtual-guest-variables.conf
mv /usr/lib/tuned/realtime-virtual-host/realtime-virtual-host-variables.conf \
    /etc/tuned/realtime-virtual-host-variables.conf
mv /usr/lib/tuned/cpu-partitioning/cpu-partitioning-variables.conf \
    /etc/tuned/cpu-partitioning-variables.conf
mv /usr/lib/tuned/cpu-partitioning-powersave/cpu-partitioning-powersave-variables.conf \
    /etc/tuned/cpu-partitioning-powersave-variables.conf
install -pm 0644 recommend.conf /usr/lib/tuned/recommend.d/50-tuned.conf
# bash completion
install -Dpm 0644 tuned-adm.bash /usr/share/bash-completion/completions/tuned-adm
# runtime directory
install -Dpm 0644 tuned.tmpfiles /usr/lib/tmpfiles.d/tuned.conf
# systemd units
install -Dpm 0644 tuned.service /usr/lib/systemd/system/tuned.service
# dbus configuration
install -Dpm 0644 dbus.conf /usr/share/dbus-1/system.d/com.redhat.tuned.conf
# grub template
install -Dpm 0755 00_tuned /etc/grub.d/00_tuned
# kernel install hook
install -Dpm 0755 92-tuned.install /usr/lib/kernel/install.d/92-tuned.install
# polkit configuration
install -Dpm 0644 com.redhat.tuned.policy /usr/share/polkit-1/actions/com.redhat.tuned.policy
# manual pages
install -Dpm 0644 man/tuned.conf.5 /usr/share/man/man5/tuned.conf.5;  install -Dpm 0644 man/tuned-main.conf.5 /usr/share/man/man5/tuned-main.conf.5;   install -Dpm 0644 man/tuned-profiles.7 /usr/share/man/man7/tuned-profiles.7;  install -Dpm 0644 man/tuned-profiles-atomic.7 /usr/share/man/man7/tuned-profiles-atomic.7;  install -Dpm 0644 man/tuned-profiles-compat.7 /usr/share/man/man7/tuned-profiles-compat.7;  install -Dpm 0644 man/tuned-profiles-cpu-partitioning.7 /usr/share/man/man7/tuned-profiles-cpu-partitioning.7;  install -Dpm 0644 man/tuned-profiles-mssql.7 /usr/share/man/man7/tuned-profiles-mssql.7;  install -Dpm 0644 man/tuned-profiles-nfv-guest.7 /usr/share/man/man7/tuned-profiles-nfv-guest.7;  install -Dpm 0644 man/tuned-profiles-nfv-host.7 /usr/share/man/man7/tuned-profiles-nfv-host.7;  install -Dpm 0644 man/tuned-profiles-openshift.7 /usr/share/man/man7/tuned-profiles-openshift.7;  install -Dpm 0644 man/tuned-profiles-oracle.7 /usr/share/man/man7/tuned-profiles-oracle.7;  install -Dpm 0644 man/tuned-profiles-postgresql.7 /usr/share/man/man7/tuned-profiles-postgresql.7;  install -Dpm 0644 man/tuned-profiles-realtime.7 /usr/share/man/man7/tuned-profiles-realtime.7;  install -Dpm 0644 man/tuned-profiles-sap.7 /usr/share/man/man7/tuned-profiles-sap.7;  install -Dpm 0644 man/tuned-profiles-sap-hana.7 /usr/share/man/man7/tuned-profiles-sap-hana.7;  install -Dpm 0644 man/tuned-profiles-spectrumscale-ece.7 /usr/share/man/man7/tuned-profiles-spectrumscale-ece.7;   install -Dpm 0644 man/diskdevstat.8 /usr/share/man/man8/diskdevstat.8;  install -Dpm 0644 man/netdevstat.8 /usr/share/man/man8/netdevstat.8;  install -Dpm 0644 man/scomes.8 /usr/share/man/man8/scomes.8;  install -Dpm 0644 man/tuned.8 /usr/share/man/man8/tuned.8;  install -Dpm 0644 man/tuned-adm.8 /usr/share/man/man8/tuned-adm.8;  install -Dpm 0644 man/tuned-gui.8 /usr/share/man/man8/tuned-gui.8;  install -Dpm 0644 man/varnetload.8 /usr/share/man/man8/varnetload.8;
# documentation
cp -a doc/README* /usr/share/doc/tuned
cp -a doc/*.txt /usr/share/doc/tuned
cp AUTHORS COPYING README.md /usr/share/doc/tuned
# libexec scripts
install -Dm 0755  libexec/defirqaffinity.py  /usr/libexec/tuned/defirqaffinity.py && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|'  /usr/libexec/tuned/defirqaffinity.py && touch -r  libexec/defirqaffinity.py  /usr/libexec/tuned/defirqaffinity.py;  install -Dm 0755  libexec/pmqos-static.py  /usr/libexec/tuned/pmqos-static.py && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|'  /usr/libexec/tuned/pmqos-static.py && touch -r  libexec/pmqos-static.py  /usr/libexec/tuned/pmqos-static.py;
# icon
install -Dpm 0644 icons/tuned.svg /usr/share/icons/hicolor/scalable/apps/tuned.svg
# desktop file
install -dD /usr/share/applications
desktop-file-install --dir=/usr/share/applications tuned-gui.desktop

But then try to run it:

 sudo /usr/sbin/tuned
Traceback (most recent call last):
  File "/usr/sbin/tuned", line 27, in <module>
    import tuned.logs
ModuleNotFoundError: No module named 'tuned'

According to INSTALL it says:

y default, the tuned modules are installed to the Python3 destination (e.g. /usr/lib/python3.6/site-packages/)

But looking at the above log, I guess it didn't install somewhere that works by default in Fedora

cp -a tuned /usr/local/lib/python3.12/site-packages

superm1 commented 7 months ago

It seems like it's the shebang on /usr/sbin/tuned. This lets it launch.

diff --git a/tuned.py b/tuned.py
index 460482b..9bc823b 100755
--- a/tuned.py
+++ b/tuned.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3 -Es
+#!/usr/bin/python3 -E
 #
 # tuned: daemon for monitoring and adaptive tuning of system devices
 #