I made a fatal mistake. After dist-upgrading to 2.6.39.2 I removed the old kernels with the command: apt-get remove –purge linux-kernel ......
Afterwards I removed the directories for the old kernels in /lib/modules/kernel number with the rm -rf command.
By mistake I removed the 2.6.39.2-amd64 kernel in /lib/modules so now I cannot log in anymore.
What can I do now.
Removed the kernel in /lib/modules by mistake, what to do?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Removed the kernel in /lib/modules by mistake, what to do?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Removed the kernel in /lib/modules by mistake, what to d
Hello Rikhard and welcome to Linux Mint forum.
Boot into your live Mint disc > update to the same kernel image that you did before > locate /lib/modules > as root mount your HDD where your install is > copy the files from the running live disc to the appropriate location on your HDD install > then boot into your installed system and check.
**It is important to always maintain a known "good-working-kernel-version" as a backup at all times in case things go wrong**
Let us know how things go.
S
If you are sure that you only deleted /lib/modules directory of your current kernel you might try the following:By mistake I removed the 2.6.39.2-amd64 kernel in /lib/modules so now I cannot log in anymore.
What can I do now.
Boot into your live Mint disc > update to the same kernel image that you did before > locate /lib/modules > as root mount your HDD where your install is > copy the files from the running live disc to the appropriate location on your HDD install > then boot into your installed system and check.
**It is important to always maintain a known "good-working-kernel-version" as a backup at all times in case things go wrong**
Let us know how things go.
S
"In the beginning of a change the patriot is a scarce man, brave and hated and scorned. When his cause succeeds the timid join him for then it costs nothing to be a patriot."
Mark Twain
Mark Twain
Re: Removed the kernel in /lib/modules by mistake, what to d
Thanks for your answer!
I tried to do what you proposed but although I have 8Gb ram there where not enough space for doing a dist-upgrade so the upgrade was not fully completed. I have MintDebian so there were a lot of upgrades.
Anyway the upgrade created the dictionary 2.6.39-2-amd64 in /lib/modules which I copied to MintDebian on my harddisk.
Now at boot it search for modules.dep in the dictionary 2.6.39-2 so I think the kernel upgrade was not fully completed,
At boot I am dropped to a shell so I can wait for the next kernel upgrade which will fix the problem.
Are there possible a chance to fix this by reinstalling the kernel 2.6.39-2 via apt-get. I do not find any command for doing that?
apt-get install linux-headers linux-headers-common linux-image and linux-kbuild tells me only they are the latest versions.
I tried to do what you proposed but although I have 8Gb ram there where not enough space for doing a dist-upgrade so the upgrade was not fully completed. I have MintDebian so there were a lot of upgrades.
Anyway the upgrade created the dictionary 2.6.39-2-amd64 in /lib/modules which I copied to MintDebian on my harddisk.
Now at boot it search for modules.dep in the dictionary 2.6.39-2 so I think the kernel upgrade was not fully completed,
At boot I am dropped to a shell so I can wait for the next kernel upgrade which will fix the problem.
Are there possible a chance to fix this by reinstalling the kernel 2.6.39-2 via apt-get. I do not find any command for doing that?
apt-get install linux-headers linux-headers-common linux-image and linux-kbuild tells me only they are the latest versions.
Re: Removed the kernel in /lib/modules by mistake, what to d
Quoting myself:
When you are using the live disc > run in terminal sudo apt-get update > look in your package manager for the exact kernel that is on your HDD install > use your package manager to install the new kernel > locate /lib/modules/new_kernel_version > as root mount your HDD where your install is > copy the files from the running live disc to the appropriate location on your HDD install > then boot into your installed system and check.
If you can't find the kernel version that you had for some reason we should be able to find it on the web, such as Here
Keep notes of your progress in case you get confused.
Let us know how things go.
S
Edit:
OK I'm back LOL! Had to punch outta here real quick due to work flow.
You need the following files: (should be installed in this order as well)
1. "linux header" file that ends "all.deb"
2. "linux header" file that ends "amd64.deb" (for 64bit only)
3. "linux image" file that ends "amd64.deb" (for 64bit only)
If you are unsure of anything please post back.
S
I'm sorry if I was unclear! I did NOT mean for you to try and do a distribution upgrade. Only the kernel files as they are all that we need.update to the same kernel image that you did before
When you are using the live disc > run in terminal sudo apt-get update > look in your package manager for the exact kernel that is on your HDD install > use your package manager to install the new kernel > locate /lib/modules/new_kernel_version > as root mount your HDD where your install is > copy the files from the running live disc to the appropriate location on your HDD install > then boot into your installed system and check.
If you can't find the kernel version that you had for some reason we should be able to find it on the web, such as Here
Keep notes of your progress in case you get confused.
Let us know how things go.
S
Edit:
OK I'm back LOL! Had to punch outta here real quick due to work flow.
If you can get to the recovery mode such as you have said use the live disc to download and then move a new kernel version packages to your HDD. Then you can install them with the terminal as root.At boot I am dropped to a shell so I can wait for the next kernel upgrade which will fix the problem.
You need the following files: (should be installed in this order as well)
1. "linux header" file that ends "all.deb"
2. "linux header" file that ends "amd64.deb" (for 64bit only)
3. "linux image" file that ends "amd64.deb" (for 64bit only)
If you are unsure of anything please post back.
S
"In the beginning of a change the patriot is a scarce man, brave and hated and scorned. When his cause succeeds the timid join him for then it costs nothing to be a patriot."
Mark Twain
Mark Twain
Re: Removed the kernel in /lib/modules by mistake, what to d
At last my MintDebian is fixed.
What I did was:
sudo apt-get --reinstall install linux-headers-2.6.39-2-amd64 linux-headers-2.6.39-2-common linux-image-2.6.39-2-amd64 linux-kbuild-2.6.39
That was the easiest way to get back the missing 2.6.39-2-amd64 dictionary in /lib/modules.
Then when tried to log into graphics mode with “startx” came this:
Fatal server error
Server is already active for display 0
if this is no longer running, remove /tmp/.x0-lock
xinit:giving up
xinit:unable to connect to x server
xinit:server error connection refused
No .xo-lock was found however in /tmp
I think the cause was that my nvidia-kernel-module was missing because as a gift from heaven when I made an apt-get upgrade there was an upgrade for the nvidia-kernel-module and halleluja the graphics started. Everything went so fast but I think it had to do with the nvidia-kernel-dkms.
I do not know for sure what I could have done if there had not been an upgrade for nvidia.
May be “apt-get --reinstall install nvidia-kernel-dkms”.
There is also a dkms command I am not aqquinted with, perhaps “dkms --reinstall install nvidia-kernel-dkms”.
Anyway thanks for your answers.
What I did was:
sudo apt-get --reinstall install linux-headers-2.6.39-2-amd64 linux-headers-2.6.39-2-common linux-image-2.6.39-2-amd64 linux-kbuild-2.6.39
That was the easiest way to get back the missing 2.6.39-2-amd64 dictionary in /lib/modules.
Then when tried to log into graphics mode with “startx” came this:
Fatal server error
Server is already active for display 0
if this is no longer running, remove /tmp/.x0-lock
xinit:giving up
xinit:unable to connect to x server
xinit:server error connection refused
No .xo-lock was found however in /tmp
I think the cause was that my nvidia-kernel-module was missing because as a gift from heaven when I made an apt-get upgrade there was an upgrade for the nvidia-kernel-module and halleluja the graphics started. Everything went so fast but I think it had to do with the nvidia-kernel-dkms.
I do not know for sure what I could have done if there had not been an upgrade for nvidia.
May be “apt-get --reinstall install nvidia-kernel-dkms”.
There is also a dkms command I am not aqquinted with, perhaps “dkms --reinstall install nvidia-kernel-dkms”.
Anyway thanks for your answers.