Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was trying to repair my GRUB after installing Windows over Ubuntu . But i couldn't repair it and asked this question. While discussing with psusi , we notice something. My installed system is 64Bit but my some library files' are 32 bit (for example : libdevmapper.so.1.02.1).

(You can check step 13 for my question. And check other steps for see which steps i followed.)

  1. My old Ubuntu was installed on /dev/sda3 . I mounted it to /mnt/ubusda3
  2. root@ubuntu:/home/ubuntu# file /mnt/ubusda3/sbin/init /mnt/ubusda3/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
  3. root@ubuntu:/home/ubuntu# file /mnt/ubusda3/lib/libdevmapper.so.1.02.1 /mnt/ubusda3/lib/libdevmapper.so.1.02.1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
  4. sudo dpkg --root=/mnt/ubusda3 -i /mnt/ubusda3/var/cache/apt/archives/libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb
  5. chroot /mnt/ubusda3
  6. apt-get install --reinstall libdevmapper1.02.1
  7. And then again i tried to update-grub i got mapdevfs: error while loading shared libraries: libdebian-installer.so.4: cannot open shared object file: No such file or directoryerror.
  8. I restarted my system but nothing changed.
  9. i found mapdevfs on /bin/mapdevfswith which mapdevfs command.
  10. sudo rm /bin/mapdevfs
  11. for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/ubusda3$i"; done
  12. grub-install /dev/sda
  13. Finally i fix my GRUB problem. Now there is a GRUB menu while booting. enter image description here Previous Linux Versions screen (and dusts) enter image description here

But when i choose Ubuntu 3.0.0.17-generic, it's freezing on loading screen and i'm getting this error : (Scroll Lock and Num Lock flashing.) enter image description here

When i choose other kernel versions -which in previous ubuntu versions screen- , i'm getting this error for both of them.

enter image description here

Note 1 (for irrational John)

ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# mkdir /mnt/ubusda3
root@ubuntu:/home/ubuntu# mount /dev/sda3 /mnt/ubusda3
root@ubuntu:/home/ubuntu# for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/ubusda3$i"; done
root@ubuntu:/home/ubuntu# chroot /mnt/ubusda3/
root@ubuntu:/# apt-get -V --reinstall install libnih
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libnih

and then i noticed it's libnih1 not linbih (http://packages.ubuntu.com/search?keywords=libnih&searchon=names&suite=oneiric&section=all)

root@ubuntu:/# apt-get -V --reinstall install libnih1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
   winbind (3.5.11~dfsg-1ubuntu2.2)
The following packages will be upgraded:
   winbind (3.5.11~dfsg-1ubuntu2.1 => 3.5.11~dfsg-1ubuntu2.2)
1 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
Need to get 54.7 kB/5,693 kB of archives.
After this operation, 32.8 kB disk space will be freed.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  libnih1
Install these packages without verification [y/N]? y
Get:1 http://tr.archive.ubuntu.com/ubuntu/ oneiric/main libnih1 amd64 1.0.3-4ubuntu2 [54.7 kB]
Fetched 54.7 kB in 0s (57.1 kB/s)  
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 196784 files and directories currently installed.)
Preparing to replace winbind 2:3.5.11~dfsg-1ubuntu2.1 (using .../winbind_2%3a3.5.11~dfsg-1ubuntu2.2_amd64.deb) ...
/sbin/runlevel: error while loading shared libraries: libnih.so.1: wrong ELF class: ELFCLASS32
 * Stopping the Winbind daemon winbind
   ...done.
Unpacking replacement winbind ...
Preparing to replace libnih1 1.0.3-4ubuntu2 (using .../libnih1_1.0.3-4ubuntu2_amd64.deb) ...
Unpacking replacement libnih1 ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up libwbclient0 (2:3.5.11~dfsg-1ubuntu2.2) ...
Setting up samba-common (2:3.5.11~dfsg-1ubuntu2.2) ...
Setting up winbind (2:3.5.11~dfsg-1ubuntu2.2) ...
 * Starting the Winbind daemon winbind
/usr/sbin/winbindd: error while loading shared libraries: libcap.so.2: wrong ELF class: ELFCLASS32
   ...fail!
