DRI_PRIME=1 not working for Minecraft Java Edition

I saw multiple people online talking about how to run Minecraft Java with the dedicated graphics card. It said to make a script with the code #! /bin/sh DRI_PRIME=1 exec java "[email protected]" but this didn't work for me. Every time I start the game from the launcher, it freezes and I have to restart my laptop. Does anybody know how I can fix this?
Here is the output of inxi -Fxxxza (I saw someone ask for it in a different thread)

System:    Kernel: 5.12.1-zen2-1-zen x86_64 bits: 64 compiler: gcc v: 10.2.0
           parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
           root=UUID=9cf7a108-8742-4bdb-9c93-c2c9a68465e9 rw [email protected] quiet splash
           rd.udev.log_priority=3 vt.global_cursor_default=0 systemd.unified_cgroup_hierarchy=1
           loglevel=3
           Desktop: KDE Plasma 5.21.5 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM
           Distro: Garuda Linux base: Arch Linux
Machine:   Type: Laptop System: Dell product: G5 5500 v: N/A serial: <filter> Chassis: type: 10
           serial: <filter>
           Mobo: Dell model: 0D1G65 v: A02 serial: <filter> UEFI: Dell v: 1.7.1 date: 12/04/2020
Battery:   ID-1: BAT0 charge: 44.5 Wh (92.5%) condition: 48.1/51.0 Wh (94.3%) volts: 13.1
           min: 11.4 model: BYD DELL M4GWP01 type: Li-poly serial: <filter> status: Charging
CPU:       Info: 6-Core model: Intel Core i7-10750H bits: 64 type: MT MCP arch: Comet Lake
           family: 6 model-id: A5 (165) stepping: 2 microcode: E2 cache: L2: 12 MiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 62399
           Speed: 3877 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 3877 2: 4222 3: 4599
           4: 4709 5: 4801 6: 4801 7: 4749 8: 4800 9: 4802 10: 4513 11: 4560 12: 4751
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
           Type: l1tf status: Not affected
           Type: mds status: Not affected
           Type: meltdown status: Not affected
           Type: spec_store_bypass
           mitigation: Speculative Store Bypass disabled via prctl and seccomp
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
           Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling
           Type: srbds status: Not affected
           Type: tsx_async_abort status: Not affected
Graphics:  Device-1: Intel UHD Graphics vendor: Dell driver: i915 v: kernel bus-ID: 00:02.0
           chip-ID: 8086:9bc4 class-ID: 0300
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Ti Mobile] vendor: Dell driver: nvidia
           v: 465.27 alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:1f95
           class-ID: 0300
           Device-3: Realtek Integrated_Webcam_HD type: USB driver: uvcvideo bus-ID: 1-5:2
           chip-ID: 0bda:5678 class-ID: 0e02 serial: <filter>
           Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver: loaded: intel,nvidia
           unloaded: modesetting,nouveau alternate: fbdev,nv,vesa display-ID: :0 screens: 1
           Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2")
           s-diag: 582mm (22.9")
           Monitor-1: eDP1 res: 1920x1080 hz: 60 dpi: 143 size: 340x190mm (13.4x7.5")
           diag: 389mm (15.3")
           OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 21.0.3
           direct render: Yes
Audio:     Device-1: Intel Comet Lake PCH cAVS vendor: Dell driver: sof-audio-pci-intel-cnl
           alternate: snd_hda_intel,snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
           chip-ID: 8086:06c8 class-ID: 0401
           Sound Server-1: ALSA v: k5.12.1-zen2-1-zen running: yes
           Sound Server-2: JACK v: 0.125.0 running: no
           Sound Server-3: PulseAudio v: 14.2 running: yes
           Sound Server-4: PipeWire v: 0.3.27 running: no
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Dell
           driver: r8169 v: kernel port: 3000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
           IF: enp4s0 state: down mac: <filter>
           Device-2: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter vendor: Dell
           driver: ath10k_pci v: kernel port: 3000 bus-ID: 05:00.0 chip-ID: 168c:003e
           class-ID: 0280
           IF: wlp5s0 state: up mac: <filter>
Bluetooth: Device-1: Qualcomm Atheros type: USB driver: btusb v: 0.8 bus-ID: 1-14:3
           chip-ID: 0cf3:e007 class-ID: e001
           Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:    Local Storage: total: 1.14 TiB used: 29 GiB (2.5%)
           SMART Message: Unable to run smartctl. Root privileges required.
           ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix model: BC511 NVMe 256GB
           size: 238.47 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4
           rotation: SSD serial: <filter> rev: 11004101 scheme: GPT
           ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000LX015-1U7172
           size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
           rotation: 5400 rpm serial: <filter> rev: SDM1 scheme: GPT
Partition: ID-1: / raw-size: 249.36 GiB size: 249.36 GiB (100.00%) used: 29 GiB (11.6%)
           fs: btrfs dev: /dev/sda3 maj-min: 8:3
           ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%) used: 560 KiB (0.1%)
           fs: vfat dev: /dev/sda2 maj-min: 8:2
           ID-3: /home raw-size: 249.36 GiB size: 249.36 GiB (100.00%) used: 29 GiB (11.6%)
           fs: btrfs dev: /dev/sda3 maj-min: 8:3
           ID-4: /var/log raw-size: 249.36 GiB size: 249.36 GiB (100.00%) used: 29 GiB (11.6%)
           fs: btrfs dev: /dev/sda3 maj-min: 8:3
           ID-5: /var/tmp raw-size: 249.36 GiB size: 249.36 GiB (100.00%) used: 29 GiB (11.6%)
           fs: btrfs dev: /dev/sda3 maj-min: 8:3
Swap:      Kernel: swappiness: 10 (default 60) cache-pressure: 75 (default 100)
           ID-1: swap-1 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram0
           ID-2: swap-2 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram1
           ID-3: swap-3 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram2
           ID-4: swap-4 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram3
           ID-5: swap-5 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram4
           ID-6: swap-6 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram5
           ID-7: swap-7 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram6
           ID-8: swap-8 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram7
           ID-9: swap-9 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram8
           ID-10: swap-10 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram9
           ID-11: swap-11 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram10
           ID-12: swap-12 type: zram size: 1.29 GiB used: 0 KiB (0.0%) priority: 32767
           dev: /dev/zram11
           ID-13: swap-13 type: partition size: 4 GiB used: 0 KiB (0.0%) priority: 1024
           dev: /dev/nvme0n1p2 maj-min: 259:2
Sensors:   System Temperatures: cpu: 58.0 C mobo: N/A
           Fan Speeds (RPM): N/A
Info:      Processes: 324 Uptime: 19m wakeups: 3964 Memory: 15.42 GiB used: 3.65 GiB (23.7%)
           Init: systemd v: 248 tool: systemctl Compilers: gcc: 10.2.0 clang: 11.1.0 Packages:
           pacman: 1657 lib: 508 Shell: fish v: 3.2.1 default: Zsh v: 5.8 running-in: alacritty
           inxi: 3.3.04

To anyone else having this problem, I figured it out! You just need to install NVidia Primesudo pacman -S nvidia-prime and edit the .desktop file in /usr/share/applications. Change Exec=minecraft-launcher to Exec=prime-run minecraft-launcher

2 Likes

MSS
:slight_smile:

4 Likes

Thank you lol. It's really nice when I can figure stuff out.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.