Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1cs/6329f9bd5d0f885701e28277e6552c13 to your computer and use it in GitHub Desktop.
Save j1cs/6329f9bd5d0f885701e28277e6552c13 to your computer and use it in GitHub Desktop.
Install r8168 Fedora 36 Linux 5.19 with Secure Boot activated

Install required tools

sudo dnf install -y openssl kernel-devel mokutil keyutils

Check current keys

mokutil --sb-state

Create your own key

mkdir keys && cd keys
cat << EOF > x509.genkey
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts

[ req_distinguished_name ]
O = Org
CN = Org signing key
emailAddress = org@gmail.com

[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
EOF
openssl req -new -nodes -utf8 -sha512 -days 36500 -batch -x509 -config x509.genkey -outform DER -out signing_key.x509 -keyout signing_key.pem

Copy the keys

sudo cp signing_key.pem signing_key.x509 /lib/modules/$(uname -r)/build/certs

Blacklist module

echo 'blacklist r8169' | sudo tee -a /etc/modprobe.d/blacklist-r8169.conf

Update kernel with this blacklist

sudo dracut -f

Enrolling Public Key on System

sudo mokutil --import signing_key.x509 # will ask you a password. keep it mind.
reboot

After reboot you will see MOK Manager interface and will be asked to enroll the key.
First select "Enroll MOK".
Then "Continue".
Hit "Yes" and enter the password.
Then select "OK" and your device will reboot again.

Clone the module supported for kernel 5.19

git clone --recursive https://github.com/jerry4718/r8168-support-kernel-5.19.x.git && cd r8168-support-kernel-5.19.x
sudo ./autorun.sh

Hook to compile and install module on new install kernel

sudo dnf install python3-dnf-plugin-post-transaction-actions
sudo cp -rf r8168-support-kernel-5.19.x /usr/local/src
echo 'kernel:in:/usr/local/src/r8168-support-kernel-5.19.x/autorun.sh' | sudo tee -a /etc/dnf/plugins/post-transaction-actions.d/r8168.action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment