eth0 ERROR while getting interface flags: no such device

I had opened a terminal to install macchanger via sudo apt-get install -y macchanger, and then entered my password. It stated that macchanger was already the newest version, so I typed clear and then ran:

sudo ifconfig eth0 down

which is when this error message appeared:

eth0 ERROR while getting interface flags: no such device

This is a laptop and I am connected via ethernet cable.

How can I resolve this, so that I can run macchanger?


So I used ifconfig -a and I'm looking but seeing no mention of eth0

The interfaces that are showing top to bottom are:

enp58s0f1
lo
tun0
UNSPEC
wlp59s0

The only reference to ethernet is the MAC and also txqueuelen

Does this help in figuring what I need to do to get this sorted?


According to your ifconfig -a output, enp58s0f1 is your Ethernet, not eth0.

When Ubuntu switched to systemd (at Ubuntu 15.04), it switched away from the old system with eth0 and so on to what are called Predictable Network Interface Names. Ethernet interfaces start with en (so yours is enp58s0f1). Wireless interfaces start with wl.


First, read the manual.

man ifconfig

Then, afterwards, you'll understand what ifconfig does. also, ifconfig is considered to be a deprecated tool (i still use it however, it's handy because it's familiar and easy to use).

ifconfig -a

Will display all interfaces.

ip address # will also display similar information.

You might want to do some googling on some basic networking commands and how they work. TLPD has a quick synopsis on some of the most common commands in linux for networking.

My arch system is configured to give older interface names, but the newer names (automatically configured by ubuntu) give newer (more complicated, harder to remember, and type) information.

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.254.3/24 brd 192.168.254.255 scope global dynamic wlan0
       valid_lft 82688sec preferred_lft 82688sec
    inet6 f::f:f:f:f/64 scope link 
       valid_lft forever preferred_lft forever

You can see I have 3 interfaces, lo (for loopback), eth0 (for ethernet), and wlan0 (for wireless). If you don't use the correct interface name, then it won't work.

The following command will bring the interface up if it was down. The Ubuntu Server Guide has some detailed information on how to accomplish configuration, bringing the interface down, and back up.

sudo ip link set eth0 up