Skip to content
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

Added some workarounds for known issues, reviews appreciated #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SPAstef
Copy link

@SPAstef SPAstef commented Jul 15, 2020

Just as the title says, might need some polish, especially considering that all the DKMS stuff has no impact since we are not using it anymore. This has never been a problem IMO: every OS update I always had to reinstall the drivers anyway.
Another thing is that the installer is NOT run silently: if the generated keys get dropped, installation fails, and I found no command line option to keep them (if there is, then we can make the installer silent again, and avoid user confusion)

sudo mkdir /etc/modprobe.d
sudo mkdir -p /etc/modprobe.d
Copy link
Owner

Choose a reason for hiding this comment

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

This change is unnecessary because /etc exists by default.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah right, added it out of habit

Copy link
Owner

Choose a reason for hiding this comment

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

Please delete this

@@ -74,15 +136,11 @@ if ! sudo sh "$INSTALLER" \
--x-library-path=/opt/nvidia/lib64 \
--x-sysconfig-path=/etc/X11/xorg.conf.d \
--documentation-prefix=/opt/nvidia \
--application-profile-path=/etc/nvidia/nvidia-application-profiles-rc.d \
--application-profile-path=/etc/nvidia \
Copy link
Owner

Choose a reason for hiding this comment

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

Why?

Copy link
Author

Choose a reason for hiding this comment

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

Must have been an error while editing, didn't intend it

Copy link
Owner

Choose a reason for hiding this comment

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

Please delete this

Comment on lines +120 to +124
if [ ! -d ./${DRIVER}]
if ! sudo sh "$INSTALLER" --extract-only; then
echo -e "\e[31m Installation failed! Aborting...\e[m"
exit 1
fi
Copy link
Owner

Choose a reason for hiding this comment

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

Two problems.

First, the syntax is incorrect

if [ ! -d ./${DRIVER} ]; then
  if ! sudo sh "$INSTALLER" --extract-only; then
    echo -e "\e[31m Installation failed! Aborting...\e[m"
    exit 1
  fi
fi

Second, according to this post, setting CONFIG_SECTION_MISMATCH_WARN_ONLY=y should be sufficient and I don't understand why it doesn't work in your case.

Though extracting saves time, I don't think it makes a significant difference.

So unless it's made sure that we have to extract this, I prefer not.

Copy link
Author

Choose a reason for hiding this comment

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

I added extraction because in a previous version of the driver I also had to apply some corrections to the files inside the driver. Now I don't need it anymore, but I still extract since OS updates are much more frequent than driver updates, and this saves up some time (especially on slow drives).

Copy link
Owner

Choose a reason for hiding this comment

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

Since this is not essential, I prefer to delete this. The extraction doesn't take much time in any case.

Comment on lines +58 to +91
cat <<EOF | sudo tee /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf > /dev/null
# This xorg.conf.d configuration snippet configures the X server to
# automatically load the nvidia X driver when it detects a device driven by the
# nvidia-drm.ko kernel module. Please note that this only works on Linux kernels
# version 3.9 or higher with CONFIG_DRM enabled, and only if the nvidia-drm.ko
# kernel module is loaded before the X server is started.
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection

Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "/opt/nvidia/lib64/xorg/modules"
ModulePath "/usr/lib64/xorg/modules"
EndSection
EOF
cat <<EOF | sudo tee /etc/X11/xorg.conf.d/90-mwhd.conf > /dev/null
Section "Module"
Load "modesetting"
EndSection

Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
Option "AllowEmptyInitialConfiguration"
EndSection
EOF
Copy link
Owner

Choose a reason for hiding this comment

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

Any references?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Line 58 to 79 LGTM. But Line 76 to 77 may be redundant given line 52 to 55.


Line 88 could be problematic. Suppose the GPU is not on PCI 1, or there are multiple GPUs, this won't work properly.

Comment on lines +93 to +107
# Optimus workaround (maybe should ask user first?)
echo -e "\e[33m\xe2\x8f\xb3 Applying Optimus workarounds...\e[m"
if [ ! -d /usr/local/share ]; then
sudo mkdir -p /usr/local/share
fi
cat <<EOF | sudo tee /usr/local/share/optimus.desktop > /dev/null
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
EOF
sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
sudo ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop
Copy link
Owner

Choose a reason for hiding this comment

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

I prefer not to add this part for two reasons:

  1. Optimus support isn't reliable. Even NVIDIA itself suggests that if you cannot turn off integrated GPU this may not work.
  2. I cannot test this.

Copy link
Author

Choose a reason for hiding this comment

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

I have never ever been able to boot CL without this specific workaround, even when disabling iGPU (via the kernel command line arguments). Furthermore it never caused any trouble, so I don't think it will affect non-optimus devices...

Copy link
Owner

Choose a reason for hiding this comment

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

line 106: This is not halal because it's modifying /usr/share. The solution is to do something similar to line 31 to 38 in pre_install.bash.

line 107: Make sure /etc/xdg/autostart/ exists before creating that symlink

@lebensterben
Copy link
Owner

lebensterben commented Jul 30, 2020

I just installed the driver and I only added --no-cc-version-check option and everything works. That is I have DKMS on.

So here's what I'm thinking:

  • Incorporate line 58-91 and line 93-107. The only real problem is on line 88 as explaind here
  • I will make a new branch and please merge them to the new one.
  • Probably I will allow the user to invoke the script with additional parameters passed to the installer. I will do this in another commit.

Please merge into optimus-workaround branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants