Greetings, fellow netizen. Today we’re going to install Ubuntu on Redmibook 16 Ryzen edition (Ryzen 4700U).
- Ubuntu version
- Display brightness
- Night light
- Fn button
- Still doesn’t work
First off, choosing Ubuntu version. There’s 20.04 LTS and 20.10 at this point. But the only important difference between them is kernel version, which is 5.4 in 20.04 and 5.8 in 20.10. The new kernel can be installed on LTS too, though, so we’re going to pick 20.04.
Installation works properly. No issue here, just follow the standard procedure. The only strange thing is that it won’t connect to 5Ghz wifi. 2.4 Ghz works.
Right after first login, trying the brightness buttons, it turns out that they don’t work. A quick search turns up this. Apparently, this needs kernel 5.5, and some sources even say 5.7.
Well, no problem. Installing a newer kernel:
sudo apt install linux-generic-hwe-20.04-edge
This gets us to 5.8 (at this point).
Reboot and see that brightness buttons now work!
And right after that, another hiccup. A bluetooth mouse won’t get detected by the laptop. However, a headset works fine. Trying to do a lescan yields no result.
Time to search again. Bugzilla has some info with apparently the same problem. Specifically, it mentions Realtek
Let’s see if we have that one:
lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 0cb5:c547 Realtek Bluetooth Radio Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Looks like it’s one of the devices mentioned in bugzilla:
RTL8822CE. And here’s a patch for it. Of course, it’s not in the kernel yet, so we’ll have to do some compilation.
Instead of compiling the whole kernel, as suggested in the discussion, let’s try to compile
btusb module only. Should be faster and less work.
We’ll still need to the sources for the whole kernel, of course.
sudo apt install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache bison flex # some packages for building wget https://github.com/torvalds/linux/archive/v5.8.tar.gz # since we're on 5.8 kernel tar zxf v5.4.tar.gz cd linux-5.4/drivers/bluetooth vi btusb.c
Apply the patch, save it.
Then, as described here (you should still be in
make -C /lib/modules/$(uname -r)/build M=$PWD modules
btusb.ko is in the same directory. Let’s try to load it:
cp /usr/lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko ~/btusb.ko.bak cp btusb.ko /usr/lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko modprobe -r btusb modprobe btusb ...could not insert btusb.ko: Operation not permitted
Oops. What’s wrong? Dmesg to rescue:
Lockdown: modprobe: Loading of unsigned module is restricted; see man kernel_lockdown.7
Riiight, so the module is not signed, and the kernel refuses to load it. Unfortunately, the only way to do that is to disable UEFI Secure Boot. So:
- Enter BIOS (
- Set a supervisor password if there isn’t one yet.
- Disable Secure Boot.
- Save and exit.
Check dmesg again:
dmesg | grep -i blue [ 1.987803] usb 1-4: Product: Bluetooth Radio [ 9.839189] Bluetooth: Core ver 2.22 [ 9.839205] Bluetooth: HCI device and connection manager initialized [ 9.839208] Bluetooth: HCI socket layer initialized [ 9.839210] Bluetooth: L2CAP socket layer initialized [ 9.839212] Bluetooth: SCO socket layer initialized [ 9.858744] Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000c lmp_ver=0a lmp_subver=8822 [ 9.860923] Bluetooth: hci0: RTL: rom_version status=0 version=3 [ 9.860925] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cu_fw.bin [ 9.864089] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cu_config.bin ...
Great, it loads
rtl8822 driver, which is what we need.
Try to pair with the mouse again (don’t forget to put it into pairing mode!). It works even without
hcitool lescan. Yay!
And just so we don’t get any funny bussiness with accidental kernel upgrade, let’s pin kernel version:
sudo apt-mark hold linux-generic-hwe-20.04-edge apt-mark showhold linux-generic-hwe-20.04-edge
- Still can’t connect to 5 Ghz WiFi.
- The mouse feels choppy. No amount of tinkering with Bluetooth settings helps. It could be due to interference of Bluetooth with 2.4 Ghz wifi.
So let’s get on that. Without going into long details, let me say that the only thing that actually works is an alternative driver from this repo. However, the version from PatoJad apt repo failed to install on kernel 5.8 (the fix is on github, but it appears that the debs weren’t rebuilt with it yet). So, installing from deb directly:
wget https://github.com/juanro49/rtl88x2ce-dkms/releases/download/5.7.3_35403_1/rtl88x2ce-dkms_35403_amd64.deb sudo dpkg -i ./rtl88x2ce-dkms_35403_amd64.deb sudo modprobe rtl88x2ce
… No change. Apparently, we need to unload old modules.
$ sudo apt install hwinfo $ hwinfo --wlan 10: PCI 100.0: 0282 WLAN controller [Created at pci.386] Unique ID: yWPJ.iGV+_7vRbHF Parent ID: e6j0.JhR1dXh1J9E SysFS ID: /devices/pci0000:00/0000:00:01.2/0000:01:00.0 SysFS BusID: 0000:01:00.0 Hardware Class: network Model: "Realtek WLAN controller" Vendor: pci 0x10ec "Realtek Semiconductor Co., Ltd." Device: pci 0xc822 SubVendor: pci 0x1d2e SubDevice: pci 0xc823 Driver: "rtw_8822ce" Driver Modules: "rtw88_8822ce" ...
rtw_8822ce is still used for the device. Checking
/etc/modprobe.d, looks like blackisting is also not applied by the deb package. Let’s do that manually:
wget https://raw.githubusercontent.com/juanro49/rtl88x2ce-dkms/master/rtw88_blacklist.conf sudo cp rtw88_blacklist.conf /etc/modprobe.d/rtw88_blacklist.conf
And now, reboot. (You can do some
modprobe commands to enable it without reboot, but anyway it’s better to check that everything works from scratch).
hwinfo --wlan 10: PCI 100.0: 0282 WLAN controller [Created at pci.386] Unique ID: yWPJ.iGV+_7vRbHF Parent ID: e6j0.JhR1dXh1J9E SysFS ID: /devices/pci0000:00/0000:00:01.2/0000:01:00.0 SysFS BusID: 0000:01:00.0 Hardware Class: network Model: "Realtek WLAN controller" Vendor: pci 0x10ec "Realtek Semiconductor Co., Ltd." Device: pci 0xc822 SubVendor: pci 0x1d2e SubDevice: pci 0xc823 Driver: "rtl88x2ce" Driver Modules: "rtl88x2ce" ...
Now we’re talking! Connect to 5Ghz - works! And mouse movement is no longer choppy, too!
Although, now for some reason there’s 2 WLAN devices reported in
hwinfo output. And the Gnome shows 2 wifi devices as well. Well, nevermind as long as it works.
Night light worked strangely. For some reason it would get enabled and the right away go back to daylight setting. Then I installed Redshift, which worked fine. Then I disabled Redshift and tried Night light again. This time, there was no problem. Magic?
Anyway, if NL doesn’t work for you, just use RS instead:
sudo apt install redshift redshift-gtk
F1-F12 work as if
Fn is always pressed, use
Fn+ESC combination to switch the default mode.