Lenovo Legion Y7000 (2019)

In my previous blog, I mentioned I changed a new laptop. My older faulty laptop is Dell Vostro 5459, which was four years old. My current laptop is Lenovo Legion Y7000 2019 PG0 model 81T0, which as higher spec than the old one. Besides that, I added another 1T HDD, just in case I may doing machine learning study, or my work requires large disk space.

Note: All the instructions should follow official Arch Linux Wiki. The followings are only based on my experience of this installation.

Installation preparation

Since I have an extra HDD and plan for dual boot, I preserve the Windows in the SSD. Therefore in Windows, firstly disable Fast Boot, and secondly allow UTC time.

After this, I disable the Secure Boot through BIOS.

Since my primary OS is Arch Linux, I usually prepare two Live USBs, Arch Linux and SystemRescueCD. I just found that the recent SystemRescueCD is built based on Arch Linux.

SystemRescueCD is useful especially doing partitioning, shrinking/growing partition, and moving partitions, using GUI. Command-line like cfdisk and cgdisk can do partitioning, but moving partitions will be less intuitive comparing to GUI.

However, I failed to run SystemRescueCD with Xorg (running startx) due to graphic driver issue. (Though later, I found that it can be solved by going to BIOS, and change the Graphic Mode to “Switchable”, where the default is “Discrete”.)

As a result, I continued with Arch Linux Live USB. Due to the graphic driver issue, the TTY is not rendered properly. This can be solved by adding nomodeset parameter to the Kernel, by editing the GRUB menu during the boot.

Network

After boot into the Arch Linux installation Live USB, the first thing must solve is the networking. In this modern day, a laptop that cannot connect internet with WiFi is useless. However, the WiFi of Lenovo Legion Y7000 was blocked (plane mode) by default when running in Live USB. This can be solved by rfkill unblock all. Then, I started the network service with netctl.

Partitioning and boot loader

I believe most modern laptop and HDD support GPT. Since I am using command-line interface, cgdisk is sufficient for the partitioning. I created three partitions, for / (root), swap, and /home.

After partitioning and mounting, I installed the Arch through network.

Boot loader is a little troublesome. I chose GRUB. I believe most modern laptop supports EFI. So, I booted into Windows and used Disk Management to find the partition that is used for boot. One of the partitions is EFI.

Then in Arch Linux live media, I installed grub, os-probe, and efibootmgr.

Note: I installed the grub after I have run pacstrap. pacstrap will create /boot directory. So, I renamed it to /boot to /boot~, and create another /boot for GRUB installation.

I mounted the partition to /boot (in arch-chroot environment), then follow the instructions here.

os-probe is useful to allow dual boot to Windows, as it will generate the GRUB menu entry for Windows automatically.

After this, reboot to make sure we can boot into the new installation.

Note: Add nomodeset to the Kernel in the /etc/default/grub if rendering fails.

Network again

After boot into newly installed Arch Linux, I was not able to connect internet, because required packages were not installed. So, I needed to boot to the live media again, with the network connection, install wpa_supplicant, netctl, and dhcpcd. Then at least I can connect to internet with the newly installed Arch Linux.

NVIDIA

After the network, the second big problem is NVIDIA. I choose NVIDIA, because it supports CUDA, as it is important for machine learning, especially deep learning.

I used nvidia-dkms, which I have good experience with this package.

But I faced two main problems. One is the brightness not able to be controlled when running Xorg. The documentation mentioned that this can be solved by adding

option "RegistryDwords" "EnableBrightnessControl=1"

in /etc/X11/xorg.conf or relevant file, under “Device” section “nvidia” driver.

The above solution doesn’t work perfectly. When I boot into LightDM (display manager), sometimes the brightness is 100%, which I cannot reduce the brightness. But sometimes it works fine.

When the brightness is 100%, I need to restart the LightDM, or login and logout (I am using Openbox). Then the brightness is controllable.

The second problem is hibernation. I failed to resume from hibernation. It was a nightmare, as one of my testings failed to boot properly.

I have tried several solution, such as this, and this, and this. None of them work.

I also tried to use linux-lts. But it doesn’t solve the brightness problem, and the WiFi failed to work. So, I give up linux-lts.

And I give up the hibernation as well. It is useful, but I still can work without hibernation.

Note: After successful installation of NVIDIA, we can remove nomodeset from the GRUB entry.

Touchpad

I was using Synaptics. But it is no longer actively updated, and the official documentation suggest to use libinput.

So, I am using libinput now, but it sadly doesn’t support circular scrolling.

f.lux

I was using f.lux for health purpose. However, f.lux package doesn’t work on new laptop with NVIDIA. So, I switch to Redshift. The drawback is that, unlike f.lux GUI, Redshift is not able to change the colour temperature on the fly.

Leftover tasks

After these, I have to migrate a lot of data from my previous computer.

Danshari is necessary, so that not all data need to be migrated.

Family and personal photos (and some videos) are important, as they tell me who I was.

Personal data are important, as they tell me who I am.

Working data are important, as they allow me to continue what I am working with.

Configuration files are important, as I need not to waste my time to setup everything again. Especially Openbox, tint2, Mendeley Desktop, Postman, DBeaver, Emacs, VIM, bash, zsh, SSH, fcitx, fonts (and fontconfig), etc.

Other data files like movies, pictures, music are less important, but valuable. As I need not to collect them again.

Chinese New Year and new laptop

This was a disastrous week. Firstly, internet network cable broken. Secondly, my laptop went wild. Internet network cable broken, I still can online through mobile hotspot. But my laptop, it was catastrophic problem. Because I have a lot of valuable data, and I have to work.

Chinese proverb, 旧的不去,新的不来, but it was damn pressure. Because the old laptop had unpredictable behaviour. The problem was that, the keyboard will trigger some keys unintentionally, especially Alt key. I thought it was software problem, but until I reboot, and saw the GRUB menu cursor moving by itself. Damn! This means, (i) I am not able to work, (ii) I have to spend money to buy new laptop, and (iii) I need to get my data out.

First problem means that, I may not able to earn money during the period, as I am a freelance software engineer. Second problem means that, I need to spend money, with the possibility that I am not able to generate income, and the new laptop may not be Linux compatible. Linux compatibility is important to me, due to the familiarity and the working environment. Third problem means that, I may have possibility loss the data. I have done backup, but not frequent and not all data were backup. Though those data which I didn’t backup were less important, they are still valuable as I spent time on them.

Surely most important data are family photos, personal data, and those work related things. Though we use “git” and commit our source code, setup everything again spends time. Your employer doesn’t pay you to setup, but pay you to work. That is why I felt very pressure.

I prayed, I prayed, and prayed. Luckily keyboard problem was partially solved with USB keyboard, and Linux command “xinput float” can disconnect the built-in keyboard. And the new laptop can be used to work now (since yesterday). Though new laptop has higher hardware specifications than the old one, it is not perfect, as I failed to make it able to hibernate. NVIDIA and Linux combination is sh*t. But I still need NVIDIA, just in case I have to do machine learning with CUDA. So, for the moment, I have to sacrifice hibernation. Also, during the testing when resume from hibernation, it showed a freaking behaviour, I cannot type in the LightDM login. Damn, I cannot bear it if new laptop also broken.

Hopefully this is the end of the accident. I pray that this year will be new as this new powerful laptop.

祸不单行昨夜行,福无双至今日至。祝大家新年快乐。