Askannz / optimus-manager

A Linux program to handle GPU switching on Optimus laptops.
MIT License
2.28k stars 166 forks source link

Optimus manager not wroking properly #545

Closed BALVEY7 closed 1 year ago

BALVEY7 commented 1 year ago

The issue started when I runned basic command to update the system in this case is [pacman -Syu] after that [reboot]. It all started with Steam not being able to run games that are interactive form of a 3D version so I've reported this issue to steam dev for Linux. The issue of the system is that when I enable it and want to start it it does not lets me switch between graphics or use the nvidia at all. Here is a report of the status:

[arch@Arch` ~]$ systemctl status optimus-manager.service
× optimus-manager.service - Optimus Manager Commands Daemon
     Loaded: loaded (/usr/lib/systemd/system/optimus-manager.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Thu 2023-06-29 11:27:01 BST; 11min ago
   Duration: 18ms
    Process: 1349 ExecStartPre=/usr/bin/python3 -u -m optimus_manager.hooks.pre_daemon_start (code=exited, status=1/FAILURE)
    Process: 1350 ExecStartPre=/usr/bin/python3 -u -m optimus_manager.hooks.pre_xorg_start (code=exited, status=1/FAILURE)
    Process: 1351 ExecStart=/usr/bin/python3 -u -m optimus_manager.daemon (code=exited, status=1/FAILURE)
    Process: 1352 ExecStopPost=/usr/bin/python3 -u -m optimus_manager.hooks.post_daemon_stop (code=exited, status=1/FAILURE)
   Main PID: 1351 (code=exited, status=1/FAILURE)
        CPU: 102ms

Jun 29 11:27:01 Arch systemd[1]: Starting Optimus Manager Commands Daemon...
Jun 29 11:27:01 Arch python3[1349]: /usr/bin/python3: Error while finding module specification for 'optimus_manager.hooks.pre_daemon_start' (ModuleNotFoundError: No module named 'optimus_manager')
Jun 29 11:27:01 Arch python3[1350]: /usr/bin/python3: Error while finding module specification for 'optimus_manager.hooks.pre_xorg_start' (ModuleNotFoundError: No module named 'optimus_manager')
Jun 29 11:27:01 Arch systemd[1]: Started Optimus Manager Commands Daemon.
Jun 29 11:27:01 Arch python3[1351]: /usr/bin/python3: Error while finding module specification for 'optimus_manager.daemon' (ModuleNotFoundError: No module named 'optimus_manager')
Jun 29 11:27:01 Arch systemd[1]: optimus-manager.service: Main process exited, code=exited, status=1/FAILURE
Jun 29 11:27:01 Arch python3[1352]: /usr/bin/python3: Error while finding module specification for 'optimus_manager.hooks.post_daemon_stop' (ModuleNotFoundError: No module named 'optimus_manager')
Jun 29 11:27:01 Arch systemd[1]: optimus-manager.service: Control process exited, code=exited, status=1/FAILURE
Jun 29 11:27:01 Arch systemd[1]: optimus-manager.service: Failed with result 'exit-code'.
~
~

System info: GPU:1050ti Nvidia(not mobile)/Intel i7-7700HQ (its a laptop) CPU: Intel i7-7700HQ Make: Lenovo Legion y520-15ikbn Distro: Arch Linux KDE LTS (latest) Display manager: Arch SDDM The version of Optimus manager: 1.4-4 Config file: Config file.txt

pobrn commented 1 year ago

I think the following applies: https://wiki.archlinux.org/title/Python#Module_not_found_after_Python_version_update

A Python-based application might output No module named module_name for an installed dependency named module_name after having upgraded the python package to a new minor version (e.g. from version 3.10 to 3.11). [...] Please notice it is the user's responsibility to rebuild non-official packages, including Python-based packages installed from AUR

BALVEY7 commented 1 year ago

I think the following applies: https://wiki.archlinux.org/title/Python#Module_not_found_after_Python_version_update

A Python-based application might output No module named module_name for an installed dependency named module_name after having upgraded the python package to a new minor version (e.g. from version 3.10 to 3.11). [...] Please notice it is the user's responsibility to rebuild non-official packages, including Python-based packages installed from AUR

what do you suggest? sorry i'm new to this, do i need to basically rebuild the python? and how do i do that?

pobrn commented 1 year ago

Essentially you want to rebuild and reinstall the optimus-manager (or -git) package. E.g.

paru -S --rebuild optimus-manager
BALVEY7 commented 1 year ago

I've wrote the command but all I got is this

 [arch@Arch ~]$ paru -S --rebuild optimus-manager
:: Resolving dependencies...
:: Calculating conflicts...
:: Calculating inner conflicts...

Repo Make (4) python-pyproject-hooks-1.0.0-5  python-build-0.10.0-4  python-installer-0.7.0-3
    python-wheel-0.40.0-3
Aur (1) optimus-manager-1.5-3

:: Proceed to review? [Y/n]: y

:: Downloading PKGBUILDs...
 PKGBUILDs up to date
/home/arch/.cache/paru/clone/optimus-manager/PKGBUILD
# Maintainer: Robin Lange <robin dot langenc at gmail dot com>

pkgname=optimus-manager
pkgver=1.5
pkgrel=3
pkgdesc="Management utility to handle GPU switching for Optimus laptops"
arch=('any')
url="https://github.com/Askannz/optimus-manager"
license=('MIT')
conflicts=("optimus-manager-git")
provides=("optimus-manager=$pkgver")
depends=('python3' 'python-setuptools' 'python-dbus' 'glxinfo' 'xorg-xrandr')
optdepends=('bbswitch: alternative power switching method'
            'acpi_call: alternative power switching method'
            'xf86-video-intel: provides the Xorg intel driver')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel' 'git')
backup=('etc/optimus-manager/xorg/integrated-mode/integrated-gpu.conf'
        'etc/optimus-manager/xorg/nvidia-mode/integrated-gpu.conf'
        'etc/optimus-manager/xorg/nvidia-mode/nvidia-gpu.conf'
        'etc/optimus-manager/xorg/hybrid-mode/integrated-gpu.conf'
        'etc/optimus-manager/xorg/hybrid-mode/nvidia-gpu.conf'

        'etc/optimus-manager/xsetup-integrated.sh'
        'etc/optimus-manager/xsetup-nvidia.sh'
        'etc/optimus-manager/xsetup-hybrid.sh'

        'etc/optimus-manager/nvidia-enable.sh'
        'etc/optimus-manager/nvidia-disable.sh'

        'var/lib/optimus-manager/persistent/startup_mode')
source=("git+https://github.com/Askannz/optimus-manager.git#tag=v$pkgver")
sha256sums=('SKIP')

build() {

  cd "${srcdir}/optimus-manager/"
  python -m build --wheel --no-isolation

}

package() {

  install="optimus-manager.install"

  cd "${srcdir}/optimus-manager/"

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 modules/optimus-manager.conf "$pkgdir/usr/lib/modprobe.d/optimus-manager.conf"
  install -Dm644 systemd/optimus-manager.service "$pkgdir/usr/lib/systemd/system/optimus-manager.service"
  install -Dm644 optimus-manager.conf "$pkgdir/usr/share/optimus-manager.conf"

  install -Dm644 systemd/logind/10-optimus-manager.conf "$pkgdir/usr/lib/systemd/logind.conf.d/10-optimus-m>
  install -Dm755 systemd/suspend/optimus-manager.py "$pkgdir/usr/lib/systemd/system-sleep/optimus-manager.p>

  install -Dm644 login_managers/sddm/20-optimus-manager.conf "$pkgdir/etc/sddm.conf.d/20-optimus-manager.co>
  install -Dm644 login_managers/lightdm/20-optimus-manager.conf  "$pkgdir/etc/lightdm/lightdm.conf.d/20-opt>

  install -Dm644 config/xorg/integrated-mode/integrated-gpu.conf "$pkgdir/etc/optimus-manager/xorg/integrat>
  install -Dm644 config/xorg/nvidia-mode/nvidia-gpu.conf "$pkgdir/etc/optimus-manager/xorg/nvidia-mode/nvid>
  install -Dm644 config/xorg/nvidia-mode/integrated-gpu.conf "$pkgdir/etc/optimus-manager/xorg/nvidia-mode/>
  install -Dm644 config/xorg/hybrid-mode/integrated-gpu.conf "$pkgdir/etc/optimus-manager/xorg/hybrid-mode/>
  install -Dm644 config/xorg/hybrid-mode/nvidia-gpu.conf "$pkgdir/etc/optimus-manager/xorg/hybrid-mode/nvid>

  install -Dm755 config/xsetup-nvidia.sh "$pkgdir/etc/optimus-manager/xsetup-nvidia.sh"
  install -Dm755 config/xsetup-hybrid.sh "$pkgdir/etc/optimus-manager/xsetup-hybrid.sh"
  install -Dm755 config/xsetup-integrated.sh "$pkgdir/etc/optimus-manager/xsetup-integrated.sh"

  install -Dm755 config/nvidia-enable.sh "$pkgdir/etc/optimus-manager/nvidia-enable.sh"
  install -Dm755 config/nvidia-disable.sh "$pkgdir/etc/optimus-manager/nvidia-disable.sh"

  python -m installer --destdir="$pkgdir" dist/*.whl

}

/home/arch/.cache/paru/clone/optimus-manager/optimus-manager.install

post_install() {

    echo "optimus-manager : enabling optimus-manager.service"
    mkdir -p /etc/systemd/system/graphical.target.wants/
    ln -s /usr/lib/systemd/system/optimus-manager.service /etc/systemd/system/graphical.target.wants/optimu>

    bold=$(tput bold)
    red=$(tput setaf 1)
    normal=$(tput sgr0)
    echo "${bold}${red}Please reboot your computer before using optimus-manager${normal}"
}

post_remove() {

        echo "optimus-manager : cleaning up auto-generated Xorg conf"

    xorg_conf=/etc/X11/xorg.conf.d/10-optimus-manager.conf
    if [ -f "$xorg_conf" ]; then
        rm $xorg_conf
    fi

    echo "optimus-manager : disabling optimus-manager.service"

    service_file_link=/etc/systemd/system/graphical.target.wants/optimus-manager.service
    if [ -L "$service_file_link" ]; then
        rm $service_file_link
    fi

}
pobrn commented 1 year ago

That's the PKGBUILD in the pager, most likely less. If you're done checking the PKGBUILD, simply press q, then answer the prompt that appears.

BALVEY7 commented 1 year ago

ok done and then do I run pacman -R optimus-manager? as to reinstall it or that was done automatically? and if it did was automatic do i just reboot?

pobrn commented 1 year ago

You can just run optimus-manager --status to see if it now runs OK. If it does, you can reboot.

BALVEY7 commented 1 year ago

Yes it's working now and the steam is working too which fixed all the issues i was having. Thank you!

serranomorante commented 1 year ago

For those using pyenv