7

I'm trying upgrade firefox but says that i need to reinstall linux-headers 4.4.0-98.I tried to install but that's it's what happens 'the package linux-headers needs to be reinstalled, but i can't find an archive for it'.

  • 1
    Does sudo apt-get install --reinstall linux-headers 4.4.0-98 work? Or what does it complain? – jarno Aug 12 '18 at 21:14
  • can you paste the output of sudo apt-get install --reinstall linux-headers 4.4.0-98 to your question? – Joshua Besneatte Aug 12 '18 at 21:50
  • Reading package lists... Done – lippman27 Aug 12 '18 at 22:06
  • Building dependency tree Reading state information... Done E: the package linux-headers 4.4.0-98 needs to be reinstaled, but i can't find an archive for it. – lippman27 Aug 12 '18 at 22:08
  • Can you paste the output of apt-cache policy linux-headers-4.4.0-98? – jarno Aug 13 '18 at 00:07
  • In the first command the package should be "linux-headers-4.4.0-98" so please include the minus character. – jarno Aug 13 '18 at 00:13
  • the output is linux-headers-4.4.0-98 Installed:4.4.0-98.121 Candidate:4.4.0-98.121 Version table: *** 4.4.0-98.121 100 100/var/lib/dpkg/status – lippman27 Aug 13 '18 at 01:15
  • It might help, if you change settings in Software Sources dialog. What does lsb_release -a tell? – jarno Aug 13 '18 at 06:14
  • No LSB modules are avaliable Distributor ID: Ubuntu Description:Ubuntu 16.04.3 LTS Release:16.04 Codename: xenial – lippman27 Aug 13 '18 at 15:44
  • What do you have in "Download from" field in Ubuntu Software tab in Software & Updates dialog? Can you upload contents of your /etc/apt/sources.list in some pastebin and link it here? – jarno Aug 13 '18 at 16:12
  • I do not know, if you have the dialog in standard Ubuntu, but in Xubuntu there is and it can be launched e.g. by Settings... button in Software Updater's dialog. – jarno Aug 13 '18 at 18:57
  • /etc/apt/sources.list return permission denied – lippman27 Aug 19 '18 at 01:11
  • What does command dpkg-query -W -f='${status}\n' linux-headers-4.4.0-98 print? BTW please include '@jarno' in your reply so that I get notification. – jarno Aug 19 '18 at 13:05
  • @jarno install reinstreq half-installed – lippman27 Aug 19 '18 at 13:44

4 Answers4

5

First try the fix-missing feature

sudo apt upgrade --fix-missing

Second, try to install headers from the command line:

Maybe you just need these specific headers (linux-headers-4.4.0-98-generic):

sudo apt install linux-headers-4.4.0-98-generic

If that doesn't work, see what kernel type you are using (generic, lowlatency, etc.):

uname -r

This will return something like "4.15.0-30-generic" or "4.15.0-30-lowlatency". Install/Reinstall the headers that correspond to your kernel type. Eg if it is the generic kernel (most likely):

sudo apt install --reinstall linux-headers-generic

This will cause the current headers for your current kernel to be automatically installed and upgraded.

If above doesn't work, try the following:

Update to latest kernel:

sudo apt update && sudo apt upgrade

Reboot to ensure you are using latest kernel.

Purge out old headers and removed unused apps/kernels:

sudo apt remove --purge linux-headers-*
sudo apt autoremove && sudo apt autoclean

Reinstall the headers:

sudo apt install linux-headers-generic
Joshua Besneatte
  • 4,773
  • 5
  • 23
  • 42
  • uname -r returned 4.4.0-98-generic but after typing the command keeps saying that needs to be reinstalled. – lippman27 Aug 12 '18 at 15:06
  • added more to answer.... let me know if that helps – Joshua Besneatte Aug 12 '18 at 15:22
  • I don't understand whats happening.Anything i try to do(install, upgrade) give me the same message, that linux-headers 4.4.0-98 needs to be reinstalled. – lippman27 Aug 12 '18 at 15:57
  • try sudo apt upgrade --fix-missing – Joshua Besneatte Aug 12 '18 at 16:04
  • nothing happened – lippman27 Aug 12 '18 at 16:30
  • @lippman27 That is an old kernel. Do you have newer one installed? (dpkg -l linux-image-4'*' | grep ^ii will tell) – jarno Aug 12 '18 at 21:26
  • my version is 4.4.0-98 – lippman27 Aug 12 '18 at 21:47
  • linux-headers-generic Might want to install the incorrect headers, at least in my case it was like that. Better to write your kernel version directly -> linux-headers-4.15.0-30-generic – vmemmap Jul 11 '22 at 10:03
  • This is truly maddening. There are no headers for my kernel, period. I cannot find anything that works. kernel version 4.19.0-25-amd64. Using just amd64 without a version number, there are no packages. Using that whole string, there are no packages. Using 'linux' as the first word of the package name, there are no packages. Using 'kernel' instead of 'linux', there are no packages. I've lost an entire day of my life on this. There are no packages. There are no packages. There are no packages. Period. Why is absolutely nobody anywhere able to explain how to install the headers????? – John Smith Nov 08 '23 at 08:07
  • @JohnSmith the package name needs to be exact, so just guessing probably won't work. usually if you apt install linux-headers-generic it should install and update the appropriate headers for your system. – Joshua Besneatte Feb 26 '24 at 19:29
0

These commands worked for me.

Find linux-headers-4.4.0-98

$ apt-cache search linux-headers-4.4.0-98
linux-headers-4.4.0-98 - Header files related to Linux kernel version 4.4.0
linux-headers-4.4.0-98-generic - Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
linux-headers-4.4.0-98-lowlatency - Linux kernel headers for version 4.4.0 on 64 bit x86 SMP

Install linux-headers-4.4.0-98

For your reinstall you will type:

sudo apt install --reinstall linux-headers-4.4.0-98-generic

But for myself it's a new package so I'll use:

$ sudo apt install linux-headers-4.4.0-98-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  linux-headers-4.4.0-98
The following NEW packages will be installed:
  linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 78.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-98 all 4.4.0-98.121 [9,913 kB]
Get:2 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-98-generic amd64 4.4.0-98.121 [793 kB]
Fetched 10.7 MB in 3s (3,463 kB/s)                  
Selecting previously unselected package linux-headers-4.4.0-98.
(Reading database ... 288111 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-98_4.4.0-98.121_all.deb ...
Unpacking linux-headers-4.4.0-98 (4.4.0-98.121) ...
Selecting previously unselected package linux-headers-4.4.0-98-generic.
Preparing to unpack .../linux-headers-4.4.0-98-generic_4.4.0-98.121_amd64.deb ...
Unpacking linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
Setting up linux-headers-4.4.0-98 (4.4.0-98.121) ...
Setting up linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic

Remove linux-headers-4.4.0-98

Because this was a test and I don't need them on my machine:

$ sudo apt remove --purge linux-headers-4.4.0-98-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-headers-4.4.0-98
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  linux-headers-4.4.0-98-generic*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 7,431 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 314874 files and directories currently installed.)
Removing linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
dpkg: warning: while removing linux-headers-4.4.0-98-generic, directory '/lib/modules/4.4.0-98-generic' not empty so not removed

Cleanup leftover garbage

I see there is left over garbage in the last line so I'll manually clean it up:

$ sudo rm -rf /lib/modules/4.4.0-98-generic
$ ll /lib/modules/4.4.0-98-generic
ls: cannot access '/lib/modules/4.4.0-98-generic': No such file or directory

Now 4.4.0-98 is almost removed. It is completely removed with:

sudo apt autoremove
0

If you have internet connection...

Run software-properties-gtk. In Ubuntu Software tab, notice the Download from field. What do you have there? (I use "ubuntu.trumpetti.atm.tut.fi/ubuntu" as I live in Finland; at least that server has linux-headers-4.4.0-98 currently.) Try to change the setting in the field. In Updates tab see that you have "Important security updates" checked. Do what the dialog asks. And close it. Then do the following in terminal (but stop, if there are errors and please report them in comments.):

sudo apt install --reinstall linux-headers-4.4.0-98
sudo apt-mark auto linux-headers-4.4.0-98
sudo apt install linux-generic

and run update-manager to install further updates.

If you do not have internet connnection...

If the problem is that you do not have internet connection, but you have Ubuntu CD-ROM/DVD installation media, you can use it as a software source, see here. If you do not have optical media, but USB one, trye this.

Check if the media contains some other kernel:

apt-cache policy linux-generic

If it contains different version, you had better purge the 4.4.0-98 headers:

sudo dpkg --purge --force-remove-reinstreq linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic

And install the kernel from the media:

sudo apt install linux-generic

And finally purge the old kernel images:

sudo apt purge linux-image-4.4.0-98-generic
jarno
  • 5,600
  • after run software-properties-gtk the application stops, andinformation about avaliable software is out-of-date but i don't have an internet connection which it's another problem i'm having – lippman27 Aug 19 '18 at 14:24
  • @lippman27 I updated my answer. – jarno Aug 19 '18 at 18:28
-1

After trying many of the options above, (perhaps it helped) I tried the following command and it worked:

sudo apt --fix-broken install

I hope it works of others...