0

I have been trying to install ruby on rails and I run into failures in all directions. I finally went into the package manager and right away it detected an issue and asked me if I wanted to resolve it. Upon clicking yes, it ran and gave me the below output; failing again.

I think this has something to do with a wine installation from before because I remember getting a vague warning about not being able to upgrade after 'this'.

Can anyone tell me how to repair this short of blasting away the whole system? I spent a lot of time getting it up to speed. I disabled all 3rd party repositories

ruby install logs:

christian@christian:~$ gem install rails
Fetching: nokogiri-1.6.7.2.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/2.1.0 directory.
christian@christian:~$ sudo gem install rails
[sudo] password for christian: 
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.1.0/gems/nokogiri-1.6.7.2/ext/nokogiri
/usr/bin/ruby2.1 -r ./siteconf20160303-13069-17ounbe.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.7.2/gem_make.out
christian@christian:~$ sudo apt-get install gcc mysql-devel ruby-devel rubygems
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ruby' instead of 'rubygems'
E: Unable to locate package mysql-devel
E: Unable to locate package ruby-devel
christian@christian:~$ sudo apt-get install gcc ruby-dev rubygems
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ruby' instead of 'rubygems'
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 gcc : Depends: cpp (>= 4:5.3.1-1ubuntu1) but 4:5.2.1-3ubuntu1 is to be installed
 kmod : Depends: libkmod2 (= 22-1ubuntu1) but 21-1ubuntu1 is to be installed
 ruby : Depends: ruby2.2 but it is not going to be installed
 ruby-dev : Depends: ruby2.2-dev but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
christian@christian:~$ apt-get remove ruby
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
christian@christian:~$ sudo apt-get remove ruby
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 kmod : Depends: libkmod2 (= 22-1ubuntu1) but 21-1ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
christian@christian:~$ uname -a
Linux christian 4.2.0-30-generic #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

package update logs:

installArchives() failed: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 222876 files and directories currently installed.)
Removing linux-image-extra-3.19.0-53-generic (3.19.0-53.59) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-53-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-53-generic /boot/vmlinuz-3.19.0-53-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-53-generic /boot/vmlinuz-3.19.0-53-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-53-generic
WARNING: missing /lib/modules/3.19.0-53-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-53-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
sed: can't read /usr/share/plymouth/themes/ubuntu-text/ubuntu-text.plymouth: No such file or directory
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 2.
update-initramfs: failed for /boot/initrd.img-3.19.0-53-generic with 2.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 2
dpkg: error processing package linux-image-extra-3.19.0-53-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
dpkg: dependency problems prevent configuration of kmod:
 kmod depends on libkmod2 (= 22-1ubuntu1); however:
  Version of libkmod2:amd64 on system is 21-1ubuntu1.

dpkg: error processing package kmod (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of initramfs-tools-core:
 initramfs-tools-core depends on kmod | module-init-tools; however:
  Package kmod is not configured yet.
  Package module-init-tools is not installed.

dpkg: error processing package initramfs-tools-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of initramfs-tools:
 initramfs-tools depends on initramfs-tools-core (= 0.122ubuntu3); however:
  Package initramfs-tools-core is not configured yet.

dpkg: error processing package initramfs-tools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of plymouth:
 plymouth depends on initramfs-tools | dracut; however:
  Package initramfs-tools is not configured yet.
  Package dracut is not installed.

dpkg: error processing package plymouth (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-drivers-common:
 ubuntu-drivers-common depends on kmod | module-init-tools; however:
  Package kmod is not configured yet.
2
  • Could you please try: sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade and report back what happens. You could also try sudo apt-get autoremove to remove any loose no longer needed packages - don't worry that command is safe and will only remove installed packages that no longer have any dependencies nor dependant on anything and possibly broken packages. You can also do sudo apt-get autoclean to remove temporary deb files which are downloaded when you install something.
    – hazrpg
    Mar 4, 2016 at 0:51
  • Answer below did the trick! Very close! Mar 4, 2016 at 1:04

1 Answer 1

1

Have a look at this post:

https://askubuntu.com/a/647250/505633

It seems to address the same problem.

2
  • It did. Should I delete this question? Mar 4, 2016 at 1:04
  • no, you have a different topic. There are many ways to ask a question.
    – Izzno
    Mar 4, 2016 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .