Getting make, build-essential, and ethernet drivers installed on Ubuntu 18.04 machine without Internet access (but with USB sticks)

Context: I have a freshly built Ubuntu 18 machine. From a separate Macbook Pro laptop, I created a bootable USB stick with Ubuntu 18.04.4 which I did by following the instructions here for Mac OS. The installation seems to have worked, but I have no Internet. I have an Ethernet cable that is plugged directly into the machine, and I have been using this same Ethernet cable for the last four months on a different machine, and the wired connection worked fine. The network I am using is also the same one I use on my Macbook Pro laptop (which I'm using to type this) so the Internet is working.

First, after the fresh Ubuntu 18 installation, I saw that my wired connection was not working. (And, neither can I connect using WiFi.) Here is what I see:

$ sudo lshw -C network
  *-network                 
       description: Wireless interface
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 14.3
       bus info: pci@0000:00:14.3
       logical name: wlo1
       version: 00
       serial: ac:67:5d:f6:f7:a7
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.3.0-28-generic firmware=48.13675109.0 latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:51214000-51217fff
  *-network UNCLAIMED
       description: Ethernet controller
       product: Realtek Semiconductor Co., Ltd.
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       version: 05
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:3000(size=256) memory:51100000-5110ffff memory:51110000-51113fff

$ uname -r
5.3.0-28-generic

This seems to be an issue with drivers, judging from these questions:

  • Question. The top answer (with one vote) suggests "the adapter will be managed by the kernel in-tree module" but I don't know what this means, and I cannot uninstall r8168-dkms as it isn't on the machine.
  • Question. The top answer suggests to use something called dkms. I get a command not found when typing dkms.
  • Question. This seems related but is talking about WiFi. I am trying to get my wired connection to work, which I was hoping would be as simple as plugging my Ethernet cable in the machine.

I tried to follow the designated answer to the first question (this answer specifically). I downloaded the latest version of the driver here on my Macbook, put it on my USB stick, then transferred it to my Ubuntu machine. Then I ran it:

$ tar xfvz r8168-8.048.03.tar.gz 
r8168-8.048.03/
r8168-8.048.03/Makefile
r8168-8.048.03/README
r8168-8.048.03/autorun.sh
r8168-8.048.03/src/
r8168-8.048.03/src/Makefile
r8168-8.048.03/src/Makefile_linux24x
r8168-8.048.03/src/r8168.h
r8168-8.048.03/src/r8168_asf.c
r8168-8.048.03/src/r8168_asf.h
r8168-8.048.03/src/r8168_dash.h
r8168-8.048.03/src/r8168_fiber.h
r8168-8.048.03/src/r8168_n.c
r8168-8.048.03/src/r8168_realwow.h
r8168-8.048.03/src/rtl_eeprom.c
r8168-8.048.03/src/rtl_eeprom.h
r8168-8.048.03/src/rtltool.c
r8168-8.048.03/src/rtltool.h

$ cd r8168-8.048.03/

$ sudo ./autorun.sh 
Check old driver and unload it.
Build the module and install
./autorun.sh: 30: ./autorun.sh: make: not found

Unfortunately this doesn't work because my machine doesn't have make or build-essentials.

$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package build-essential is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'build-essential' has no installation candidate


$ sudo apt-get update
Err:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
  Could not resolve 'us.archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not resolve 'security.ubuntu.com'
Err:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
  Could not resolve 'us.archive.ubuntu.com'
Err:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

So then I am curious about how to get all of these installed (build-essential, make, and similar commands, perhaps dkms) on a machine that doesn't have Internet working? Searching results in these questions:

  • Question. This one says to do a sudo apt install command, but as shown above, that is not working.

  • Question. This one didn't get much attention and the answerer only has several imperfect solutions.

  • Question. The answerer suggests running another sudo apt command. Here it is:

    $ sudo apt-get -qq --print-uris install build-essential linux-headers-$(uname -r) | cut -d\' -f 2 > urls.txt
    E: Package 'build-essential' has no installation candidate
    

    As shown there, I am running into errors since it comes down to lacking build-essential.

  • Question. This old question and the discussion here seems to suggest using apt-offline. However, it requires a sudo apt install apt-offline to install in the first place. :)

Just to be clear, when people build new machines and then install Ubuntu 18 with a bootable USB, how exactly is Internet "enabled" on the machine? Is there a step I am missing in the process? I thought I just needed to plug in my Ethernet, so I must be misunderstanding something.

TL;DR: I am looking for the simplest way to get wired Internet connection (as well as build-essential, since that seems heavily related) on a freshly built Ubuntu 18.04 machine, perhaps by downloading something on a USB stick on my Macbook Pro, but I will take any solution that works. Thanks!


Update 1: to be specific, I downloaded the Desktop version onto my USB stick. I downloaded the .iso version highlighted here, the one that is 2.0G:

enter image description here

And you can find the list here.


Update 2: Here are some potentially relevant commands:

$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

$ cat /etc/netplan/*.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

Update 3: here are some relevant machine specifications:

  • Intel i7-10700k CPU
  • Gigabyte Z490 Aorus Elite Motherboard (this is what I ordered)

Update 4: I ended up buying this cheap USB WiFi adapter, and all I had to do to get WiFi was to just plug it in my computer. No other things necessary. Whew ... now I just need to figure out how to get the Ethernet working ...


Update 5: I tried following these instructions to run sudo apt-get install r8168-dkms and rebooted, but the wired ethernet is still not working.


Update 6: resolved. :) I bought a USB to Gigabit Ethernet adapter, and this caused the wired connection to work right away. This is the one I got, since I saw that it was compatible with Linux. I did not upgrade the BIOS.


What you need is not just downloading build-essential and make, these packages depend on many other packages and you need all of them.

Also in order to build the network cards driver for your machine, probably you need some other libraries.

If you have access to another Ubuntu machine (or VM), you can download any package in your working directory using this command:

apt-get download <packages name here>

like this:

apt-get download build-essential make libc6-dev g++ gcc dpkg-dev libc

then copy the packages using a USB disk and install them on the target machine using dpkg or apt.

sudo dpkg -i <path to .deb file here>

or

sudo apt-get install <path to .deb file here>

if you need to find the dependencies of a package you can search it in Ubuntu Packages


BIOS

Gigabyte Z490 Aorus Elite

You have BIOS version F2.

There's a newer BIOS available, version F5d, from 7/9/2020, and can be downloaded here.

Note: Confirm that I have the correct web page for your motherboard.

Note: Have good backups before updating the BIOS.