Installing Antergos Linux on a Lenovo Ideapad 720s (AMD Ryzen) dual booting with Windows 10
A little while ago, I was on the market for a lightweight ultrabook and bought a Lenovo Ideapad 720s (AMD Ryzen edition) on a good deal.
I’ve always intended to dual-boot Linux and Windows on it (I prefer Linux over macOS for dev work, and Windows for general usage). When shopping for this laptop, I made sure to Google around for issues with installing Linux. Before the purchase, I didn’t find any major issues people brought up — in fact, I found some rather irrelevant points such as RAID disk issues, that I never actually ran into.
However, as I began to try to install Linux, I quickly ran into a variety of issues. Which leads into…
I’ve been a RedHat-flavor guy for as long as I can remember, and for my last laptop I put CentOS 7 on it and wrote an article about it.
Naturally, this time I started with CentOS too. I actually don’t have particular reasons to use it other than the fact that it’s the most popular RedHat-flavor server OS on cloud providers (AWS, Digital Ocean, etc.) and I wanted my dev environment to be similar (using
yum, etc.). But I quickly ran into multitude of issues: Touchpad wouldn’t work by default, Wi-Fi wouldn’t work by default, and even the install source couldn’t be verified successfully in the installer to proceed. Then I gave Fedora, Ubuntu and even openSUSE a try, as they tend to have newer updates than CentOS. Touchpad and Wi-Fi were still broken. I didn’t want to have to deal with fixing multiple drivers, and using so many USB devices (mouse, Wi-Fi) just to get through installation.
From forums, it turns out Arch is the distro that will work with this laptop, as it’ll have the latest kernel (4.15+). The Arch installer was a bit out of my realms, being fully command-line. I took a recommendation from someone on a forum to go with Antergos. Low and behold, the installer launched and touchpad already works, so that’s most of my problems solved, with only Wi-Fi to go!
Note that because we don’t have built-in Wi-Fi yet, you will need a USB Wi-Fi adapter to get through installation (where it will download stuff), and later for fixing the Wi-Fi drivers. I personally used my Android phone with a USB tether. (And the phone will use the home Wi-Fi, not data, for internet.)
Starting the installation: Shrinking space in Windows to make space for new partitions
I pretty much followed my old guide for this step.
I’ve used everything from Rufus to Fedora Media Writer and others, and by far Etcher makes it the simplest, easiest; and it just works. No complicated options to pick. It’s the recommended way for openSUSE, and is one of the recommended ways for Antergos also.
Alternatively, you can buy an Antergos installation DVD, if you have slow internet or don’t want to burn a disc or USB drive.
Setting up Antergos for dual-booting
Antergos’ installer provides an excellent documentation for setting up dual-booting, which is conveniently opened directly from the step where you set up partitions (there is a link on that dialog). It opens up to this page. Find the “Partitioning” section on this page, which is exactly what you want to follow.
My only note is that when you’re looking for your existing Windows boot partition, even though it says “the label should be
ESP and the type
fat32”, the label was different for me (it was
SYSTEM_DRV). However, it was easy to guess which it was, because it’s the only partition with
At the end of installation, you will only boot into Antergos as it notes, and will have to run a few commands to get Windows back onto your boot menu:
(If you don’t have
os-prober, install with
sudo pacman -S os-prober) Which should display something like:
/dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
Then finally run:
grub-mkconfig -o /boot/grub/grub.cfg
And then on your next reboot, you should see Windows on your boot menu.
Fixing the Wi-Fi!
Finally time to fix our main issue that still remains in Antergos: the built-in Wi-Fi of the laptop. The main steps involved are:
- Having an up-to-date kernel,
- Having kernel-headers installed,
- Compiling and installing the wi-fi drivers.
If you downloaded the ISO recently enough (as was in my case, having downloaded it in June 2018), chances are your kernel should be the most updated. You can use
uname -r to check: 4.16+ should be fine. If not, run
sudo pacman -S linux to update it.
Next, you need to install kernel-headers:
sudo pacman -S linux-headers
(If this runs into issues, you may need to update your pacman mirrors with
sudo pacman -Syyu first)
Finally, to install the wi-fi drivers, I mostly followed this AskUbuntu answer, which involves downloading this driver source (you can use this DownGit link which packs it up for you as a zip file). You’ll need to edit the
Makefile and change the
TopDIR export value as it notes, and I recommend changing it to a hardcoded full path instead of just
~/Downloads because you’ll be running some
makes as your own user, and some
sudo (root), which will give you a different home dir location.
After that, it’s just running the 3 commands noted on the answer:
make sudo make install sudo modprobe 8821ce
Note that because you’re manually installing the driver, every time you happen to update the kernel from now on, you have to redo these steps. (
make clean before the above 3 commands)
[Aug 2018 update] Since writing the above, I’ve recently learned that there is a rtl8821ce-dkms-git AUR package that fixes exactly this issue. So instead of doing all the compilation steps above, simply do
pacaur -S rtl8821ce-dkms-git
and you should be set. The best thing about this approach is that it uses DKMS (Dynamic Kernel Module Support), so you don’t ever have to recompile the wifi module whenever you update the Linux kernel in the future anymore, it will do it for you.
Sleep/Wake cycle — losing Wi-Fi and screen brightness setting
I have a strange issue where a couple of things break as soon as the laptop goes through a sleep/wake cycle (e.g. closing the lid, letting it sleep/hibernate, and then opening it again to wake up). It doesn’t matter how long it has been sleeping for, could be a few seconds. Two things break: 1) Wi-Fi, 2) Screen brightness resets to max.
On the issue of Wi-Fi, there seems to be a lot of forum posts floating around saying Wi-Fi seems to be completely out on wake. This was not my issue. The Wi-Fi adapter and driver are still there (as can be told with
lspci — for the cases of people who had driver issues, it would not even show up on there). My issue was that Wi-Fi would fail to connect to my home network (or any network) after waking up.
After searching around, it turns out to be similar to this issue of a user who has similar troubles but with ethernet. The only solution I can find is to disable the module and reload it again with
modprobe like this:
sudo modprobe -r 8821ce
sudo modprobe 8821ce
(You may have a different module name — use
lspci -knn and see what it says under your network adapter, on the “Kernel modules:” line.)
After proving that it works with command line, it was time to automate it. Antergos/Arch can automatically run a script on sleep/wake. Start a script:
sudo vim /usr/lib/systemd/system-sleep/fix-wifi.sh
#!/bin/sh case $1/$2 in pre/*) # On sleep, run... ;; post/*) # On wake, run... # Fix wi-fi by reloading module modprobe -r 8821ce modprobe 8821ce # Fix brightness manually since it got set to max tee /sys/class/backlight/amdgpu_bl0/brightness <<< 60 ;; esac
You will notice that I also make use of this file to fix the screen brightness, by writing
60 to the file where Antergos reads brightness setting from:
/sys/class/backlight/amdgpu_bl0/brightness. Note that your directory name between
brightness may be different. Also note that everything in this script automatically runs as root, so you don’t need to sudo.
chmod a+x /usr/lib/systemd/system-sleep/fix-wifi.sh to make it executable and you’re good to go.
Fixing the system clock back on Windows
If you live anywhere that’s not in GMT timezone, you might find that once you’ve installed Antergos and set up your clock and timezone, Windows won’t read the system clock correctly when you boot back into it.
That’s due to Windows and Linux (and macOS apparently) not treating system clocks and timezones the same way, according to this article, which also details a fix.
In short, all you really need to do to fix this is on Windows side, open
regedit and go to the key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation and add a new DWORD (32-bit) Value with the name
RealTimeIsUniversal and give it a value of
1. Once rebooted on Linux and then Windows side, it’ll be fixed!
Printer setup (Epson WF-2530 in my case)
Setting up a printer on Antergos was surprisingly less difficult than you would think, though not effortless.
Antergos/Arch comes with CUPS for printer management, which the “Manager Printing” app in GNOME will open up (which basically opens http://localhost:631/ on your Chromium browser).
From here, if you have a printer on the network at home, and have it turned on, clicking on the “Add Printer” button (which goes to http://localhost:631/admin/) should detect it.
You can try to go ahead and add the printer found there under “Discovered network printer”, but for me it didn’t have a driver ready and I had to install it. I found this AUR package, so I installed it with:
pacaur -S epson-inkjet-printer-escpr
And after that I went back through the Add Printer steps in CUPS, and I was able to see the WF-2530 driver I needed to use.
I thought this was all good, but afterwards I ran into an issue with printing: It says “Unable to locate printer” in the Jobs list when I tried to print. That troubleshooting page contains the fix needed:
sudo pacman -S nss-mdns sudo systemctl start avahi-daemon.service sudo vim /etc/nsswitch.conf
Then edit the line in the nsswitch.conf file as instructed:
hosts: ... **mdns_minimal [NOTFOUND=return]** resolve [!UNAVAIL=return] dns ...
And it all works!
Mapping some keyboard keys
I really like Home and End keys. One of the things that drive me crazy is that laptop makers, particularly ultrabook makers, don’t like to include a Home and End key on the laptop keyboard natively, and always hide them behind the Fn key (Fn+left and Fn+right usually).
In the case of this Ideapad 720s, the laptop has PrtSc and Delete keys near the upper right of the keyboard, both of which I use pretty sparingly. I decided to map those two keys to Home and End respectively. The tool in Linux to help us do that is
xev I’m able to determine that the keycode for PrtSc is 107, and the keycode for Delete is 119. These two
xmodmap commands work just fine:
/usr/bin/xmodmap -e “keycode 119 = End Delete”
/usr/bin/xmodmap -e “keycode 107 = Home Print”
The trick is to get this to auto-run on startup. From this answer, I basically created a
~/.Xmodmap file and put the following in it:
keycode 119 = End keycode 107 = Home
And then created a
~/.config/autostart/my-xmodmap.desktop file with this:
[Desktop Entry] Name=MyXmodmap Exec=/usr/bin/xmodmap /home/bigi/.Xmodmap Terminal=false Type=Application X-GNOME-Autostart-enabled=true
And chmod’ed it to executable, and it all works.
Setting the battery indicator in GNOME top bar to show percentage
Maybe it’s my pet peeve, but I really like seeing the percentage remaining of the battery in the top right indicator in GNOME. I was slightly annoyed this wasn’t something you can set in the Settings UI. The good news is, we’re now on GNOME version 3.28+, and you don’t have to install any GNOME shell extensions to do this. Simple run this in terminal:
gsettings set org.gnome.desktop.interface show-battery-percentage true (source)
Night mode lighting — Redshift not needed
If you’re used to a different distro, you may be used to installing Redshift for night mode lighting (removing blue lights and making your screen yellow-ish at night for better eye and sleep health) — similar to f.lux on Windows and Mac. GNOME actually comes with this feature, under Settings -> Displays -> Night Light. No need to install Redshift.
Disabling tap-and-drag on the touchpad in GNOME
Also a personal preference: while I really like tap-to-click and even double-tap for double-click, I’m really not a fan of double-tap-and-drag. 99% of the time this happens, it’s by accident. I could be accidentally selecting text and deleting them from my input, or dragging a Chrome tab around when I don’t intend to.
Under Settings -> Device -> Mouse and Touchpad, there are options like Natural Scrolling, Tap to Click, and more, but there isn’t an option for tap-and-drag. Turns out it’s a setting hidden from the UI but can be set in command-line with
gsettings set org.gnome.desktop.peripherals.touchpad tap-and-drag false
By the way, you can list all the keys under
touchpad to see what else you want set:
$ gsettings list-keys org.gnome.desktop.peripherals.touchpad send-events natural-scroll tap-to-click two-finger-scrolling-enabled left-handed click-method speed tap-and-drag edge-scrolling-enabled disable-while-typing
Keyboard repeat keys and delay settings
These are adjustable in the Settings app, but can also be set from command line with
gsettings. I have found my favorite to be:
gsettings set org.gnome.desktop.peripherals.keyboard repeat-interval 30 gsettings set org.gnome.desktop.peripherals.keyboard delay 209
Installing Visual Studio Code
VS Code is my main code editor now. To install it on Antergos/Arch, you actually can’t use the default package manager
pacman, but have to use
pacaur. First install
sudo pacman -S pacaur, and then install VS Code with:
pacaur -S visual-studio-code-bin.
If you’re on the same Antergos version as me though, there is currently a bug. Installing VS Code with
pacaur with default
pacman config will throw an error about the
\--color flag being not found. Simply edit
/etc/pacman.conf and find the line with
Color (capital C) and uncomment it. (source)
Installing Chinese fonts
This is the short and sweet article on installing Chinese fonts to use on Arch/Antergos. It comes down to simply
pacman -S installing the fonts you desire on this wiki page. Restart any running Chromium instances to get the new fonts on the browser post-install.
Getting Apache and PHP working
I still have a bunch of projects I am running PHP (5) for, so I would like to have a local Apache and PHP 5 environment.
I found that Antergos’ Pacman repo defaults to PHP 7 (which is reasonable), so I actually had to install PHP 5.6 via
pacaur again. First, install Apache with
sudo pacman -S apache. RedHat family distros fans will be happy to learn that Apache on Antergos/Arch is called
httpd instead of
apache2 like in the Ubuntu/Debian family.
After that, it’s installing PHP. Now, I don’t know if it’s needed to separately install both
php56-apache, but I did it in that order anyway — but it seems like
php56-apache installs much of the same files (judging from the output). If you want to be safe, do both
pacaur -S php56 and
pacaur -S php56-apache. But I must note that each one will take 15+ minutes.
I personally ran into an
unknown public key error while doing this install, and had to manually import the keys (source):
gpg --keyserver hkp://hkps.pool.sks-keyservers.net --recv-keys C2BF0BC433CFC8B3 FE857D9A90D90EC1
php56-apache installation is done, follow the instruction on screen to add these lines to your
LoadModule php5_module modules/libphp56.so Include conf/extra/php56_module.conf
Then I also had to swap the comment/uncomment of the following lines (source), that is, I have to use
#LoadModule mpm_event_module modules/mod_mpm_event.so LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
After this, my Apache and PHP 5.6 are up and running properly. You can start/stop/restart Apache by
sudo systemctl restart httpd (replace restart with start/stop). Note that if Apache/PHP had issues starting, a lot of times it won’t print errors in
/var/log/httpd/error_log but you would see the errors with the command
sudo systemctl status httpd.
This PHP 5.6 setup by default disables a lot of extensions you would normally expect to be enabled, such as
zip. (Those 3 specifically are needed for
composer to run) Edit the file
/etc/php56/php.ini and find the lines with
;extension=openssl.so (and other extensions you want) and uncomment them by removing the semi-colon in front. The modules are all there in
/usr/lib/php56/modules, they are just not enabled by default in config.
This would allow a standard
composer downloaded from getcomposer.org to run correctly, and you do not need to install
pacaur (which didn’t work for me anyway).
That’s about it
I believe I’ve currently resolved all the issues I’ve run into since installation. So far, I can say I like this laptop with Antergos Linux better than CentOS 7. It could be that I’m using GNOME now instead of KDE like I was on CentOS, and GNOME is simply a little fancier than the basic environment of KDE. But I do also like how active the Arch/Antergos community is and there hasn’t been much difficulty finding solutions to my problems.