Skip to content

Instantly share code, notes, and snippets.

@peci1
Last active April 8, 2022 01:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save peci1/3d53c173193ab55223016edc21b1511b to your computer and use it in GitHub Desktop.
Save peci1/3d53c173193ab55223016edc21b1511b to your computer and use it in GitHub Desktop.
Install Ubuntu 18.04 on Lenovo T14s AMD with Ryzen 7 PRO 4750U CPU and AMD Renoir GPU

Ubuntu 18.04 on Lenovo T14s

What's the problem?

The Ryzen CPU and Renoir GPU are too new for all kernels supported by Ubuntu 18.04 (5.4 is the latest supported). The notebook will boot with 18.04.5, but a lot of things will not work (sleep, screen brightess, audio, graphics only works in a limited way etc.).

This tutorial shows the steps necessary to be done to successfully run the system with full support for the GPU and other peripherals.

Steps

  1. Install Ubuntu 18.04.5 HWE from a flash drive
  2. sudo apt update && sudo apt dist-upgrade
  3. Install https://github.com/bkw777/mainline
  4. Using Mainline, install latest kernel 5.10.* (newer 5.11 or newer might also work, but 5.10 is a long-term support version, which means it should be easier maintainable in the future).
  5. Add PPA https://launchpad.net/~kisak/+archive/ubuntu/kisak-mesa (it provides updated Mesa package with graphics support)
  6. Download the following firmware packages:
  1. Unpack each of the firmware archives and copy the contents to /lib/firmware (retaining the folder structure).
  2. Reboot and pray :-D

CPU throttling prevention

If you give the CPU a decent load for more than a minute, the CPU might get throttled all the way down to 400 MHz!

First thing is knowing the current frequency of your CPU. https://extensions.gnome.org/extension/1082/cpufreq/ might help if you use Gnome. This program also has a switch that enables turbo frequencies. Switch it on!

There's no other way to avoid throttling than removing heat from the chassis. That's best done with the internal fan. However, the preinstalled control mechanism tops at 3900 rpm, which is not enough to avoid throttling. Here's what you can do to increase the fan speed.

Create file /etc/modprobe.d/thinkpad_acpi.conf with the following content:

options thinkpad_acpi fan_control=1

Save it and reboot.

After the reboot, the following should work:

echo level full-speed | sudo tee /proc/acpi/ibm/fan

To set the fan back to automatic control, do:

echo level auto | sudo tee /proc/acpi/ibm/fan

You can also install the thinkfan utility to manage this automatically. Or you can just integrate the max-fan command into your computation-heave pipeline launcher.

ROS-specific problems

RViz

If you have problems with RViz crashing when displaying pointclouds, run rviz with parameter --opengl 310.

Ignition-specific problems

SubT simulator crashes with Rescue Randy in scene

For me, SubT simulator crashes when I load a scene with Rescue Randy. The solution is to partly revert gazebosim/gz-rendering#251 . It will cause incorrect rendering of particle effects, but that's mostly it.

  1. Checkout version ign-rendering4 of https://github.com/ignitionrobotics/ign-rendering
  2. Comment out lines https://github.com/ignitionrobotics/ign-rendering/blob/7d55d9b24a805875258975cb7d48c072e3a55493/ogre2/src/Ogre2DepthCamera.cc#L694-L712
  3. Change num passes from 5 to 4 on line https://github.com/ignitionrobotics/ign-rendering/blob/7d55d9b24a805875258975cb7d48c072e3a55493/ogre2/src/Ogre2DepthCamera.cc#L668
  4. mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr .. && make -j16 && sudo make install
  5. After each update of libignition-rendering4-ogre2 package via package manager, update you local checkout of ign-rendering and re-do the manual installation step
@peci1
Copy link
Author

peci1 commented Apr 12, 2021

Fingerprint reader login

# Install distribution fprintd
sudo apt update && sudo apt install fprintd

# install meson build system
sudo apt-get install python3 python3-pip python3-setuptools pyhton3-wheel ninja-build
sudo pip3 install meson

# install libfprint
git clone https://gitlab.freedesktop.org/libfprint/libfprint
cd libfprint
mkdir build && cd build
meson configure .
meson compile
sudo meson install

# install fprintd
cd ../..
git clone https://gitlab.freedesktop.org/libfprint/fprintd
cd fprintd
git checkout v1.90.9
# open meson.build file and comment out line containing pypamtest
mkdir build && cd build
meson configure . -Dpam=true
meson compile
sudo meson install

# restart fprintd service
sudo systemctl restart fprintd.service

Open gnome user account settings and you should see "login using fingerprint" option. Click it and fingerprint enrollment will start.

@peci1
Copy link
Author

peci1 commented Apr 12, 2021

Network card in Lenovo Thunderbolt 3 Dock Gen 2

The driver available in kernel is somewhat outdated and sometimes the NIC stops working or prevents sleep. This will install a DKMS module building the newest available version of the driver directly from Realtek.

sudo apt update && sudo apt install dkms
cd /usr/src
sudo git clone https://github.com/wget/realtek-r8152-linux
sudo mv realtek-r8152-linux r8152-2.14.0
cd r8152-2.14.0

Then create file /usr/src/r8152-2.14.0/dkms.conf with the following content:

PACKAGE_NAME="r8152"
PACKAGE_VERSION="2.14.0"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$module/$module_version/build EXTRA_CFLAGS='-DCONFIG_R8152_NAPI -DCONFIG_R8152_VLAN' modules"
CLEAN="rm src/${PACKAGE_NAME}.ko src/*.o || true"
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"

Then call

sudo dkms install -m r8152 -v 2.14.0

Reboot, and you're done.

You can check the version of the driver you're using by

modinfo r8152 | grep ^version

If it shows 2.14, that's the latest one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment