Repository: archlinux/archinstall

Issue:
Nvidia proprietary driver installation
Hello 

I tried to install my system via this installer but i can't install nvidia proprietary driver with this installer.

I think there is an option "Nvidia (proprietary)" but it still installing open source nvidia driver.
https://github.com/archlinux/archinstall/blob/0071a069080732047e11309134869f3ab40c642c/archinstall/lib/hardware.py

How can install proprietary drivers ?
Instead of gfx_driver option adding nvidia package names to packages option like that :
```"packages": ["bash-completion","linux-headers","nvidia","nvidia-settings","opencl-nvidia"]```



My config file :

```
{
  "bootloader": "systemd-bootctl",
  "audio": "pulseaudio",
  "filesystem": "ext4",
  "gfx_driver": "Nvidia (proprietary)",
  "harddrive": {
   "path": "/dev/sda"
  },
  "hostname": "pc",
  "kernels": ["linux"],
  "keyboard-language": "trq",
  "mirror-region": {},
  "nic": {
    "NetworkManager": true
  },
  "profile": "kde",
  "ntp": true,
  "packages": ["bash-completion", "linux-headers"],
  "sys-encoding": "utf-8",
  "timezone": "UTC",
  "!root-password": "****",
  "superusers": {
    "kaan": {
      "!password": "****"
      }
  }
}
```

Thank you.



Discussion:
It should be `"gfx_driver": "Nvidia",` I think
> It should be `"gfx_driver": "Nvidia",` I think

I think what he has is correct. If it's not working, this is a regression -- pretty sure it used to work
You could be right, I was basing this off the values listed here: https://github.com/archlinux/archinstall/blob/master/docs/installing/guided.rst
> You could be right, I was basing this off the values listed here: https://github.com/archlinux/archinstall/blob/master/docs/installing/guided.rst

We'll have to go through that and update some values, as the guided partitioner's options have changed a bit, and the config uses the same strings.
Most likely it's the `generic_select` returning the key instead of the value from these options: https://github.com/archlinux/archinstall/blob/0071a069080732047e11309134869f3ab40c642c/archinstall/lib/hardware.py#L56
> It should be `"gfx_driver": "Nvidia",` I think

Yes i tried it first but it is installed open source drivers.
So assuming either `archinstall --gfx_driver='Nvidia (proprietary)'` is set or the config contains:
```json
{
    "gfx_driver": "Nvidia (proprietary)"
}
```
It should work because guided will use the above parameter: https://github.com/archlinux/archinstall/blob/7d991ecb9f87f863e1e78ce7e2d06c4d2f9568db/examples/guided.py#L49-L50

And perform a lookup in `AVAILABLE_GFX_DRIVERS`: https://github.com/archlinux/archinstall/blob/7d991ecb9f87f863e1e78ce7e2d06c4d2f9568db/archinstall/lib/hardware.py#L23-L58

@kaan35 How have you verified that it's *not* the `nvidia` package being installed? Because everything looks fine.
@Torxed
When i run this command : `lspci -k | grep -A 2 -E "(VGA|3D)"` it returns nouveau is using.
So I installed nvidia packages after installation.
I run this command on my konsole :` pacman -S nvidia nvidia-settings  nvidia-utils`

Now  `lspci -k | grep -A 2 -E "(VGA|3D)"` returns 
```     
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
Subsystem: ASUSTeK Computer Inc. Device 84bb
Kernel driver in use: nvidia
```


Do you have the `/var/log/archinstall/install.log` still? Maybe that could shed some light on what happned.
Because you are correct, `nouveau` should not be installed, it should be `nvidia`.
@Torxed 

Output : 

