How to reinstall missing kernel modules after deletion?cannot upgrade kernel and mysql-server after dist upgradeLinux Headers not upgrading. It says “no space” when I have lotsUbuntu Server installation fails on Thinkpad 400 laptopBoot partition is 100% full. Cant remove old packages to make spaceUnable to update kernel (or anything), dpkg returns error 1Missing wifi when updating base kernel Ubuntu 16.04Ubuntu 18.04 upgrade error on dual boot with Manjaro18.04 dpkg error during install of 4.15.0-38.41_amd64.debHow to replace or remove kernel with signed kernelsnvidia modules are missing after each kernel upgrade in 18.04

Why would one plane in this picture not have gear down yet?

Accountant/ lawyer will not return my call

How to draw cubes in a 3 dimensional plane

Why does Captain Marvel assume the people on this planet know this?

Does this video of collapsing warehouse shelves show a real incident?

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

Why does liquid water form when we exhale on a mirror?

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

What was the Kree's motivation in Captain Marvel?

Are babies of evil humanoid species inherently evil?

Reversed Sudoku

Counting all the hearts

Reverse string, can I make it faster?

How strictly should I take "Candidates must be local"?

Do I really need to have a scientific explanation for my premise?

weren't playing vs didn't play

Find longest word in a string: are any of these algorithms good?

PTIJ: Should I kill my computer after installing software?

Is it necessary to separate DC power cables and data cables?

Was Luke Skywalker the leader of the Rebel forces on Hoth?

PTIJ: wiping amalek’s memory?

An alternative proof of an application of Hahn-Banach

How to write ı (i without dot) character in pgf-pie

In the quantum hamiltonian, why does kinetic energy turn into an operator while potential doesn't?



How to reinstall missing kernel modules after deletion?


cannot upgrade kernel and mysql-server after dist upgradeLinux Headers not upgrading. It says “no space” when I have lotsUbuntu Server installation fails on Thinkpad 400 laptopBoot partition is 100% full. Cant remove old packages to make spaceUnable to update kernel (or anything), dpkg returns error 1Missing wifi when updating base kernel Ubuntu 16.04Ubuntu 18.04 upgrade error on dual boot with Manjaro18.04 dpkg error during install of 4.15.0-38.41_amd64.debHow to replace or remove kernel with signed kernelsnvidia modules are missing after each kernel upgrade in 18.04













1















The other day I was cleaning some disk space. I deleted some directories with the Linux Kernel headers. Now I see a lot of errors complaining about missing Linux headers. I tried to reinstall them but, can't find them.



I've already researched many commands but, none of them work. This is what I have tried so far:



