Fedora 28 on Lenovo Y720-15IBK

It’s almost a year since I purchased this gaming computer and just now I had the need to do anything else than gaming in it. I have a friend that recently bought a notebook with a Nvidia GTX 1060 and he installed Fedora, making it a very snappy workstation, so I decided to give Fedora a go again. My computer came with Windows 10 by default and I never changed anything there, so here I am writing down all knowledge I got from installing Fedora in this machine.

Partitioning

Partitioning the disk using the Windows disk management tool worked just fine.

Live USB

Fedora Media Writer for Windows worked as intended.

Rebooting into the Live USB

Two tricky things. First one is disable Fastboot. The second one is that even disabling it on Windows, I still couldn’t get into my BIOS. I had to click on restart while holding shift and then use the Windows repair menu to get into the BIOS. Once inside the BIOS, I disabled the Fastboot and also allowed the boot over USB that was needed. Figuring out how to make into the BIOS took me some time also, but somehow I learned that I should use Fn + F2 for the BIOS and Fn + F12 for the boot menu.

Disk not recognized

Booting into the Live USB was fine, but the installer could not recognize my NVMe disk at all. After a lot of research I landed into this tip that was to set the Sata Controller Mode to AHCI. I had Intel RST Premium configured there and doing the change, Fedora was able to find my disk.

Sadly, I could not get back to Windows with that configuration. Selecting Windows on GRUB will reboot the computer and start attempt to load Windows, but eventually I get an Windows-like error message saying that was not possible to boot. The error code was INACCESSIBLE_BOOT_DEVICE.

It took me a couple of hours investigating just this issue until I managed to make it work. I had to Switch Windows 10 from RAID/IDE to AHCI, but I struggled a bit because I was doing that from the Repair tool instead of loading Windows normally. After I gave it a go from scratch, it worked as expected. Now I have dual boot on GRUB for Fedora and Windows, and my Sata Controller Mode is set to AHCI.

NVidia driver

Installation

This tutorial covers majority of the installation process, but I’ll detail here what went wrong.

Issues

  • ERROR: could not insert 'nvidia_drm': Operation not permitted.

Disabling Secure Boot and SELinux while installing the driver fixed this problem. Providing the x509 cert and key created before to the NVidia installer did not help. I had to disable Secure Boot and sign it manually later.

  • Wrong resolution

xrandr -q was showing eDP-1-1 primary connected 960x540+0+0. My monitor is 1080p. To fix that, I tried several different things, like setting the Mode manually inside the xorg.conf, setting the DPI, extracting the EDID using NVidia tools, disable EDID usage, xrandr with different combinations, and several variations inside the Xorg.conf, but nothing worked. In the end, it was just a matter of enabling DPMS and my xorg.conf now looks like this.

I also followed the scripting part of this tutoria, but I am not sure if this is doing anything for me right now. I also have the xrandr lines on my ~/.profile.

Secure Boot

I disabled Secure boot while installing the Nvidia driver, but later I enabled it back. It was less difficult than I expected. I followed this tutorial from Laurent, but I am writing here it again for backup AND because I didn’t find the .ko files in the first place (because they were compressed).

First off, I had to generate some keys and add them to the Secure Boot mechanism, otherwise UEFI wouldn’t be able to know if the modules it is loading are trusted or not. For that, I needed a configuration file, which I created at ~/x509.ini with the content:

[req]
default_bits = 4096
distinguished_name = req_distinguised_name
prompt = no
string_mask = utf8only
x509_extensions = myexts

[req_distinguised_name]
O = kassner
CN = kassner
emailAddress = [email protected]

[myexts]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid

Then:

  1. openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -config x509.ini -outform DER -out public_key.der -keyout private_key.priv;
  2. mokutil --import public_key.der;
  3. Reboot and follow the instructions to import the certificate;

And to sign the NVidia drivers:

  1. find / -name 'nvidia.ko.xz'. The other files were in the same folder;
  2. Backup them somewhere else;
  3. xz --decompress *.ko.xz;
  4. /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 ~/private_key.priv ~/public_key.der nvidia.ko and for the other .ko files;
  5. xz --compress nvidia.ko and the other .ko files as well;
  6. modinfo nvidia to be sure they are working;

Language, keyboard, locale, etc

I have a weird keyboard and language combination that I had to address for this computer. My computer has a Swedish keyboard, with the ä ö å keys. I have an USB keyboard that shares the same layout. But, I was raised with a US keyboard and I do write Portuguese every day as well, so writing letters like é ç ã is essential for me. At the same time, I rather use the US keyboard layout instead, since my muscle memory is already built around it. To orchestrate all this mess, I spent several days trying out different things until I finally managed.

Sadly, since it was so scattered around and I couldn’t remember everything I did, I am most likely missing some things here. I am writing what I remember and I’ll update in the future if I ever find out what is wrong.

Dates

date and some other parts of some apps were returning localized information for me in Swedish. This was mainly due the fact that only $LANG was set to en_US.UTF-8 and all other variables were set to sv_SE.UTF-8, because I selected English as language and Sweden (English) as format.