`````
Disk states before installing: {'blockdevices': [{'name': 'loop0', 'fstype': 'squashfs', 'fsver': '4.0', 'label': None, 'uuid': None, 'fsavail': '0', 'fsuse%': '100%', 'mountpoints': ['/run/archiso/airootfs'], 'type': 'loop', 'size': '673.1M'}, {'name': 'sda', 'fstype': None, 'fsver': None, 'label': None, 'uuid': None, 'fsavail': None, 'fsuse%': None, 'mountpoints': [None], 'type': 'disk', 'size': '232.9G'}, {'name': 'sdb', 'fstype': None, 'fsver': None, 'label': None, 'uuid': None, 'fsavail': None, 'fsuse%': None, 'mountpoints': [None], 'type': 'disk', 'size': '57.8G', 'children': [{'name': 'sdb1', 'fstype': 'vfat', 'fsver': 'FAT32', 'label': 'ARCH_202110', 'uuid': '12F0-0C3F', 'fsavail': '57.1G', 'fsuse%': '1%', 'mountpoints': ['/mnt/usb', '/run/archiso/bootmnt'], 'type': 'part', 'size': '57.8G'}]}]}
-- Guided template chosen (with below config) --
{
    "!root-password": "******",
    "audio": "pulseaudio",
    "bootloader": "systemd-bootctl",
    "filesystem": "ext4",
    "gfx_driver": "Nvidia (proprietary)",
    "harddrive": {
        "model": "Samsung SSD 750 EVO 250GB",
        "path": "/dev/sda",
        "size": "232.9G"
    },
    "hostname": "pc",
    "kernels": [
        "linux"
    ],
    "keyboard-language": "trq",
    "mirror-region": {},
    "nic": {
        "NetworkManager": true
    },
    "ntp": true,
    "packages": [
        "bash-completion",
        "linux-headers"
    ],
    "profile": {
        "path": "/usr/lib/python3.9/site-packages/archinstall/profiles/kde.py"
    },
    "script": "guided",
    "silent": false,
    "superusers": {
        "kaan": {
            "!password": "******"
        }
    },
    "sys-encoding": "utf-8",
    "sys-language": "en_US",
    "timezone": "UTC"
}
Wiping BlockDevice(/dev/sda) by using partition format 1
Using and formatting the entire BlockDevice(/dev/sda).
Adding partition to BlockDevice(/dev/sda)
Adding partition to BlockDevice(/dev/sda)
Set the root partition Partition(path=/dev/sda2, size=232.4G, fs=ext4) to use filesystem ext4.
Formatting /dev/sda1 -> vfat
Formatting /dev/sda2 -> ext4
Mounting Partition(path=/dev/sda2, size=232.4G, fs=ext4, rel_mountpoint=/) to /mnt
Mounting Partition(path=/dev/sda1, size=512M, fs=vfat, rel_mountpoint=/boot) to /mnt/boot
Waiting for automatic mirror selection (reflector) to complete.
Installing packages: ['base', 'base-devel', 'linux-firmware', 'linux', 'intel-ucode']
Adding bootloader systemd-bootctl to Partition(path=/dev/sda1, size=-1, fs=vfat, mounted=/mnt/boot)
Installing packages: ('efibootmgr',)
Identifying root partition by PART-UUID on Partition(path=/dev/sda2, size=-1, fs=ext4, mounted=/mnt), looking for 'a51a81fb-36f5-444a-a8ec-60c8ceac38a4'.
Installing packages: ('networkmanager',)
Enabling service NetworkManager.service
This audio server will be used: pulseaudio
Installing packages: ('pulseaudio',)
Installing packages: ['bash-completion', 'linux-headers']
Installing network profile Profile(kde)
Installing network profile Profile(xorg)
Installing packages: ('xorg-server xorg-xinit',)
Installing packages: ['plasma-meta', 'konsole', 'kate', 'dolphin', 'sddm', 'plasma-wayland-session', 'egl-wayland']
Enabling service sddm
Creating user kaan
Setting password for kaan
Enabling sudo permissions for kaan.
Installing and activating NTP.
Installing packages: ('ntp',)
Enabling service ntpd
Setting password for root
Keyboard language for this installation is now set to: trq
For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation
Updating /mnt/etc/fstab
Installation completed without any errors. You may now reboot.
```




Very strange. It never installed *any* graphics driver *(`grep "Installing packages" /var/log/archinstall/install.log`)*.
I see that `Profile(xorg)` did get installed as expected. And I think I just found the issue:
We have a silent exception that most likely kicked in: https://github.com/archlinux/archinstall/blob/776823adfb2d9ea140b9d849ee9a1dd07991a94c/profiles/xorg.py#L49-L50

Resolving patch:
diff --git a/profiles/xorg.py b/profiles/xorg.py
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -1,6 +1,7 @@
 # A system with "xorg" installed
 
 import archinstall
+import logging
 
 is_top_level_profile = True
 
@@ -36,15 +37,16 @@ def _prep_function(*args, **kwargs):
 # or through conventional import xorg
 if __name__ == 'xorg':
 	try:
-		if "nvidia" in archinstall.storage.get("gfx_driver_packages", None):
+		if "nvidia" in archinstall.storage.get("gfx_driver_packages", []):
 			if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages:
 				for kernel in archinstall.storage['installation_session'].kernels:
 					archinstall.storage['installation_session'].add_additional_packages(f"{kernel}-headers") # Fixes https://github.com/archlinux/archinstall/issues/585
 				archinstall.storage['installation_session'].add_additional_packages("dkms")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms
 				archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit nvidia-dkms")
 			else:
-				archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
+				archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}")
 		else:
-			archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
-	except:
+			archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}")
+	except Exception as err:
+		archinstall.log(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}", level=logging.WARNING, fg="yellow")
 		archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit")  # Prep didn't run, so there's no driver to install


Test patch: