future person with the same problem.
I found out what the problem was. My WIFI card is MediaTek Wi-Fi 6 MT7921, which is currently supported by the linux kernel 5.16, is poorly supported by the 5.13 kernel, which is the one that shipped with my Ubuntu 21.10. It actually works on the first boot very poorly, and for the next boot it will not work at all.
Thus the solution is to upgrade to the new kernel with the commands:
# download the kernel files, headers, modules...etc
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600_5.16.0-051600.202201092355_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-image-unsigned-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-modules-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
now install the kernel in you system:
sudo dpkg -i *.deb
fix broken dependencies:
sudo apt install -f
You can reboot now, and it might work if you are not using safe boot.
However if you are, then you need to disable it or sign the kernel yourself.
I followed this guide.
But the basic step of sign the kernel are:
make a file called mokconfig.cnf
with the text:
# This definition stops the following lines failing if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
[ req ]
distinguished_name = req_distinguished_name
x509_extensions = v3
string_mask = utf8only
prompt = no
[ req_distinguished_name ]
countryName = <YOURcountrycode>
stateOrProvinceName = <YOURstate>
localityName = <YOURcity>
0.organizationName = <YOURorganization>
commonName = Secure Boot Signing Key
emailAddress = <YOURemail>
[ v3 ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical,CA:FALSE
extendedKeyUsage = codeSigning,1.3.6.1.4.1.311.10.3.6
nsComment = "OpenSSL Generated Certificate"
file <> parts with your information. Make sure to only use two character for the Country, state and city, ex: US CA LA
Create the public and private key for signing the kernel:
openssl req -config ./mokconfig.cnf \
-new -x509 -newkey rsa:2048 \
-nodes -days 36500 -outform DER \
-keyout "MOK.priv" \
-out "MOK.der"
Convert the key also to PEM format (mokutil needs DER, sbsign needs PEM):
openssl x509 -in MOK.der -inform DER -outform PEM -out MOK.pem
Enroll the key to your shim installation:
sudo mokutil --import MOK.der
Restart your system. You will encounter a blue screen of a tool called MOKManager. Select "Enroll MOK" and then "View key". Make sure it is your key you created in step 2. Afterwards continue the process and you must enter the password which you provided in step 4. Continue with booting your system.
Verify your key is enrolled via:
sudo mokutil --list-enrolled
Sign your installed kernel (it should be at /boot/vmlinuz-[KERNEL-VERSION]:
sudo sbsign --key MOK.priv --cert MOK.pem /boot/vmlinuz-[KERNEL-VERSION]-surface-linux-surface --output /boot/vmlinuz-[KERNEL-VERSION]-surface-linux-surface.signed
sudo cp /boot/initrd.img-[KERNEL-VERSION]-surface-linux-surface{,.signed}
sudo update-grub
now you can reboot =)