This is a post that I did not think I would be writing. My wife bought me a new laptop, an Asus FX504G, as a Christmas present. It is a very sturdy rig and the specs are pretty good (in Thailand) for the price. Of course, the first thing I wanted to do was install Linux, specifically Manjaro Deepin, onto it. Because I needed to preserve the Windows install if I needed to get warranty service on it, I bought a new NVME drive to replace the one that came with it. I then proceeded to install Manjaro. This turned into a nightmare at first, and then into a big learning experience. It felt like I was back in 2009 installing Fedora 9 on a laptop with an ATI card. It was NOT the fault of Manjaro, but the hardware, an Elantech touch pad, Samsung NVME SSD, and an nVidia Optimus setup, in the laptop. At first I was worried that I would be unable to install Linux at all on this machine, but I was not about to give up. After a month of researching, trial and error, and lots of caffeine, I now have a fast and stable Manjaro Deepin install. Here is how I was able to accomplish it.
Before I start, here are the results of inxi -Fxxz
command:
System: Host: Manjaro Kernel: 4.19.13-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.2.1 Desktop: Deepin 15.8
tk: Qt 5.12.0 wm: DeepinWM dm: LightDM Distro: Manjaro Linux
Machine: Type: Laptop System: ASUSTeK product: TUF GAMING FX504GD_FX80GD v: 1.0 serial: <filter>
Mobo: ASUSTeK model: FX504GD v: 1.0 serial: <filter> UEFI: American Megatrends v: FX504GD.312
date: 07/13/2018
Battery: ID-1: BAT1 charge: 45.9 Wh condition: 46.1/48.1 Wh (96%) volts: 3.9/11.7 model: ASUS A32-K55
serial: <filter> status: Discharging
CPU: Topology: 6-Core model: Intel Core i7-8750H bits: 64 type: MT MCP arch: Kaby Lake rev: A
L2 cache: 9216 KiB
flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 53004
Speed: 900 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 900 2: 900 3: 900 4: 901 5: 900 6: 900 7: 901
8: 900 9: 900 10: 900 11: 901 12: 900
Graphics: Device-1: Intel UHD Graphics 630 vendor: ASUSTeK driver: i915 v: kernel bus ID: 00:02.0
chip ID: 8086:3e9b
Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] vendor: ASUSTeK driver: nvidia v: 415.25
bus ID: 01:00.0 chip ID: 10de:1c8d
Display: x11 server: X.Org 1.20.3 driver: modesetting,nvidia resolution: 1920x1080~60Hz
OpenGL: renderer: GeForce GTX 1050/PCIe/SSE2 v: 4.6.0 NVIDIA 415.25 direct render: Yes
Audio: Device-1: Intel Cannon Lake PCH cAVS vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3
chip ID: 8086:a348
Sound Server: ALSA v: k4.19.13-1-MANJARO
Network: Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi v: kernel port: 5000 bus ID: 00:14.3
chip ID: 8086:a370
IF: wlo1 state: up mac: <filter>
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel
port: 3000 bus ID: 03:00.0 chip ID: 10ec:8168
IF: enp3s0 state: down mac: <filter>
Drives: Local Storage: total: 1.14 TiB used: 330.13 GiB (28.4%)
ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO 250GB size: 232.89 GiB speed: 31.6 Gb/s lanes: 4
serial: <filter>
ID-2: /dev/sda vendor: HGST (Hitachi) model: HTS541010B7E610 size: 931.51 GiB speed: 6.0 Gb/s
serial: <filter>
Partition: ID-1: / size: 227.74 GiB used: 23.59 GiB (10.4%) fs: ext4 dev: /dev/nvme0n1p2
Sensors: System Temperatures: cpu: 46.0 C mobo: 27.8 C gpu: nvidia temp: 42 C
Fan Speeds (RPM): cpu: 0
Info: Processes: 266 Uptime: 1m Memory: 15.52 GiB used: 647.6 MiB (4.1%) Init: systemd v: 239 Compilers:
gcc: 8.2.1 Shell: bash v: 4.4.23 running in: deepin-terminal inxi: 3.0.28
Manjaro Architect was used to install the system. I really enjoy the freedom it gives me when I do an install.
Issue No.1 - NVME "Lag"
No matter what distro I installed on the laptop, the system would randomly freeze. This freeze would last from a couple of seconds to over a minute. After some research, I found that there is an issue in the kernel with Samsung NVME drives. The kernel was trying use a power saving state that the drive does not support. This was causing write errors. Adding the following parameter to the kernel fixed the issue: nvme_core.default_ps_max_latency_us=5500
This disabled the lowest power saving state for the drive and now random desktop freezing was a thing of the past. While this was a known issue with kernel 4.10, I found that it was still present in kernel 4.19.x.
source
Issue No.2 - nVidia Optimus
This issue turned into the hardest one to fix. When I first started to troubleshoot it, the Manjaro Forums were awash with support requests regarding this issue. Rather than adding to the pile with my own post, I decided to lurk the posts and take notes on what fixes worked for other users. After a couple of weeks and copious amount of notes, I was ready to take a shot at fixing it. After some experimentation, I found that the following kernel parameters worked the best on my system: nouveau.modeset=0 acpi_rev_override=5
With these kernel parameters, I was able to get to a desktop using the Nouveau driver. Using this guide, link, I used chroot
to get into my system and setup my nVidia card to run all the time. After making sure that I had uninstalled the Nouveau driver, and placed the run command for the optimus.sh
script in the [Seat:*]
section of the lightdm.conf
, my system booted without any problems. Now the laptop is only using the nVidia card.
Issue No.3 - Elantech Touch Pad
Once I had the nVidia and the NVME drive issues resolved, I noticed that there was another problem. It was the touch pad. The touch pad in my laptop is manufactured by Elantech. This touch pad does not work and play well with Linux. It was non-functional on any kernel before the 4.17.x series. With 4.17.x and newer, it will work, but not reliably. The libinput
driver will randomly crash, causing the touch pad to stop working and the "gestures" support is also very spotty. After some research, I ran across this post, link. I tried running the suggested command, and it did not resolve the problem for me. In that same post, there was a link to a bug report on the Arch Wiki. It was there, that I found yet another kernel parameter to try. So I added psmouse.elantech_smbus=0
as a parameter on boot and gave it a test. This solved the problem. The touch pad would no longer randomly freeze, but the gestures still do not work properly. Since I do not use gestures on the touch pad, because I have found them annoying instead of helpful, this solution works great for me. The 4.20 Linux kernel has fixed these issues with some models of the Elantech touch pad, but unfortunately my model is not one of them.
Conclusion
Except for setting up my nVidia card as Prime, most of my problems were solved using kernel arguments. Ultimately, the GRUB_CMDLINE_LINUX_DEFAULT
line in my grub
has the following:
rd.udev.log-priority=3 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash nvme_core.default_ps_max_latency_us=5500 nouveau.modeset=0 acpi_rev_override=5 psmouse.elantech_smbus=0
Using all of those arguments, my laptop is now booting properly, is stable, and fast. I could not be happier. After a month of having to run Windows off and on, I feel like I have finally come back home.