← Notes

April 24, 2021

Ubuntu server 20.04 installation without GPU


Tags: server ubuntu grub

These days GPU prices are through the roof. I need to set up a new server, but I don't have a graphics card for it nor I need it. So the idea is to simply install Ubuntu Server 20.04 with a GPU from another system and to remove it afterwards. To do that I just need to perform the installation as usual and remember to install OpenSSH server to get access to the headless system later on. After logging in open /etc/default/grub and set:

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
GRUB_CMDLINE_LINUX=""

Save and close and update grub with:

sudo update-grub

The kernel contains the video mode which is loaded at boot. nomodeset is used to skip this step.

Before removing the GPU we have to tinker with the network interfaces. When installing the OS, the installer detects automatically the device names of the network card and assigns the default settings. When the GPU is removed the device count goes down by one and it may mess up the device naming and hence the default network settings.

For instance, my network card has the device name enp6s0, but when I remove the graphics card the assigned name is enp5s0.

To find the device name you can use:

ip link

To change the network settings open up the default yaml file in /etc/netplan. In my case I had:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp6s0:
      dhcp4: true

You can add the device name that is going to be assigned to the network interface, enp5s0 in my case. In this way the network is brought up with and without graphics card. This is a good time to set a static IP if you're not already doing so with the DHCP service in your router.

Here's the documentation.

network:
  version: 2
  renderer: networkd
  ethernets:
    enp5s0:
      dhcp4: true
    enp6s0:
      dhcp4: true

This naming issue could be avoided by adding net.ifnames=0 biosdevname=0 to the grub cli entry like so:

GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0 biosdevname=0 nomodeset text"

With these settings a different naming convention is used and the network device should be assign the name eth0. Either way, you have to change the netplan.

You can find more info about these options on SO.

It is now time to shut the computer down.

sudo shutdown -h now

Once the system is powered down, you can extract the GPU and boot it back up. Wait some 30 seconds and try to access the server through SSH.