To fix this, I tried several different things, and what I believe it worked was:

sudo localedef -v -c -i en_US -f UTF-8 en_SE.UTF-8
sudo localectl set-locale LANG=en_SE.UTF-8

And keep my /etc/locale.conf like this:

LANG=en_SE.UTF-8
LC_CTYPE="en_SE.UTF-8"
LC_NUMERIC="en_SE.UTF-8"
LC_TIME="en_SE.UTF-8"
LC_COLLATE="en_SE.UTF-8"
LC_MONETARY="en_SE.UTF-8"
LC_MESSAGES="en_SE.UTF-8"
LC_PAPER="en_SE.UTF-8"
LC_NAME="en_SE.UTF-8"
LC_ADDRESS="en_SE.UTF-8"
LC_TELEPHONE="en_SE.UTF-8"
LC_MEASUREMENT="en_SE.UTF-8"
LC_IDENTIFICATION="en_SE.UTF-8"
LC_ALL=

Compose

I copied from /usr/share/X11/locale/en_US.UTF-8/Compose to ~/.XCompose and applied the following diff.

--- Compose	2018-06-23 21:37:15.647432197 +0200
+++ .XCompose	2018-06-23 22:19:59.832729155 +0200
@@ -611,7 +611,7 @@
 <Multi_key> <asterisk> <A> 		: "Å"   Aring # LATIN CAPITAL LETTER A WITH RING ABOVE
 <Multi_key> <A> <asterisk> 		: "Å"   Aring # LATIN CAPITAL LETTER A WITH RING ABOVE
 <Multi_key> <A> <A> 			: "Å"   Aring # LATIN CAPITAL LETTER A WITH RING ABOVE
-<dead_cedilla> <C>               	: "Ç"   Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
+<dead_acute> <C>               	: "Ç"   Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
 <Multi_key> <comma> <C>          	: "Ç"   Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
 <Multi_key> <C> <comma> 		: "Ç"   Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
 <Multi_key> <cedilla> <C>          	: "Ç"   Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
@@ -736,7 +736,7 @@
 <Multi_key> <asterisk> <a> 		: "å"   aring # LATIN SMALL LETTER A WITH RING ABOVE
 <Multi_key> <a> <asterisk> 		: "å"   aring # LATIN SMALL LETTER A WITH RING ABOVE
 <Multi_key> <a> <a> 			: "å"   aring # LATIN SMALL LETTER A WITH RING ABOVE
-<dead_cedilla> <c>               	: "ç"   ccedilla # LATIN SMALL LETTER C WITH CEDILLA
+<dead_acute> <c>               	: "ç"   ccedilla # LATIN SMALL LETTER C WITH CEDILLA
 <Multi_key> <comma> <c>          	: "ç"   ccedilla # LATIN SMALL LETTER C WITH CEDILLA
 <Multi_key> <c> <comma> 		: "ç"   ccedilla # LATIN SMALL LETTER C WITH CEDILLA
 <Multi_key> <cedilla> <c>          	: "ç"   ccedilla # LATIN SMALL LETTER C WITH CEDILLA
@@ -873,11 +873,9 @@
 <Multi_key> <a> <semicolon>      	: "ą"   U0105 # LATIN SMALL LETTER A WITH OGONEK
 <Multi_key> <comma> <a>         	: "ą"   U0105 # LATIN SMALL LETTER A WITH OGONEK
 <Multi_key> <a> <comma> 		: "ą"   U0105 # LATIN SMALL LETTER A WITH OGONEK
-<dead_acute> <C>                 	: "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
 <Multi_key> <acute> <C>          	: "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
 <Multi_key> <apostrophe> <C>     	: "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
 <Multi_key> <C> <apostrophe> 		: "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
-<dead_acute> <c>                 	: "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
 <Multi_key> <acute> <c>          	: "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
 <Multi_key> <apostrophe> <c>     	: "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
 <Multi_key> <c> <apostrophe> 		: "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE

Weirdly, my current /usr/share/X11/locale/en_US.UTF-8/Compose has no difference to my .XCompose, so I am not sure which one was the modification that made the trick.

Keyboard

The keyboard layout English (intl., with dead keys) works as expected in (almost) all apps. ~ + C gives me ç as ' + e gives me é. Except PhpStorm. I can’t successfully type " ' ~ or the backtick within the editor. Just nothing gets typed. The PhpStorm Keymap settings can recognize when I type one of those keys, but the editor itself or other menus wouldn’t. I tried several different things, related with IBus, changing XMODIFIERS, /etc/environment, ~/.Xmodmap and ~/.profile, saw some bug reports on JetBrains tracker, but nothing really worked.

My current workaround is to have English (intl, with AltGr dead keys) as a second keyboard layout that I use while I am on PhpStorm. Since I only write code (and comments) in English, it won’t be much of a problem, but I am having occasional mindfucks because I’ll keep forgetting to switch between keyboard layouts when I switch applications.