invoke-rc.d: initscript winbind, action "start" failed.
dpkg: error processing winbind (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up libsmbclient (2:3.5.11~dfsg-1ubuntu2.2) ...
Setting up samba-common-bin (2:3.5.11~dfsg-1ubuntu2.2) ...
Setting up smbclient (2:3.5.11~dfsg-1ubuntu2.2) ...
Setting up libnih1 (1.0.3-4ubuntu2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 winbind
E: Sub-process /usr/bin/dpkg returned an error code (1)

This time i'm getting same boot error for libnih-dbus.so.... file.

Also for finding other 32bit files, i executed your commands and i see all files in /mnt/ubusda3/lib/modules/3.0.0-12-generic/ and /mnt/ubusda3/bin are 32 bit.

Is it possible to reinstall whole kernel files ?

share|improve this question
    
Why not just reinstall Ubuntu? if it's hard to fix the boot error, just make a new fresh install. –  Alvar Apr 23 '12 at 13:17
    
@Alvar , i don't want it. For example i need my Firefox bookmarks, etc. Also there are a lots of applications, i don't want to reinstall all of them. So i'm wondering, is it possible to rescue my system. –  Eray Apr 23 '12 at 13:19
    
it's probably possible, but it will go much faster to make a new install, also, you can go via windows to rescue some files if that's the issue. you might be able to solve it, but I don't think it's worth it... –  Alvar Apr 23 '12 at 13:21
    
@Alvar, how i'll reach my browser bookmarks ? –  Eray Apr 23 '12 at 13:28
    
@Eray Firefox bookmarks are in ~/.mozilla/firefox/*.default/bookmarkbackups/ But if you got Chrome, you could sync your bookmarks to your google account and not have to worry about losing them –  Matt Apr 27 '12 at 13:09
show 1 more comment

5 Answers 5

up vote 4 down vote accepted

OK I tried all answers, everything. But I couldn't solve my problem. And finally, I reinstall my Ubuntu.

share|improve this answer
add comment

Are you able to boot into your current install with any of the kernels installed on your system?

Looking at your chat with psusi there is a message with a link to boot-repair paste 938724. It shows your created a GRUB menu with entries for

'Ubuntu, with Linux 3.0.0-17-generic'
'Ubuntu, with Linux 3.0.0-17-generic (recovery mode)' 
'Ubuntu, with Linux 3.0.0-16-generic'
'Ubuntu, with Linux 3.0.0-16-generic (recovery mode)' 
'Ubuntu, with Linux 3.0.0-12-generic' 
'Ubuntu, with Linux 3.0.0-12-generic (recovery mode)' 

Have you tried them all and do they all fail the same way? I am just wondering if one of them allows you to boot successfully then perhaps you can then recover by purging/uninstalling a kernel that fails and then reinstall it.


April 24

According to boot-repair paste 938724, update-grub found those entries in your /boot folder when it probed. At least that is what boot-repair found in sda3/boot/grub/grub.cfg.

What do you see in your GRUB menu when you boot? Does it resemble the following?

Ubuntu, with Linux 3.0.0-17-generic
Ubuntu, with Linux 3.0.0-17-generic (recovery mode)
Previous Linux versions
Memory test (memtest86+)
Memory test (memtest86+, serial console 115200)
Windows 7 (loader) (on /dev/sda4)

(If you don't get a GRUB menu when you boot, then try pressing/holding the shift key when the boot process starts to unhide the menu.)

If you see a GRUB menu with the entry Previous Linux versions, try selecting that entry and pressing enter. You should see another menu with entries for the 3.0.0-16 and 3.0.0-12 kernels. See what happens when you boot them.


April 26

Curiouser and curiouser. OK, so ELFCLASS32 instead of 64 yet again. Not knowing what else to do, I suggest you follow the procedure you went through during your chat with psusi.

  1. Boot a Live CD/USB for 64-bit (AMD64) Ubuntu 11.10.
  2. Mount and then chroot into your broken Ubuntu install in /dev/sda3. Then run apt-get to reinstall the correct, 64-bit version of libnih.so.1.
    # mount /dev/sda3 as /mnt/ubu2fix
    mkdir /mnt/ubu2fix
    sudo mount /dev/sda3 /mnt/ubu2fix

    # chroot so that '/mnt/ubu2fix' becomes '/' for command processing
    for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/ubu2fix/$i"; done
    sudo chroot /mnt/ubu2fix

    # reinstall the package which contains libnih1.so.1.0.0 (aka libnih1.so.1)
    apt-get -V --reinstall install libnih1 

However, before you do the chroot, you might first want to try to find out just how many other ELFCLASS32 files might be present and (potentially) require fixing. I think the commands below will do this.

The commands below run the file command against every file in the directories /bin, /sbin, /lib, and /lib64 on your Ubuntu install in /dev/sda3. The grep restricts the output to 32-bit executables.

If everything is correct, then these commands should produce *NO output.* Any files listed when your run these commands are 32-bit when they should be 64-bit. They will (probably) need to be reinstalled for your system to work correctly.

sudo find /mnt/ubu2fix/bin  -type f -exec file '{}' \; | grep 32-bit
sudo find /mnt/ubu2fix/sbin  -type f -exec file '{}' \; | grep 32-bit
sudo find /mnt/ubu2fix/lib  -type f -exec file '{}' \; | grep 32-bit
sudo find /mnt/ubu2fix/lib64  -type f -exec file '{}' \; | grep 32-bit

Run the commands above after mounting /dev/sda3 as /mnt/ubu2fix, but before you do the chroot. (Or run them in a different terminal which is outside the chroot.)


April 29

I loooked at your Note 1.

Sorry about not noticing earlier your comment that
"all files in /mnt/ubusda3/lib/modules/3.0.0-12-generic/ and /mnt/ubusda3/bin are 32 bit."
I certainly did not expect this to be the case.

"Is it possible to reinstall whole kernel files ?"

I am not sure what you are asking. (But even if I did I am not sure I would know how to do it. Sorry.)


May 01 - Consider an Upgrade Install from 11.10 to 11.10


Previously, when I read the comment from @Alvar which suggested doing an install to recover your system, I assumed this implied the destruction of your current setup so I ignored it. Now I am not so sure.

It turns out that in a situation like yours where both Ubuntu and Windows are installed in different partitions on the same hard drive, the Ubuntu installer will ask what type of install you want to do as shown in the image below.

Install choices for Ubuntu 11.10 & Windows 7 dual boot

I have tried doing an upgrade install from 11.10 to 11.10 in a VirtualBox VM to get a better idea of what it does. It seems to work as it claims. I do have some warnings which I have listed below.

I can't offer you any advice on whether or not re-installing is something you should do. I do not know your situation or what resources you have or do not have at hand.

Some caveats:

  1. You must be careful to enter your current userid when the install prompts for it. If you enter a different userid, the old one will be deleted. You will be unable to login with it. This is described in more detail in this question: How can I restore a deleted username using its old home folder?
  2. If you choose to Download updates while installing, the install apparently performs the equivalent of an apt-get dist-upgrade. I had 8 pending upgrades before the upgrade install. After it completed there were 0 updates pending and a new kernel, 3.0.0-19-generic, had been installed.
  3. Firefox seemed fine. My passwords, history, and bookmarks appear to have been preserved. The application portion of my Google Chrome browser was deleted, but the user data from it was not. So after I had re-install Chrome, my settings, bookmarks, et cetera were also working correctly in Chrome.
  4. While everything seemed to work well, the safest thing is, as always, to backup your data in the Ubuntu partition before you start the install. You are the only person who knows how valuable your data is or is not to you. So you are the only person who knows what risks you are willing to take or not to take.
share|improve this answer
    
Boot-Repair-Disk and other programs which i tried add these entries. I don't have any idea about that. As i see, Ubuntu trying to boot with 3.0.0-17-generic . But i'm not sure which kernel version was really installed. –  Eray Apr 24 '12 at 10:52
    
i just update my question. Can you check 13th step ? –  Eray Apr 25 '12 at 17:28
    
OK please chech NOTE 1 –  Eray Apr 29 '12 at 19:36
    
i answered your question about find commands on Note 1 . There are really a lots of 32 bit files. i executed your commands and i see all files in /mnt/ubusda3/lib/modules/3.0.0-12-generic/ and /mnt/ubusda3/bin are 32 bit. . –  Eray Apr 29 '12 at 20:35
    
wow, you understood me better than I did. ;) –  Alvar May 12 '12 at 22:07
add comment

You need try the distro "Ubuntu Rescue Remix" and boot as live from cd/usb there can use an application for repair de Grub or detect another OS.

It is very easy to use, I working great for me.

Can get the Rescue iso for here:

share|improve this answer
    
@Eray My understanding is that he is using 11.10, not 12.04. The download link in your answer is to the wrong version of the tool for his install. –  irrational John Apr 30 '12 at 1:25
    
add comment

I faced this problem when I changed my BIOS setting. If you have changed your BIOS setting or even if not just reset BIOS to default and revert us about result.

share|improve this answer
    
Just tried it. Same error... –  Eray Apr 29 '12 at 19:36
    
Try this post and this one too. –  Ravi Ranjan Apr 30 '12 at 15:17
add comment

Try booting from a Live CD, and mount the needed device. Copy

~/mozilla/firefox/xxxxxxx.default

to a pendrive, reinstall Ubuntu, and then copy the mozilla directory to your home library. Sorry, my english is horrible. ;-)

share|improve this answer
1  
Are you sure, you understand my question ? –  Eray Apr 23 '12 at 13:36
    
actually if you just need the bookmarks this could work. or you could copy the firefox files to windows and then import the bookmarks to firefox from there. –  Alvar Apr 23 '12 at 14:27
    
@Alvar, no it was just an example. If it possible, i want to try rescue my system. –  Eray Apr 24 '12 at 10:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.