Q:

How to reinstall the kernel with a crippled OS?

I use Ubuntu 14.10 and as it happens quite often my /boot partition got full. Usually in this case I use apt-get to manually remove one or a few old kernels and everything is fine again for a few weeks. This time though I grew tired of this and decided to try something a bit more automatic to see if this could make my life easier. Well, it got worse actually.
I headed over to http://ubuntuforums.org/showthread.php?t=1435818 where I found that one liner:  
dpkg --get-selections | grep 'linux-image*' | awk '{print $1}' | egrep -v "linux-image-$(uname -r) | linux-image-generic" | while read n; do apt-get -y remove $n; done

Obviously I did not understand exactly what it was going to do although I was pretty confident. It did quite a few uninstalls for a while, I did not remember having seen that before. After executing it, I checked and my /boot partition only had the latest kernel, in my case 3.16.0-31-generic, which is what I expected. But upon reboot, gone was my high resolution graphical settings (this could be because of the nvidia drivers, that would not be the first time) and also gone was the mouse, and also the network. Luckily I use a ps2 keyboard and this is still working. I suspect some modules are missing although lsmod still lists quite a few. 
How could I diagnose the exact problem, and if indeed I need to reinstall the kernel how can I do that with my network gone? Or how can I load the module to get network back if this is the issue?

A:

Thanks for the comments about looking at the logs to see what was removed. It showed the previous kernels were removed indeed, and also the extra package for the current kernel. I still needed to reinstall a current kernel. So I booted from a USB live distro, mounted the encrypted partition where the home folder was, downloaded the latest kernel for this version along with extras, copied the 2 .deb on the local drive, rebooted and issued a dpkg -i on the debs. It installed everything, I rebooted and it's all back to normal.

