How to Rebuild initramfs After Ubuntu Loses Network (September 2026)?

If your Ubuntu machine suddenly lost ethernet or Wi-Fi after a routine kernel upgrade, the fix is almost always rebuilding the initramfs. I have walked through this exact issue on more than a dozen servers and laptops over the years, and the same three commands bring the network back every time.

In this guide, I will show you exactly how to rebuild the initramfs after a kernel upgrade breaks your network in Ubuntu. You will learn why the problem happens, how to run the fix from a normal boot, how to recover from a Live USB when the system refuses to boot, and how to stop it from happening again.

Why Ubuntu Loses Network After a Kernel Upgrade?

Ubuntu loses network connectivity after a kernel upgrade because the initramfs becomes stale. The initramfs (initial RAM filesystem) is a small compressed image that the bootloader loads into memory before the real root filesystem is mounted. It contains the kernel modules and helper scripts needed to bring up your disks, your encryption stack, and your network hardware.

When Ubuntu installs a new kernel, the package manager drops new vmlinuz and kernel module files into /boot. But the initramfs image sitting next to that kernel was generated against the previous kernel state. If your network driver lived in a module that changed, was renamed, or is only shipped inside the linux-modules-extra package, the new initramfs may not include it.

During early boot, the kernel asks the initramfs to load the modules for your NIC. When those modules are missing, the network interface never comes up. You end up with a perfectly working kernel that simply cannot see the ethernet or Wi-Fi hardware. I have seen this break both wired and wireless connections on Ubuntu 22.04, 24.04, and even older 20.04 boxes running the HWE kernel.

Quick Fix: The Three Commands That Restore Your Network

If you still have a working terminal and you just need your network back, run these three commands in order:

sudo apt install --reinstall linux-modules-extra-$(uname -r) sudo update-initramfs -u sudo reboot

That rebuilds the initramfs against your current running kernel, includes the extra network drivers from linux-modules-extra, and reboots into a state where the network interface is brought up normally. In most cases the ethernet or Wi-Fi is back the moment the login screen appears.

How to Rebuild initramfs Step by Step?

If you want a fuller walkthrough, here is the procedure I run when a kernel update silently breaks the network. It covers the same commands but adds verification at every stage so you know what is happening.

Step 1: Check Your Current Kernel Version

Confirm which kernel you are actually running with uname -r:

uname -r

You will see something like 6.8.0-100-generic. That kernel is the one whose initramfs you need to rebuild. If you just rebooted into a new kernel and lost the network, this command confirms it.

You can also list every installed kernel image to see the candidates available in GRUB:

dpkg --list | grep linux-image

Step 2: Install or Reinstall linux-modules-extra

Many network drivers, especially for newer Realtek, Intel Wi-Fi 6/6E cards, and some Broadcom chipsets, live in the linux-modules-extra package rather than the main linux-image. After a kernel upgrade this package may not be present for the new kernel. Install or reinstall it for your running kernel:

sudo apt install --reinstall linux-modules-extra-$(uname -r)

If you do not know which driver you need, you can also let Ubuntu detect it automatically:

sudo ubuntu-drivers autoinstall

This pulls in DKMS-built modules and any extra drivers the installer recommends for your hardware.

Step 3: Rebuild the initramfs

Now regenerate the initramfs for the running kernel so it includes every module the new kernel expects to find:

sudo update-initramfs -u

The -u flag means update: it rewrites the existing initramfs in place against the current kernel. Watch the output for any “W: missing modules” lines. Those warnings tell you which driver failed to load and is a clue if the fix does not work on the first try.

For reference, you can inspect the resulting image with lsinitramfs to confirm your network module is inside:

lsinitramfs /boot/initrd.img-$(uname -r) | grep -i e1000

Swap e1000 for your driver name (r8169, iwlwifi, mt76, etc.) to verify it is included.

Step 4: Reboot and Verify

Reboot the system so the freshly built initramfs is loaded by the bootloader:

sudo reboot

After the system comes back up, run the verification steps in the section below to confirm the interface is up and reachable.

Understanding update-initramfs -u vs -c

Two flags show up constantly: -u for update and -c for create. They sound similar but behave differently. Use -u when you want to refresh the existing initramfs image for the running kernel, which is the right call 95% of the time. Use -c when you need to build a brand new image from scratch, for example after manually copying a kernel into /boot or after a partial package failure left no initramfs at all.

You can also target a specific kernel instead of the running one:

sudo update-initramfs -u -k 6.8.0-100-generic

This is useful on servers where you are preparing an initramfs for a kernel that will be active after the next reboot.

How to Verify Your Network Is Restored?

Never assume the fix worked. Run a quick verification. Start by listing interfaces:

ip a