linux@linux:~$ sudo apt-get install uswsusp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libx86-1
The following NEW packages will be installed:
libx86-1 uswsusp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 220 kB of archives.
After this operation, 977 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ufscar.br/ubuntu bionic/universe amd64 libx86-1 amd64 1.1+ds1-10.2 [75,2 kB]
Get:2 http://mirror.ufscar.br/ubuntu bionic/universe amd64 uswsusp amd64 1.0+20120915-6.1build1 [145 kB]
Fetched 220 kB in 1s (297 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libx86-1:amd64.
(Reading database ... 385946 files and directories currently installed.)
Preparing to unpack .../libx86-1_1.1+ds1-10.2_amd64.deb ...
Unpacking libx86-1:amd64 (1.1+ds1-10.2) ...
Selecting previously unselected package uswsusp.
Preparing to unpack .../uswsusp_1.0+20120915-6.1build1_amd64.deb ...
Unpacking uswsusp (1.0+20120915-6.1build1) ...
Setting up libx86-1:amd64 (1.1+ds1-10.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up uswsusp (1.0+20120915-6.1build1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
0depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo dpkg-reconfigure uswsusp
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-headers-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

linux@linux:~$ sudo apt-get update && sudo apt-get upgrade
Ign:1 http://mirror.ufscar.br/mint-archive tessa InRelease
Hit:2 http://mirror.ufscar.br/ubuntu bionic InRelease
Hit:3 http://mirror.ufscar.br/ubuntu bionic-updates InRelease
Hit:4 http://mirror.ufscar.br/ubuntu bionic-backports InRelease
Hit:5 http://mirror.ufscar.br/mint-archive tessa Release
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://archive.canonical.com/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/hluk/copyq/ubuntu bionic InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:11 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu bionic InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libnss-myhostname libnss-systemd libpam-systemd libpoppler-glib8 libpoppler-qt5-1 libpoppler73 libseccomp2 libsystemd0 libudev1 libxcb-composite0 libxcb-damage0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0
libxcb-record0 libxcb-render0 libxcb-res0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-xv0 libxcb1 libxcb1-dev poppler-utils systemd systemd-sysv udev
32 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6.053 kB of archives.
After this operation, 16,4 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.15 [105 kB]
0% [1 libnss-systemd 13,9 kB/105 kB 13%]
Get:2 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.15 [205 kB]
Get:3 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.15 [2.899 kB]
Get:4 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.15 [108 kB]
Get:5 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-myhostname amd64 237-3ubuntu10.15 [34,4 kB]
Get:6 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.15 [1.100 kB]
Get:7 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.15 [54,2 kB]
Get:8 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.15 [12,0 kB]
Get:9 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libseccomp2 amd64 2.3.1-2.1ubuntu4.1 [39,1 kB]
Get:10 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1-dev amd64 1.13-2~ubuntu18.04 [80,0 kB]
Get:11 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1 amd64 1.13-2~ubuntu18.04 [45,5 kB]
Get:12 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-render0 amd64 1.13-2~ubuntu18.04 [14,7 kB]
Get:13 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shm0 amd64 1.13-2~ubuntu18.04 [5.600 B]
Get:14 http://mirror.ufscar.br/ubuntu bionic-updates/universe amd64 libpoppler-qt5-1 amd64 0.62.0-2ubuntu2.8 [140 kB]
Get:15 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 poppler-utils amd64 0.62.0-2ubuntu2.8 [154 kB]
Get:16 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler-glib8 amd64 0.62.0-2ubuntu2.8 [108 kB]
Get:17 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler73 amd64 0.62.0-2ubuntu2.8 [799 kB]
Get:18 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-composite0 amd64 1.13-2~ubuntu18.04 [5.184 B]
Get:19 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-damage0 amd64 1.13-2~ubuntu18.04 [4.872 B]
Get:20 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri2-0 amd64 1.13-2~ubuntu18.04 [6.920 B]
Get:21 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri3-0 amd64 1.13-2~ubuntu18.04 [6.568 B]
Get:22 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-glx0 amd64 1.13-2~ubuntu18.04 [22,1 kB]
Get:23 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-present0 amd64 1.13-2~ubuntu18.04 [5.552 B]
Get:24 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-randr0 amd64 1.13-2~ubuntu18.04 [16,4 kB]
Get:25 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-record0 amd64 1.13-2~ubuntu18.04 [7.064 B]
Get:26 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-res0 amd64 1.13-2~ubuntu18.04 [6.392 B]
Get:27 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shape0 amd64 1.13-2~ubuntu18.04 [5.972 B]
Get:28 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-sync1 amd64 1.13-2~ubuntu18.04 [8.808 B]
Get:29 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xfixes0 amd64 1.13-2~ubuntu18.04 [9.352 B]
Get:30 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xinerama0 amd64 1.13-2~ubuntu18.04 [5.264 B]
Get:31 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xkb1 amd64 1.13-2~ubuntu18.04 [30,1 kB]
Get:32 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xv0 amd64 1.13-2~ubuntu18.04 [9.168 B]
Fetched 6.053 kB in 3s (2.331 kB/s)
Extracting templates from packages: 100%
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.15_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libpam-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libpam-systemd:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-myhostname_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-myhostname:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../udev_237-3ubuntu10.15_amd64.deb ...
Unpacking udev (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libudev1_237-3ubuntu10.15_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libudev1:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd-sysv (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd-sysv (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libseccomp2_2.3.1-2.1ubuntu4.1_amd64.deb ...
Unpacking libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) over (2.3.1-2.1ubuntu4) ...
Setting up libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb1-dev_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../libxcb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb1:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-render0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-render0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-shm0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-shm0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../00-libpoppler-qt5-1_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../01-poppler-utils_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking poppler-utils (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../02-libpoppler-glib8_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../03-libpoppler73_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler73:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../04-libxcb-composite0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-composite0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../05-libxcb-damage0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-damage0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../06-libxcb-dri2-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../07-libxcb-dri3-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../08-libxcb-glx0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-glx0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../09-libxcb-present0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-present0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../10-libxcb-randr0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-randr0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../11-libxcb-record0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-record0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../12-libxcb-res0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-res0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../13-libxcb-shape0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shape0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../14-libxcb-sync1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-sync1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../15-libxcb-xfixes0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../16-libxcb-xinerama0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../17-libxcb-xkb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../18-libxcb-xv0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xv0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-present0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-composite0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-glx0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-randr0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libnss-myhostname:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-res0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-record0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-damage0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler73:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up udev (237-3ubuntu10.15) ...
update-initramfs: deferring update (trigger activated)
Setting up libxcb-xv0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for systemd (237-3ubuntu10.15) ...
Setting up libxcb-shape0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) ...
Setting up poppler-utils (0.62.0-2ubuntu2.8) ...
Setting up libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory
Processing triggers for libc-bin (2.27-3ubuntu1) ...

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-image-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 7.904 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-image-4.15.0-46-generic amd64 4.15.0-46.49 [7.904 kB]
Fetched 7.904 kB in 3s (3.111 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-image-4.15.0-46-generic_4.15.0-46.49_amd64.deb ...
Unpacking linux-image-4.15.0-46-generic (4.15.0-46.49) over (4.15.0-46.49) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo dpkg --purge linux-image-4.15.0-46-generic
dpkg: dependency problems prevent removal of linux-image-4.15.0-46-generic:
linux-image-generic depends on linux-image-4.15.0-46-generic.
linux-modules-extra-4.15.0-46-generic depends on linux-image-4.15.0-46-generic | linux-image-unsigned-4.15.0-46-generic; however:
Package linux-image-4.15.0-46-generic is to be removed.
Package linux-image-unsigned-4.15.0-46-generic is not installed.

dpkg: error processing package linux-image-4.15.0-46-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-image-4.15.0-46-generic

linux@linux:~$ sudo apt-get install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt upgrade --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt install --reinstall linux-headers-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.376 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-headers-generic amd64 4.15.0.46.48 [2.376 B]
Fetched 2.376 B in 0s (10,5 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-headers-generic_4.15.0.46.48_amd64.deb ...
Unpacking linux-headers-generic (4.15.0.46.48) over (4.15.0.46.48) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Setting up linux-headers-generic (4.15.0.46.48) ...
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question









New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

    – Gerowen
    12 mins ago















1















The other day I was cleaning some disk space. I deleted some directories with the Linux Kernel headers. Now I see a lot of errors complaining about missing Linux headers. I tried to reinstall them but, can't find them.



I've already researched many commands but, none of them work. This is what I have tried so far:



linux@linux:~$ sudo apt-get install uswsusp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libx86-1
The following NEW packages will be installed:
libx86-1 uswsusp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 220 kB of archives.
After this operation, 977 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ufscar.br/ubuntu bionic/universe amd64 libx86-1 amd64 1.1+ds1-10.2 [75,2 kB]
Get:2 http://mirror.ufscar.br/ubuntu bionic/universe amd64 uswsusp amd64 1.0+20120915-6.1build1 [145 kB]
Fetched 220 kB in 1s (297 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libx86-1:amd64.
(Reading database ... 385946 files and directories currently installed.)
Preparing to unpack .../libx86-1_1.1+ds1-10.2_amd64.deb ...
Unpacking libx86-1:amd64 (1.1+ds1-10.2) ...
Selecting previously unselected package uswsusp.
Preparing to unpack .../uswsusp_1.0+20120915-6.1build1_amd64.deb ...
Unpacking uswsusp (1.0+20120915-6.1build1) ...
Setting up libx86-1:amd64 (1.1+ds1-10.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up uswsusp (1.0+20120915-6.1build1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
0depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo dpkg-reconfigure uswsusp
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-headers-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

linux@linux:~$ sudo apt-get update && sudo apt-get upgrade
Ign:1 http://mirror.ufscar.br/mint-archive tessa InRelease
Hit:2 http://mirror.ufscar.br/ubuntu bionic InRelease
Hit:3 http://mirror.ufscar.br/ubuntu bionic-updates InRelease
Hit:4 http://mirror.ufscar.br/ubuntu bionic-backports InRelease
Hit:5 http://mirror.ufscar.br/mint-archive tessa Release
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://archive.canonical.com/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/hluk/copyq/ubuntu bionic InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:11 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu bionic InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libnss-myhostname libnss-systemd libpam-systemd libpoppler-glib8 libpoppler-qt5-1 libpoppler73 libseccomp2 libsystemd0 libudev1 libxcb-composite0 libxcb-damage0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0
libxcb-record0 libxcb-render0 libxcb-res0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-xv0 libxcb1 libxcb1-dev poppler-utils systemd systemd-sysv udev
32 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6.053 kB of archives.
After this operation, 16,4 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.15 [105 kB]
0% [1 libnss-systemd 13,9 kB/105 kB 13%]
Get:2 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.15 [205 kB]
Get:3 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.15 [2.899 kB]
Get:4 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.15 [108 kB]
Get:5 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-myhostname amd64 237-3ubuntu10.15 [34,4 kB]
Get:6 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.15 [1.100 kB]
Get:7 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.15 [54,2 kB]
Get:8 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.15 [12,0 kB]
Get:9 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libseccomp2 amd64 2.3.1-2.1ubuntu4.1 [39,1 kB]
Get:10 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1-dev amd64 1.13-2~ubuntu18.04 [80,0 kB]
Get:11 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1 amd64 1.13-2~ubuntu18.04 [45,5 kB]
Get:12 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-render0 amd64 1.13-2~ubuntu18.04 [14,7 kB]
Get:13 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shm0 amd64 1.13-2~ubuntu18.04 [5.600 B]
Get:14 http://mirror.ufscar.br/ubuntu bionic-updates/universe amd64 libpoppler-qt5-1 amd64 0.62.0-2ubuntu2.8 [140 kB]
Get:15 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 poppler-utils amd64 0.62.0-2ubuntu2.8 [154 kB]
Get:16 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler-glib8 amd64 0.62.0-2ubuntu2.8 [108 kB]
Get:17 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler73 amd64 0.62.0-2ubuntu2.8 [799 kB]
Get:18 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-composite0 amd64 1.13-2~ubuntu18.04 [5.184 B]
Get:19 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-damage0 amd64 1.13-2~ubuntu18.04 [4.872 B]
Get:20 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri2-0 amd64 1.13-2~ubuntu18.04 [6.920 B]
Get:21 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri3-0 amd64 1.13-2~ubuntu18.04 [6.568 B]
Get:22 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-glx0 amd64 1.13-2~ubuntu18.04 [22,1 kB]
Get:23 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-present0 amd64 1.13-2~ubuntu18.04 [5.552 B]
Get:24 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-randr0 amd64 1.13-2~ubuntu18.04 [16,4 kB]
Get:25 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-record0 amd64 1.13-2~ubuntu18.04 [7.064 B]
Get:26 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-res0 amd64 1.13-2~ubuntu18.04 [6.392 B]
Get:27 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shape0 amd64 1.13-2~ubuntu18.04 [5.972 B]
Get:28 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-sync1 amd64 1.13-2~ubuntu18.04 [8.808 B]
Get:29 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xfixes0 amd64 1.13-2~ubuntu18.04 [9.352 B]
Get:30 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xinerama0 amd64 1.13-2~ubuntu18.04 [5.264 B]
Get:31 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xkb1 amd64 1.13-2~ubuntu18.04 [30,1 kB]
Get:32 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xv0 amd64 1.13-2~ubuntu18.04 [9.168 B]
Fetched 6.053 kB in 3s (2.331 kB/s)
Extracting templates from packages: 100%
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.15_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libpam-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libpam-systemd:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-myhostname_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-myhostname:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../udev_237-3ubuntu10.15_amd64.deb ...
Unpacking udev (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libudev1_237-3ubuntu10.15_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libudev1:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd-sysv (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd-sysv (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libseccomp2_2.3.1-2.1ubuntu4.1_amd64.deb ...
Unpacking libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) over (2.3.1-2.1ubuntu4) ...
Setting up libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb1-dev_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../libxcb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb1:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-render0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-render0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-shm0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-shm0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../00-libpoppler-qt5-1_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../01-poppler-utils_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking poppler-utils (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../02-libpoppler-glib8_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../03-libpoppler73_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler73:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../04-libxcb-composite0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-composite0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../05-libxcb-damage0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-damage0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../06-libxcb-dri2-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../07-libxcb-dri3-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../08-libxcb-glx0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-glx0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../09-libxcb-present0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-present0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../10-libxcb-randr0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-randr0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../11-libxcb-record0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-record0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../12-libxcb-res0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-res0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../13-libxcb-shape0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shape0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../14-libxcb-sync1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-sync1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../15-libxcb-xfixes0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../16-libxcb-xinerama0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../17-libxcb-xkb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../18-libxcb-xv0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xv0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-present0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-composite0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-glx0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-randr0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libnss-myhostname:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-res0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-record0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-damage0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler73:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up udev (237-3ubuntu10.15) ...
update-initramfs: deferring update (trigger activated)
Setting up libxcb-xv0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for systemd (237-3ubuntu10.15) ...
Setting up libxcb-shape0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) ...
Setting up poppler-utils (0.62.0-2ubuntu2.8) ...
Setting up libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory
Processing triggers for libc-bin (2.27-3ubuntu1) ...

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-image-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 7.904 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-image-4.15.0-46-generic amd64 4.15.0-46.49 [7.904 kB]
Fetched 7.904 kB in 3s (3.111 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-image-4.15.0-46-generic_4.15.0-46.49_amd64.deb ...
Unpacking linux-image-4.15.0-46-generic (4.15.0-46.49) over (4.15.0-46.49) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo dpkg --purge linux-image-4.15.0-46-generic
dpkg: dependency problems prevent removal of linux-image-4.15.0-46-generic:
linux-image-generic depends on linux-image-4.15.0-46-generic.
linux-modules-extra-4.15.0-46-generic depends on linux-image-4.15.0-46-generic | linux-image-unsigned-4.15.0-46-generic; however:
Package linux-image-4.15.0-46-generic is to be removed.
Package linux-image-unsigned-4.15.0-46-generic is not installed.

dpkg: error processing package linux-image-4.15.0-46-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-image-4.15.0-46-generic

linux@linux:~$ sudo apt-get install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt upgrade --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt install --reinstall linux-headers-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.376 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-headers-generic amd64 4.15.0.46.48 [2.376 B]
Fetched 2.376 B in 0s (10,5 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-headers-generic_4.15.0.46.48_amd64.deb ...
Unpacking linux-headers-generic (4.15.0.46.48) over (4.15.0.46.48) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Setting up linux-headers-generic (4.15.0.46.48) ...
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question









New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

    – Gerowen
    12 mins ago













1












1








1








The other day I was cleaning some disk space. I deleted some directories with the Linux Kernel headers. Now I see a lot of errors complaining about missing Linux headers. I tried to reinstall them but, can't find them.



I've already researched many commands but, none of them work. This is what I have tried so far:



linux@linux:~$ sudo apt-get install uswsusp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libx86-1
The following NEW packages will be installed:
libx86-1 uswsusp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 220 kB of archives.
After this operation, 977 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ufscar.br/ubuntu bionic/universe amd64 libx86-1 amd64 1.1+ds1-10.2 [75,2 kB]
Get:2 http://mirror.ufscar.br/ubuntu bionic/universe amd64 uswsusp amd64 1.0+20120915-6.1build1 [145 kB]
Fetched 220 kB in 1s (297 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libx86-1:amd64.
(Reading database ... 385946 files and directories currently installed.)
Preparing to unpack .../libx86-1_1.1+ds1-10.2_amd64.deb ...
Unpacking libx86-1:amd64 (1.1+ds1-10.2) ...
Selecting previously unselected package uswsusp.
Preparing to unpack .../uswsusp_1.0+20120915-6.1build1_amd64.deb ...
Unpacking uswsusp (1.0+20120915-6.1build1) ...
Setting up libx86-1:amd64 (1.1+ds1-10.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up uswsusp (1.0+20120915-6.1build1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
0depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo dpkg-reconfigure uswsusp
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-headers-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

linux@linux:~$ sudo apt-get update && sudo apt-get upgrade
Ign:1 http://mirror.ufscar.br/mint-archive tessa InRelease
Hit:2 http://mirror.ufscar.br/ubuntu bionic InRelease
Hit:3 http://mirror.ufscar.br/ubuntu bionic-updates InRelease
Hit:4 http://mirror.ufscar.br/ubuntu bionic-backports InRelease
Hit:5 http://mirror.ufscar.br/mint-archive tessa Release
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://archive.canonical.com/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/hluk/copyq/ubuntu bionic InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:11 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu bionic InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libnss-myhostname libnss-systemd libpam-systemd libpoppler-glib8 libpoppler-qt5-1 libpoppler73 libseccomp2 libsystemd0 libudev1 libxcb-composite0 libxcb-damage0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0
libxcb-record0 libxcb-render0 libxcb-res0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-xv0 libxcb1 libxcb1-dev poppler-utils systemd systemd-sysv udev
32 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6.053 kB of archives.
After this operation, 16,4 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.15 [105 kB]
0% [1 libnss-systemd 13,9 kB/105 kB 13%]
Get:2 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.15 [205 kB]
Get:3 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.15 [2.899 kB]
Get:4 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.15 [108 kB]
Get:5 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-myhostname amd64 237-3ubuntu10.15 [34,4 kB]
Get:6 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.15 [1.100 kB]
Get:7 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.15 [54,2 kB]
Get:8 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.15 [12,0 kB]
Get:9 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libseccomp2 amd64 2.3.1-2.1ubuntu4.1 [39,1 kB]
Get:10 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1-dev amd64 1.13-2~ubuntu18.04 [80,0 kB]
Get:11 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1 amd64 1.13-2~ubuntu18.04 [45,5 kB]
Get:12 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-render0 amd64 1.13-2~ubuntu18.04 [14,7 kB]
Get:13 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shm0 amd64 1.13-2~ubuntu18.04 [5.600 B]
Get:14 http://mirror.ufscar.br/ubuntu bionic-updates/universe amd64 libpoppler-qt5-1 amd64 0.62.0-2ubuntu2.8 [140 kB]
Get:15 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 poppler-utils amd64 0.62.0-2ubuntu2.8 [154 kB]
Get:16 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler-glib8 amd64 0.62.0-2ubuntu2.8 [108 kB]
Get:17 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler73 amd64 0.62.0-2ubuntu2.8 [799 kB]
Get:18 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-composite0 amd64 1.13-2~ubuntu18.04 [5.184 B]
Get:19 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-damage0 amd64 1.13-2~ubuntu18.04 [4.872 B]
Get:20 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri2-0 amd64 1.13-2~ubuntu18.04 [6.920 B]
Get:21 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri3-0 amd64 1.13-2~ubuntu18.04 [6.568 B]
Get:22 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-glx0 amd64 1.13-2~ubuntu18.04 [22,1 kB]
Get:23 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-present0 amd64 1.13-2~ubuntu18.04 [5.552 B]
Get:24 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-randr0 amd64 1.13-2~ubuntu18.04 [16,4 kB]
Get:25 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-record0 amd64 1.13-2~ubuntu18.04 [7.064 B]
Get:26 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-res0 amd64 1.13-2~ubuntu18.04 [6.392 B]
Get:27 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shape0 amd64 1.13-2~ubuntu18.04 [5.972 B]
Get:28 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-sync1 amd64 1.13-2~ubuntu18.04 [8.808 B]
Get:29 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xfixes0 amd64 1.13-2~ubuntu18.04 [9.352 B]
Get:30 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xinerama0 amd64 1.13-2~ubuntu18.04 [5.264 B]
Get:31 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xkb1 amd64 1.13-2~ubuntu18.04 [30,1 kB]
Get:32 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xv0 amd64 1.13-2~ubuntu18.04 [9.168 B]
Fetched 6.053 kB in 3s (2.331 kB/s)
Extracting templates from packages: 100%
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.15_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libpam-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libpam-systemd:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-myhostname_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-myhostname:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../udev_237-3ubuntu10.15_amd64.deb ...
Unpacking udev (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libudev1_237-3ubuntu10.15_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libudev1:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd-sysv (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd-sysv (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libseccomp2_2.3.1-2.1ubuntu4.1_amd64.deb ...
Unpacking libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) over (2.3.1-2.1ubuntu4) ...
Setting up libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb1-dev_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../libxcb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb1:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-render0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-render0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-shm0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-shm0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../00-libpoppler-qt5-1_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../01-poppler-utils_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking poppler-utils (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../02-libpoppler-glib8_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../03-libpoppler73_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler73:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../04-libxcb-composite0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-composite0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../05-libxcb-damage0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-damage0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../06-libxcb-dri2-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../07-libxcb-dri3-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../08-libxcb-glx0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-glx0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../09-libxcb-present0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-present0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../10-libxcb-randr0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-randr0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../11-libxcb-record0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-record0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../12-libxcb-res0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-res0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../13-libxcb-shape0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shape0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../14-libxcb-sync1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-sync1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../15-libxcb-xfixes0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../16-libxcb-xinerama0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../17-libxcb-xkb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../18-libxcb-xv0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xv0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-present0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-composite0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-glx0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-randr0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libnss-myhostname:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-res0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-record0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-damage0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler73:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up udev (237-3ubuntu10.15) ...
update-initramfs: deferring update (trigger activated)
Setting up libxcb-xv0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for systemd (237-3ubuntu10.15) ...
Setting up libxcb-shape0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) ...
Setting up poppler-utils (0.62.0-2ubuntu2.8) ...
Setting up libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory
Processing triggers for libc-bin (2.27-3ubuntu1) ...

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-image-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 7.904 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-image-4.15.0-46-generic amd64 4.15.0-46.49 [7.904 kB]
Fetched 7.904 kB in 3s (3.111 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-image-4.15.0-46-generic_4.15.0-46.49_amd64.deb ...
Unpacking linux-image-4.15.0-46-generic (4.15.0-46.49) over (4.15.0-46.49) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo dpkg --purge linux-image-4.15.0-46-generic
dpkg: dependency problems prevent removal of linux-image-4.15.0-46-generic:
linux-image-generic depends on linux-image-4.15.0-46-generic.
linux-modules-extra-4.15.0-46-generic depends on linux-image-4.15.0-46-generic | linux-image-unsigned-4.15.0-46-generic; however:
Package linux-image-4.15.0-46-generic is to be removed.
Package linux-image-unsigned-4.15.0-46-generic is not installed.

dpkg: error processing package linux-image-4.15.0-46-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-image-4.15.0-46-generic

linux@linux:~$ sudo apt-get install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt upgrade --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt install --reinstall linux-headers-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.376 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-headers-generic amd64 4.15.0.46.48 [2.376 B]
Fetched 2.376 B in 0s (10,5 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-headers-generic_4.15.0.46.48_amd64.deb ...
Unpacking linux-headers-generic (4.15.0.46.48) over (4.15.0.46.48) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Setting up linux-headers-generic (4.15.0.46.48) ...
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question









New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












The other day I was cleaning some disk space. I deleted some directories with the Linux Kernel headers. Now I see a lot of errors complaining about missing Linux headers. I tried to reinstall them but, can't find them.



I've already researched many commands but, none of them work. This is what I have tried so far:



linux@linux:~$ sudo apt-get install uswsusp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libx86-1
The following NEW packages will be installed:
libx86-1 uswsusp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 220 kB of archives.
After this operation, 977 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ufscar.br/ubuntu bionic/universe amd64 libx86-1 amd64 1.1+ds1-10.2 [75,2 kB]
Get:2 http://mirror.ufscar.br/ubuntu bionic/universe amd64 uswsusp amd64 1.0+20120915-6.1build1 [145 kB]
Fetched 220 kB in 1s (297 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libx86-1:amd64.
(Reading database ... 385946 files and directories currently installed.)
Preparing to unpack .../libx86-1_1.1+ds1-10.2_amd64.deb ...
Unpacking libx86-1:amd64 (1.1+ds1-10.2) ...
Selecting previously unselected package uswsusp.
Preparing to unpack .../uswsusp_1.0+20120915-6.1build1_amd64.deb ...
Unpacking uswsusp (1.0+20120915-6.1build1) ...
Setting up libx86-1:amd64 (1.1+ds1-10.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up uswsusp (1.0+20120915-6.1build1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
0depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_x156QB/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo dpkg-reconfigure uswsusp
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PgcUvV/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory

linux@linux:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-headers-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

linux@linux:~$ sudo apt-get update && sudo apt-get upgrade
Ign:1 http://mirror.ufscar.br/mint-archive tessa InRelease
Hit:2 http://mirror.ufscar.br/ubuntu bionic InRelease
Hit:3 http://mirror.ufscar.br/ubuntu bionic-updates InRelease
Hit:4 http://mirror.ufscar.br/ubuntu bionic-backports InRelease
Hit:5 http://mirror.ufscar.br/mint-archive tessa Release
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://archive.canonical.com/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/hluk/copyq/ubuntu bionic InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:11 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu bionic InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libnss-myhostname libnss-systemd libpam-systemd libpoppler-glib8 libpoppler-qt5-1 libpoppler73 libseccomp2 libsystemd0 libudev1 libxcb-composite0 libxcb-damage0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0
libxcb-record0 libxcb-render0 libxcb-res0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-xv0 libxcb1 libxcb1-dev poppler-utils systemd systemd-sysv udev
32 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6.053 kB of archives.
After this operation, 16,4 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.15 [105 kB]
0% [1 libnss-systemd 13,9 kB/105 kB 13%]
Get:2 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.15 [205 kB]
Get:3 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.15 [2.899 kB]
Get:4 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.15 [108 kB]
Get:5 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libnss-myhostname amd64 237-3ubuntu10.15 [34,4 kB]
Get:6 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.15 [1.100 kB]
Get:7 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.15 [54,2 kB]
Get:8 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.15 [12,0 kB]
Get:9 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libseccomp2 amd64 2.3.1-2.1ubuntu4.1 [39,1 kB]
Get:10 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1-dev amd64 1.13-2~ubuntu18.04 [80,0 kB]
Get:11 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb1 amd64 1.13-2~ubuntu18.04 [45,5 kB]
Get:12 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-render0 amd64 1.13-2~ubuntu18.04 [14,7 kB]
Get:13 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shm0 amd64 1.13-2~ubuntu18.04 [5.600 B]
Get:14 http://mirror.ufscar.br/ubuntu bionic-updates/universe amd64 libpoppler-qt5-1 amd64 0.62.0-2ubuntu2.8 [140 kB]
Get:15 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 poppler-utils amd64 0.62.0-2ubuntu2.8 [154 kB]
Get:16 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler-glib8 amd64 0.62.0-2ubuntu2.8 [108 kB]
Get:17 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libpoppler73 amd64 0.62.0-2ubuntu2.8 [799 kB]
Get:18 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-composite0 amd64 1.13-2~ubuntu18.04 [5.184 B]
Get:19 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-damage0 amd64 1.13-2~ubuntu18.04 [4.872 B]
Get:20 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri2-0 amd64 1.13-2~ubuntu18.04 [6.920 B]
Get:21 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-dri3-0 amd64 1.13-2~ubuntu18.04 [6.568 B]
Get:22 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-glx0 amd64 1.13-2~ubuntu18.04 [22,1 kB]
Get:23 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-present0 amd64 1.13-2~ubuntu18.04 [5.552 B]
Get:24 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-randr0 amd64 1.13-2~ubuntu18.04 [16,4 kB]
Get:25 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-record0 amd64 1.13-2~ubuntu18.04 [7.064 B]
Get:26 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-res0 amd64 1.13-2~ubuntu18.04 [6.392 B]
Get:27 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-shape0 amd64 1.13-2~ubuntu18.04 [5.972 B]
Get:28 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-sync1 amd64 1.13-2~ubuntu18.04 [8.808 B]
Get:29 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xfixes0 amd64 1.13-2~ubuntu18.04 [9.352 B]
Get:30 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xinerama0 amd64 1.13-2~ubuntu18.04 [5.264 B]
Get:31 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xkb1 amd64 1.13-2~ubuntu18.04 [30,1 kB]
Get:32 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 libxcb-xv0 amd64 1.13-2~ubuntu18.04 [9.168 B]
Fetched 6.053 kB in 3s (2.331 kB/s)
Extracting templates from packages: 100%
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.15_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_237-3ubuntu10.15_amd64.deb ...
Unpacking libpam-systemd:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libpam-systemd:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libnss-myhostname_237-3ubuntu10.15_amd64.deb ...
Unpacking libnss-myhostname:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../udev_237-3ubuntu10.15_amd64.deb ...
Unpacking udev (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Preparing to unpack .../libudev1_237-3ubuntu10.15_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up libudev1:amd64 (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_237-3ubuntu10.15_amd64.deb ...
Unpacking systemd-sysv (237-3ubuntu10.15) over (237-3ubuntu10.13) ...
Setting up systemd-sysv (237-3ubuntu10.15) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libseccomp2_2.3.1-2.1ubuntu4.1_amd64.deb ...
Unpacking libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) over (2.3.1-2.1ubuntu4) ...
Setting up libseccomp2:amd64 (2.3.1-2.1ubuntu4.1) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb1-dev_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../libxcb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb1:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-render0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-render0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../libxcb-shm0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-shm0:amd64 (1.13-2~ubuntu18.04) ...
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../00-libpoppler-qt5-1_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../01-poppler-utils_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking poppler-utils (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../02-libpoppler-glib8_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../03-libpoppler73_0.62.0-2ubuntu2.8_amd64.deb ...
Unpacking libpoppler73:amd64 (0.62.0-2ubuntu2.8) over (0.62.0-2ubuntu2.7) ...
Preparing to unpack .../04-libxcb-composite0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-composite0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../05-libxcb-damage0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-damage0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../06-libxcb-dri2-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../07-libxcb-dri3-0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../08-libxcb-glx0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-glx0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../09-libxcb-present0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-present0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../10-libxcb-randr0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-randr0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../11-libxcb-record0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-record0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../12-libxcb-res0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-res0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../13-libxcb-shape0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shape0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../14-libxcb-sync1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-sync1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../15-libxcb-xfixes0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../16-libxcb-xinerama0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../17-libxcb-xkb1_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Preparing to unpack .../18-libxcb-xv0_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-xv0:amd64 (1.13-2~ubuntu18.04) over (1.13-1) ...
Setting up libxcb-xinerama0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-present0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-composite0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-glx0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-randr0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libnss-myhostname:amd64 (237-3ubuntu10.15) ...
Setting up libxcb-res0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-record0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-damage0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler73:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up udev (237-3ubuntu10.15) ...
update-initramfs: deferring update (trigger activated)
Setting up libxcb-xv0:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for systemd (237-3ubuntu10.15) ...
Setting up libxcb-shape0:amd64 (1.13-2~ubuntu18.04) ...
Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpoppler-glib8:amd64 (0.62.0-2ubuntu2.8) ...
Setting up poppler-utils (0.62.0-2ubuntu2.8) ...
Setting up libpoppler-qt5-1:amd64 (0.62.0-2ubuntu2.8) ...
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
WARNING: missing /lib/modules/4.15.0-46-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_TKdkq1/lib/modules/4.15.0-46-generic/modules.builtin: No such file or directory
Processing triggers for libc-bin (2.27-3ubuntu1) ...

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
linux-image-4.15.0-46-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

linux@linux:~$ sudo apt install linux-image-4.15.0-46-generic --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 7.904 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-image-4.15.0-46-generic amd64 4.15.0-46.49 [7.904 kB]
Fetched 7.904 kB in 3s (3.111 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-image-4.15.0-46-generic_4.15.0-46.49_amd64.deb ...
Unpacking linux-image-4.15.0-46-generic (4.15.0-46.49) over (4.15.0-46.49) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo dpkg --purge linux-image-4.15.0-46-generic
dpkg: dependency problems prevent removal of linux-image-4.15.0-46-generic:
linux-image-generic depends on linux-image-4.15.0-46-generic.
linux-modules-extra-4.15.0-46-generic depends on linux-image-4.15.0-46-generic | linux-image-unsigned-4.15.0-46-generic; however:
Package linux-image-4.15.0-46-generic is to be removed.
Package linux-image-unsigned-4.15.0-46-generic is not installed.

dpkg: error processing package linux-image-4.15.0-46-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-image-4.15.0-46-generic

linux@linux:~$ sudo apt-get install linux-image-4.15.0-46-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-4.15.0-46-generic is already the newest version (4.15.0-46.49).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt upgrade --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux@linux:~$ sudo apt install --reinstall linux-headers-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.376 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.ufscar.br/ubuntu bionic-updates/main amd64 linux-headers-generic amd64 4.15.0.46.48 [2.376 B]
Fetched 2.376 B in 0s (10,5 kB/s)
(Reading database ... 385977 files and directories currently installed.)
Preparing to unpack .../linux-headers-generic_4.15.0.46.48_amd64.deb ...
Unpacking linux-headers-generic (4.15.0.46.48) over (4.15.0.46.48) ...
Setting up linux-image-4.15.0-46-generic (4.15.0-46.49) ...
depmod: ERROR: could not open directory /lib/modules/4.15.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.15.0-46-generic (--configure):
installed linux-image-4.15.0-46-generic package post-installation script subprocess returned error exit status 1
Setting up linux-headers-generic (4.15.0.46.48) ...
Errors were encountered while processing:
linux-image-4.15.0-46-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)






kernel linux-headers






share|improve this question









New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 19 mins ago









WinEunuuchs2Unix

46.5k1190180




46.5k1190180






New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









useruser

10817




10817




New contributor




user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

    – Gerowen
    12 mins ago

















  • If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

    – Gerowen
    12 mins ago
















If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

– Gerowen
12 mins ago





If the header packages are still marked as installed in apt, you might have to "uninstall" them with and then install them again.

– Gerowen
12 mins ago










1 Answer
1






active

oldest

votes


















1














From: How to install Linux Kernel headers on Debian or Ubuntu



sudo apt-get install --reinstall linux-headers-$(uname -r)


Then:



sudo apt-get update && sudo apt-get upgrade





share|improve this answer

























  • I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

    – user
    17 mins ago











  • @user I added --reinstall option to force complete installation.

    – WinEunuuchs2Unix
    6 mins ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






user is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1124895%2fhow-to-reinstall-missing-kernel-modules-after-deletion%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














From: How to install Linux Kernel headers on Debian or Ubuntu



sudo apt-get install --reinstall linux-headers-$(uname -r)


Then:



sudo apt-get update && sudo apt-get upgrade





share|improve this answer

























  • I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

    – user
    17 mins ago











  • @user I added --reinstall option to force complete installation.

    – WinEunuuchs2Unix
    6 mins ago
















1














From: How to install Linux Kernel headers on Debian or Ubuntu



sudo apt-get install --reinstall linux-headers-$(uname -r)


Then:



sudo apt-get update && sudo apt-get upgrade





share|improve this answer

























  • I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

    – user
    17 mins ago











  • @user I added --reinstall option to force complete installation.

    – WinEunuuchs2Unix
    6 mins ago














1












1








1







From: How to install Linux Kernel headers on Debian or Ubuntu



sudo apt-get install --reinstall linux-headers-$(uname -r)


Then:



sudo apt-get update && sudo apt-get upgrade





share|improve this answer















From: How to install Linux Kernel headers on Debian or Ubuntu



sudo apt-get install --reinstall linux-headers-$(uname -r)


Then:



sudo apt-get update && sudo apt-get upgrade






share|improve this answer














share|improve this answer



share|improve this answer








edited 6 mins ago

























answered 23 mins ago









WinEunuuchs2UnixWinEunuuchs2Unix

46.5k1190180




46.5k1190180












  • I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

    – user
    17 mins ago











  • @user I added --reinstall option to force complete installation.

    – WinEunuuchs2Unix
    6 mins ago


















  • I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

    – user
    17 mins ago











  • @user I added --reinstall option to force complete installation.

    – WinEunuuchs2Unix
    6 mins ago

















I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

– user
17 mins ago





I already ran this command, if you look into the log output I presented, and you will notice the problem persists on the next commands which come after.

– user
17 mins ago













@user I added --reinstall option to force complete installation.

– WinEunuuchs2Unix
6 mins ago






@user I added --reinstall option to force complete installation.

– WinEunuuchs2Unix
6 mins ago











user is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















user is a new contributor. Be nice, and check out our Code of Conduct.












user is a new contributor. Be nice, and check out our Code of Conduct.











user is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1124895%2fhow-to-reinstall-missing-kernel-modules-after-deletion%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»