LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   dpkg error when trying to reinstall kernal from a live session using chroot (https://www.linuxquestions.org/questions/linux-general-1/dpkg-error-when-trying-to-reinstall-kernal-from-a-live-session-using-chroot-4175585651/)

PClOStinspace 07-27-2016 03:17 PM

dpkg error when trying to reinstall kernal from a live session using chroot
 
I have messed up using a boot-repair CD and have ended up either removing or partially removing (not sure which tbh) my kernal.

I have booted up an Ubuntu-Gnome 16.04 live session (this is the same distro/release as the damaged system, not sure if it helps at all but though it sensible) chrooted into the damaged system using instructions found here:-
http://askubuntu.com/questions/28099.../166010#166010

I have got as far as the command to install the new kernel and am getting:-
Code:

root@ubuntu-gnome:/# apt-get install linux-image-generic
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following additional packages will be installed:
  linux-image-4.4.0-31-generic thermald
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools linux-headers-4.4.0-31-generic
The following packages will be REMOVED:
  linux-image-extra-4.4.0-28-generic
The following NEW packages will be installed:
  linux-image-4.4.0-31-generic linux-image-generic thermald
0 upgraded, 3 newly installed, 1 to remove and 3 not upgraded.
2 not fully installed or removed.
Need to get 0 B/57.8 MB of archives.
After this operation, 106 MB disk space will be freed.
Do you want to continue? [Y/n] y
debconf: Perl may be unconfigured (Can't locate Debconf/Log.pm in @INC (you may need to install the Debconf::Log module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 1) line 4.
BEGIN failed--compilation aborted at (eval 1) line 4.
) -- aborting
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
(Reading database ... 333847 files and directories currently installed.)
Removing linux-image-extra-4.4.0-28-generic (4.4.0-28.47) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-28-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-28-generic
/usr/sbin/mkinitramfs: 63: .: Can't open /usr/share/initramfs-tools/scripts/functions
update-initramfs: failed for /boot/initrd.img-4.4.0-28-generic with 2.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 2
dpkg: error processing package linux-image-extra-4.4.0-28-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-28-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can someone with more brains than me tell me how I get out of this mess! I have tried removing 'linux-image-extra-4.4.0-28-generic' both with apt and directly with dpkg to no avail and now run entirely out of ideas!!

mpapet 07-27-2016 04:27 PM

Personally, this is why I use a separate partition for home. All my "stuff" stays intact and I can blow up the system every once in a while.

Also remember that the rescue/install CD and system kernel versions get out of sync. You can chroot to the old system. But the running kernel from the installer/rescue likely doesn't match the kernel on the disk... and you are unable to redo the boot.

Copy off everything in your home folder and reinstall.

PClOStinspace 07-27-2016 04:33 PM

Quote:

Originally Posted by mpapet (Post 5582194)
Personally, this is why I use a separate partition for home. All my "stuff" stays intact and I can blow up the system every once in a while.

I do have a separate /home for exactly that reason :)

Quote:

Originally Posted by mpapet (Post 5582194)
Copy off everything in your home folder and reinstall.

If it comes to it I'll have to tomorrow as I need this machine up and running on Friday but it's not my preferred solution if I can possibly avoid it!

mpapet 07-27-2016 04:40 PM

Quote:

Originally Posted by PClOStinspace (Post 5582198)
If it comes to it I'll have to tomorrow as I need this machine up and running on Friday but it's not my preferred solution if I can possibly avoid it!

IMO, you have no choice. Good thing you have a separate /home mount!


All times are GMT -5. The time now is 12:35 PM.