You should see your ethernet or wlan interface in the UP state with an IPv4 address. If the interface is present but down, bring it up:

sudo ip link set eth0 up

Then confirm reachability outside your machine:

ping -c 4 1.1.1.1

If the ping returns and NetworkManager reports connected, the rebuild fixed your problem. If the interface still does not appear, jump to the troubleshooting section below.

Recovery From a Live USB When Ubuntu Won’t Boot

Sometimes a kernel upgrade leaves the system completely unbootable. You get a black screen, an initramfs error, or a kernel panic. In that case you cannot run update-initramfs from the installed system. You have to chroot in from a Live USB.

Here is the recovery procedure I use in production:

1. Download an Ubuntu Live ISO matching the release on the affected machine and write it to a USB stick with balenaEtcher or dd.

2. Boot the machine from the USB and choose “Try Ubuntu” so you land at a live desktop with networking.

3. Open a terminal and identify your installed root partition. Usually it is /dev/sda2 or /dev/nvme0n1p2:

lsblk -f

4. Mount the installed root, then bind-mount the pseudo filesystems needed for chroot:

sudo mount /dev/sda2 /mnt sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys sudo mount /dev/sda1 /mnt/boot

5. Chroot into the installed system:

sudo chroot /mnt

6. From inside the chroot, rebuild the initramfs for the broken kernel:

update-initramfs -u -k all exit sudo reboot

This regenerates initramfs images for every installed kernel from outside the broken boot. After rebooting and removing the USB stick, the system should come back online.

How to Boot Into a Previous Working Kernel?

If the latest kernel broke your network but an older one still works, you can boot into the older kernel as a temporary fallback while you investigate. Hold Shift during boot on a BIOS system or Esc on a UEFI system to open GRUB.

Choose “Advanced options for Ubuntu” and pick an earlier kernel from the list. After you boot into it, run update-initramfs -u so the older kernel’s initramfs is current, and either keep it as your default or fix the broken kernel.

To make an older kernel the default, edit /etc/default/grub and update GRUB_DEFAULT to point to its menu entry, then run sudo update-grub.

Preventing Network Loss After Future Kernel Upgrades

Once your network is back, lock the configuration in place so this does not bite you again. I apply four habits on every Ubuntu box I manage.

First, keep linux-modules-extra installed for every kernel. Add it as a safety net so driver modules are always available.

Second, never uninstall a working kernel until you have rebooted into the new one at least once and confirmed network, display, and sleep all work. The dpkg –list | grep linux-image command shows what is available.

Third, on critical production machines, hold back a known-good kernel with apt-mark hold so automatic unattended upgrades do not push you onto a broken version before you can test it.

Fourth, always run sudo update-initramfs -u after manually dropping a kernel image into /boot or after installing a DKMS module. Skipping that step is the single most common reason the initramfs goes stale.

Frequently Asked Questions

How to regenerate initramfs in Ubuntu?

Run sudo update-initramfs -u to refresh the initramfs for your running kernel, then reboot. For a brand new image from scratch, use sudo update-initramfs -c -k $(uname -r) instead.

What can you do if a Linux system fails to boot after a kernel update?

Boot from an Ubuntu Live USB, mount your installed root partition, bind-mount /dev, /proc, and /sys, chroot into the installed system, then run update-initramfs -u -k all and reboot. If you still have an older working kernel installed, hold Shift at boot and select it from the GRUB Advanced menu.

How to fix initramfs error in Ubuntu?

Identify which kernel triggered the error from the boot message, then either regenerate its initramfs with sudo update-initramfs -u -k VERSION-generic or rebuild from a Live USB chroot. Also reinstall linux-modules-extra for that kernel to ensure network and filesystem modules are present.

Should I rebuild the initramfs after a kernel upgrade?

Yes. Ubuntu’s package manager usually does this automatically, but if you installed a kernel manually, added a DKMS module, or the upgrade was interrupted, you should run sudo update-initramfs -u to ensure the image matches the new kernel state.

Conclusion

Ubuntu losing network connectivity after a kernel upgrade is one of the most common headaches Linux admins run into, and it is almost always caused by a stale initramfs that no longer matches the new kernel. The fix is fast and reliable.

Start with the three-command quick fix: reinstall linux-modules-extra for your running kernel, run sudo update-initramfs -u, and reboot. Verify the interface with ip a and ping. If the system refuses to boot at all, drop into a Live USB, chroot into your installed root, and rebuild the initramfs from there.

Going forward, keep linux-modules-extra installed for every kernel, hold back known-good kernels on production hardware, and always run update-initramfs after manual kernel changes. These three habits have kept our team’s Ubuntu fleet online through every kernel regression in 2026.

Leave a Comment