LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   restore bootability to an Ubuntu 14.04 64 bit server (https://www.linuxquestions.org/questions/linux-server-73/restore-bootability-to-an-ubuntu-14-04-64-bit-server-4175577211/)

twoprop 04-11-2016 03:18 PM

restore bootability to an Ubuntu 14.04 64 bit server
 
Oh, dear.

I was doing routine maintenance on my server when I noticed a lot of crufty old kernels. I did an `apt-get autoremove' and it rendered the server unbootable. It just brings up an Ubuntu 12.04 (yes, it was running 14.04) splash screen and hangs. Inspecting the file system, it appears that the most recent kernel files in /boot have been deleted.

I tried using the live CD to re-install grub, but no joy. I can install a fresh partition and I thought I could just migrate all the files over (I have many good backups), but copying all of /etc renders the new partition unbootable, and I just spent the last 30 sleepless hours trying to selectively migrate files and realized that the server is just too big and complex to ever make that happen. I tried replacing the /boot directory with the one from the new (bootable) partition, then chrooting to the old partition and running update-grub, but it still won't boot.

Anyone know of a good tutorial or explanation of how I can make the old partition bootable again, without losing 12 years of accumulated, interlocking configuration files? I have backups of everything; I thought I was safe but just having all the files doesn't help if I can't get them all together in a bootable filesystem.

Thanks...

--2p

ondoho 04-12-2016 02:29 AM

Quote:

Originally Posted by twoprop (Post 5529529)
I was doing routine maintenance on my server when I noticed a lot of crufty old kernels. I did an `apt-get autoremove' and it rendered the server unbootable.

apt-get autoremove should not do that.
likely something else was amiss; maybe your "routine maintenance" had some side effects?

Quote:

I tried using the live CD to re-install grub, but no joy.
that is a very imprecise account.
we need moreinformation.

Quote:

Anyone know of a good tutorial or explanation of how I can make the old partition bootable again, without losing 12 years of accumulated, interlocking configuration files?
no.
my guess is, lots of manual work.

twoprop 04-12-2016 09:29 AM

> apt-get autoremove should not do that.

Of course it shouldn't, but I had a bootable, functioning system, did the autoremove, a subsequent reboot failed and most of the recent kernel files were gone. I didn't do any other maintenance between booting the system (following an `aptitude safe-upgrage'), running the autoremove, and the failure. It was certainly the autoremove that did it, but this system has a long legacy. The likelihood of other kinds of corruption either in the apt infrastructure or the disk structure itself is high.

> that is a very imprecise account. we need moreinformation.

The Ubuntu 14.04 server installer disc has a "rescue" option that boots a limited live system. That system offers an option to reinstall grub. I ran that, got no errors, but it didn't change anything (the system still booted into a 12.04 splash screen followed by a hang).

> my guess is, lots of manual work.

Thanks for taking the time to reply and confirming my suspicions. After over a decade of continuous uptime, it isn't unreasonable to just do a scratch reconfigure.

Peace...

--2p

syg00 04-12-2016 07:55 PM

Should be reasonably straight-forward.
:p

It's not just the kernel itself(s ??? - doesn't look right) that have evaporated; using a package manager also zaps the kernel modules, so just copying over /boot will never work.
Long-and-short of it should be to just chroot into the on-disk system, re-install (force if necessary) the appropriate kernel package, fix up grub, and reboot.
It's never that easy, but should be. Presumes there is no underlying (other) problem like a broken filesystem or flaky disk, and that you haven't done any other damage in the interim.
Have a look at this - there is a verbose post at the bottom.

Emerson 04-12-2016 08:05 PM

It sounds like a newer kernel was installed but Grub wasn't configured to use it. Again presuming there was no hard drive corruption fixing it could be as simple as booting from external media and editing grub conf to load an existing kernel. Yes, even Grub2 conf can be edited by hand, doing so is even not discouraged by developers.

Edit: Actually you could load an existing kernel from Grub boot menu by hitting 'e' and editing the command line. This will bring your box up, just remember to edit Grub conf to make the change permanent.

twoprop 04-12-2016 11:25 PM

Thanks, all!

I was able to reinstall the kernel files by following the information here:

http://askubuntu.com/questions/11908...distro-upgrade

As predicted, it wasn't that simple. Booting now gets as far as

* Starting SystemD login management service [OK]

So I seem to have a mostly functional kernel, though it hangs at that point. I'm analyzing logs now, though I have to say that there isn't a lot of information there. syslog, kern.log, boot.log all seem to follow a predictable course, then everything just stops after a complaint about no lp devices. There is a conspicuous lack of reference to any networking hardware or drivers which might point to the problem. At any rate, though, I seem to be in motion again and learned the thing I really wanted to know, which is how to render an existing filesystem bootable.

Thanks!

--2p


All times are GMT -5. The time now is 03:04 AM.