Score:0

accidentially deleted the eth0 item, how can I get it back?

jp flag

I am newby to ubuntu, trying to install ubuntu-server 20.04. During my 1st installation, the network was working good. Per my memory, there was a "enxxx" item at Network Connections page, but I deleted it somehow when I was messing with it.

For some reasons, I have to reinstall the system, but this time I can't find the item indicating the ethernet card. Worse, I can't get any tool since no access to the Internet after installation, say, sudo apt-get install ifconfig is impossible.

I hv tried edit the netplan /etc/netplan, as the answer suggested. also I'd checked the bios, the mac of the ethernet is there.

Please advise how I can solve this issue, or any hint is most welcome. Thanks.

btw, the newly-installed system even doesn't know auto command.

the regular network connection page

Screen when installing Screen when installing

result for ip a ip a

result for lshw lshw

result for lspci lspci

I can find the ethernet controller with sudo lshw -class Net but can't make it work.

lshw -class Net

for better understanding, here is my lshw -c network and netplan

  *-network UNCLAIMED
       description: Ethernet controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 1f.6
       bus info: pci@0000:00:1f.6
       version: 11
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list
       configuration: latency=0
       resources: memory:53300000-5331ffff

netplan

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
in flag
Can you [edit your question] to include the output of `ip a`, `sudo lshw -C network` and `lspci`? This will show hardware and network-related information that may help with an answer.
Eric Huang avatar
jp flag
@matigo many thanks, pls find the images attached. Seems the ethernet care is there, but I just don't know how to get it working.
Carles Mateo avatar
cn flag
Do you have a physical button in your laptop or a hotkey in your laptop's keyboard to enable/disable the Ethernet/Wifi?. Is it a USB dongle or a dedicated Ethernet port?. Cheers
Eric Huang avatar
jp flag
@CarlesMateo No, I don't think so, unfortunately.
Carles Mateo avatar
cn flag
@EricHuang please execute this command and paste the output. You should see your Ethernet device in there: ```ls -al /sys/class/net```
Eric Huang avatar
jp flag
@CarlesMateo only the "lo" soft linked to `../../devices/virtual/net/lo ` , Even I can see it, but I jus can't make it work.
heynnema avatar
ru flag
Are those screenshots from the current running system that has no ethernet? If so, edit your question and show me `cat /etc/netplan/*.yaml` and a full output of `sudo lshw -C network`. Start comments to me with @heynnema or I'll miss them.
Eric Huang avatar
jp flag
@heynnema Mnay thanks! for better reading experience, pls find the edited post. I'd added the content of the files on it.
Carles Mateo avatar
cn flag
@EricHuang when you say that you deleted eth0, what exact command did you execute to make this happen?.
heynnema avatar
ru flag
@EricHuang With little information to go on, please see my initial answer. If it helps to solve the problem, please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Thanks!
Eric Huang avatar
jp flag
@CarlesMateo when `ip a` I see nothing, but with `lshw -c network`, I can see it. Assuming that the os sees it, but don' t know how to deal with it, and that should be driver issue.
Score:0
ru flag

This assumes that you're installing Ubuntu Server 20.04...

Confirm that /etc/network/interfaces (if it exists) contains only this:

auto lo
iface lo inet loopback

Confirm that /etc/NetworkManager/NetworkManager.conf contains this:

[ifupdown]
managed=false

We'll change /etc/netplan/*.yaml...

cd /etc/netplan # change directory

ls -al # find the filename

sudo pico the_filename_shown_above.yaml # edit the file

Change this:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

To this:

# Let systemd-networkd manage all devices on this system
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: true

Save the file.

sudo netplan generate

sudo netplan apply

reboot

Eric Huang avatar
jp flag
Thanks, my question is that, how can it know the name of the ethernet care is `enp0s3`, since the os only see it at hardware level? one new information. I just checked with gigabyte, the motherboard company, they say they don't provide ubunbtu driver yet, I guess I have to go find it, and work again.
heynnema avatar
ru flag
@EricHuang It would be useful to know how/where you deleted eth0. Then I could come up with a more accurate answer. There is no driver required from GB. Try my .yaml file and see if it works.
heynnema avatar
ru flag
@EricHuang You could also boot to a Ubuntu **Desktop** USB/DVD and see if the ethernet works. If it does, do `sudo lshw -C network` and edit that output into your question.
heynnema avatar
ru flag
@EricHuang Status please...
heynnema avatar
ru flag
@EricHuang Status please...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.