Ethernet Controller Driver deleted/corrupted/not working

I somehow either deleted or corrupted the driver that runs the ethernet connection for my motherboard and I'm not sure how this happened. I know this is what happens because my internet works on my other devices and I live booted another distro and the internet connection was stable.

Is there a way to fix this or do I need to hunt down the appropriate driver file to fix this issue?

Computer Specs:

Computer model: HP EliteDesk 800F1 TWR (tower)
CPU: Intel i7-4790 (8) @ 4,000 GHz
GPU: Intel HD Graphics

lspci | grep Ethernet should should you the onboard ethernet device. Mine is Realtek.

lsmod | grep real shows the modules loaded that match real.
Maybe some module is missing.

The Ethernet controller is this: Intel Corporation Ethernet Connection I217-LM (rev 04)

When I run lsmod | grep Ethernet Connection I217, I see no results. That tells me that it probably somehow got deleted. lol

It may be a missing module, like you said. I ran lsmod | grep intel and I found a bunch of different files. None of them seem to line up with being the ethernet controller

maybe reinstall your kernel which will bring the all the modules.
or install the e1000 driver from Intel

download the driver from https://downloadcenter.intel.com/download/15817
make install in the src folder
rmmod e1000e
modprobe e1000e
and to make the new driver survive a reboot update-initramfs -u

How would I reinstall the kernel? Do I just do I just download it from somewhere and use that to patch the system?

My system is running kernel 5.13.0-37 generic

Since I don't know what you did to your system (all I read is onboard Ethernet does not work) , I throw suggestions. You mentioned a live usb boots up and Ethernet works, right?

If the kernel modules were messed up, then by reinstalling the kernel you will get the full /usr/src/linux-headers-{uname -r} tree and rebooting that kernel may fix the issue.

dpkg -l | grep linux-image-.*-generic
sudo apt-get install --reinstall linux-image-5.X.Y-ZZ-generic

Or you can try booting an older kernel.

I'm not sure what I did either. lol. I can't even hotspot my desktop computer. the internet just doesn't connect at all because of this.

When I run the second command you typed, it keeps trying to access the files from the internet instead of pulling them from somewhere saved on the computer. If there is a copy of the kernel saved on the computer somewhere, I should be able to reinstall it like that. I think

run sudo apt autoremove to keep the latest 3 kernels. Another idea is to change the sym.link vmlinuz to point to the previous kernel, run sudo update-grub, and reboot.

can you paste ls -l /boot ... also, ls -l /usr/src/

Screenshot at 2022-03-25 09-14-49

Reboot and in GRUB menu select the 35 kernel or point vmlinuz to 35, update-grub, and reboot. See if any of those kernels enable your Ethernet (Wired connection 1).

Here's an update. Turns out it wasn't the driver that was messed up, it's just a DNS problem, which I don't know how to solve either. lol

Thank you for your patience in helping me try to figure this out.