D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] System down...

 

On 26/05/16 21:14, Adrian Midgley wrote:

> Got that.
> Ok... 
> So,  boot back into rescue system and as for a shell in the installer
> environment rather than using a partition as root?
> 
> Graphical rescue mode running...

Exactly - you want to check at this point that you don't have anything
from your disks mounted automatically. Check /etc/mtab to see what's
currently mounted and ensure nothing from /dev/sda or /dev/sdb is
mentioned. Ping 8.8.8.8 or whatever and you're ready.

I'm going to cheat and simply use an excellent page that I always crib
from (I'm not going to pretend that I can remember this off the top of
my head)...

http://linuxandfriends.com/how-to-reinstall-grub2-chroot-into-a-linux-partition

This is your basic recipe, ignoring this guy's more complex single disk
windows+linux layout: yours is more direct luckily.

Create a new place to hold the chroot, I prefer something unmistakable
such as:

mkdir /TARGET

Substitute this or whatever you prefer in the commands lifted from the
webpage, but essentially:

mount -t ext4 -o rw /dev/sda2 /TARGET
mount -t proc none /TARGET/proc
mount -o bind /dev /TARGET/dev
mount -o bind /sys /TARGET/sys
mount -t devpts devpts /TARGET/dev/pts

In your case with a slightly unusual layout, you might want to mount
your sdb partitions in the right place so if /home lives on sdb1 for
example, you can mount it with:

mount -t ext4 /dev/sdb1 /TARGET/home

And the same for any other partitions from sdb. However, /home is a bad
example as you don't NEED to mount it for this - all your chroot
operations will be performed as root and home can remain unmounted. Same
with any other unnecessary partitions from sdb. You also don't NEED to
mount your EFI sda1 for this operation as it would be wise to just do
the kernel first. When you're ready:

chroot /TARGET /bin/bash

You'll be dropped into a root shell on your resurrected system - at this
point you are now genuinely root on your proper OS so be careful, it's
"real" from now on in.

Make sure you still have internet access - should be fine.

apt-get update
apt-get dist-upgrade

Check your current kernel(s):

dpkg -l | grep linux-image

You may see some old kernels marked with (rc) - these are old kernels
that were installed but have been removed and not yet fully purged.
These are of particular interest as they presumably worked before and
are good candidates for reinstallation. You will see I believe one
kernel in your case marked (ii) - this is your currently faulty kernel.

apt-get install linux-image- (hit tab here to see what's available). On
Debian 8 the latest I think will be:

apt-get install linux-image-3.16.0-4-amd64

Force it with --reinstall if necessary:

apt-get install linux-image-3.16.0-4-amd64 --reinstall

Also get the relevant headers:

apt-get install linux-headers-3.16.0-4-amd64 --reinstall

If you have the backports repo enabled (recommended) you can grab a much
more up to date 4 series kernel.

cat "deb http://ftp.debian.org/debian jessie-backports main" >>
/etc/apt/sources.list

apt-get update && apt-get dist-upgrade
apt-get -t jessie-backports install linux-image-4.5.0-0.bpo.2-amd64
linux-headers-4.5.0-0.bpo.2-amd64

If there are more recent versions available, grab them instead. Force
reinstall with --reinstall as necessary. Make sure to install at least
two sets of linux-image + linux-headers and any dependencies dragged in.
You will end up with fallback options to boot from to test afterwards.

Obviously, any errors reported here are critical so keep an eye out for
anything the shell spits out that doesn't look as expected and copy them
out for us to look at.

This should be it - drop out of your chroot shell with "exit", and then
umount ALL the stuff you mounted earlier. When /etc/mtab in your
installer shell is cleaned of your internal disks, issue "reboot" and
cross your fingers!

Interrupting GRUB on reboot should now list all the kernels you've just
(re)installed - I'd default to booting whatever the newest is. If all
has gone well, you'll be up and running again: if not, don't give up
yet. Another chroot pass might be required, this time also pulling in
the EFI partition and potentially reinstalling GRUB this time around.

Let us know how you get on - good luck.

Cheers
-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq