last day (24 days later) » 

1:31 PM
2
Q: Can't repair GRUB

ErayI'm trying to repair my GRUB after Windows 7 installation. I have a live 64bit Ubuntu CD. I'm following this answer's steps . But in 6th step I'm getting /usr/sbin/grub-probe: error while loading shared libraries: libdevmapper.so.1.02.1: wrong ELF class: ELFCLASS32 after executing update-grubc...

 
It looks like your installed system is in fact, not 64 bit.
 
@psusi , why? how?
 
Actually it looks like it might just some files that are 32bit. See what file /lib/libdevmapper.so.1.02.1 and file /usr/sbin/grub-probe say ( while within the chroot ).
 
@psusi , please check my Note 2
 
First you said you were using a 64 bit livecd, now 32. Which is it? You need to use the 64 bit one.
 
1:31 PM
@psusi , i have 32 bit AND 64 bit live cd's. You said your system 32bit because of this i tried with 32Bit livecd.
 
The error message indicated that the library is 32bit when it needs to be 64... check it ( the one on the hd, not the livecd ) with file
 
hello
I checked them? on note 2.
 
you checked the copy on the livecd
of the library
and /sbin/init on the hd
 
/lib/libdevmapper.so.1.02.1 this file on live cd?
 
yes... you need to check the copy on the hd instead
 
1:39 PM
sorry. how can i find it ?
 
it was complaining that that file is 32bit, when the system otherwise is 64
mount the hd like you did before for /sbin/init
 
i have 64 bit and 32 bit live cds
i can use them
 
stick to 64
 
ok
i tried that, you are talking about irrational John's 2nd update (askubuntu.com/a/123320/17345) right ?
> ubuntu@ubuntu:~$ sudo mkdir /mnt/ubusda3
> ubuntu@ubuntu:~$ sudo mount -t ext4 /dev/sda3 /mnt/ubusda3
> ubuntu@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
 
yes
 
1:42 PM
here my results :
> ubuntu@ubuntu:~$ sudo mkdir /mnt/ubusda3
> ubuntu@ubuntu:~$ sudo mount -t ext4 /dev/sda3 /mnt/ubusda3
> ubuntu@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
 
so /sbin/init on the hd is 64bit, which would indicate that it's a 64bit system... but the original error you got complained about that library being 32 bit, so check that library instead... if init is 64bit and the library is 32bit, that would be the problem
 
how can i check that library instead?
 
change /sbin/init to /lib/libdevmapper.so.1.02.1
 
now i'll boot with 64bit live cd and then execute this command directly : file /lib/libdevmapper.so.1.02.1 right ?
 
1:56 PM
no, that is the one on the livecd... you need to prefix it with the path to where you mount the hd
 
um.. sorry i don't know this processes very well. I don't know how can i do it.
 
if you mounted the hd in /mnt/ubusda3 then that's the prefix
 
2:15 PM
of ok i'll execute this command : `file /mnt/ubusda3/lib/libdevmapper.so.1.02.1
 
2:45 PM
well?
 
i'm sorry, i had to go lunch. Now i'll trying it. Just a minute please
ok
now i'm on 64bit live cd
> ubuntu@ubuntu:~$ sudo su
> root@ubuntu:/home/ubuntu# mkdir /mnt/ubusda3
> root@ubuntu:/home/ubuntu# mount -t ext4 /dev/sda3 /mnt/ubusda3
>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
 
3:25 PM
yep, somehow you got the 32 bit version of that library installed on a 64 bit system
 
how can we fix it? And if we fix it, can we solve my grub problem?
 
chroot into the hd and see what version it thinks is installed... chroot /mnt/ubusda3, then apt-cache policy libdevmapper1.02.1
 
> 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
> 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
 
paste the wrong thing?
 
opps sorry
> root@ubuntu:/# apt-cache policy libdevmapper1.02.1
> libdevmapper1.02.1:
> Installed: 2:1.02.48-4ubuntu3
> Candidate: 2:1.02.48-4ubuntu3
> Version table:
> *** 2:1.02.48-4ubuntu3 0
> 500 http://tr.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
> 100 /var/lib/dpkg/status
( i executed chroot /mnt/ubusda3/ before apt-cache)
 
3:39 PM
hrm... what does md5sum /lib/libdevmapper1.02.1 show? ( still inside the chroot )
and cat /var/lib/dpkg/info/libdevmapper1.02.1.md5sums
 
> ubuntu@ubuntu:~$ sudo su
> root@ubuntu:/home/ubuntu# chroot /mnt/ubusda3
> root@ubuntu:/# md5sum /lib/libdevmapper1.02.1
> md5sum: /lib/libdevmapper1.02.1: No such file or directory
> root@ubuntu:/# md5sum /lib/libdevmapper.1.02.1
> md5sum: /lib/libdevmapper.1.02.1: No such file or directory
> root@ubuntu:/# md5sum /lib/libdevmapper.so.1.02.1
> 262cd47e4925fe7b2a4125f3d2686405 /lib/libdevmapper.so.1.02.1
> root@ubuntu:/# cat /var/lib/dpkg/info/libdevmapper1.02.1.md5sums
> 4d638d449789e47369979f3ff16a0655 lib/libdevmapper.so.1.02.1
 
err, md5sum /lib/libdevmapper.so.1.02.1
forgot the so
 
yes i add it. you can see at 7th line
added*
 
ahh, yea... weird... somehow you installed the 64 bit version of the package like normal, and have since replaced that specific file with the 32bit version
so reinstall the package... run apt-get install --reinstall libdevmapper1.02.1
 
how can i replace this file with original 64 bit ?
ok just a minute
(inside chroot)
root@ubuntu:/# apt-get install --reinstall libdevmapper1.02.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 6 not upgraded.
Need to get 70.0 kB of archives.
After this operation, 0 B of additional disk space will be used.
Err http://tr.archive.ubuntu.com/ubuntu/ oneiric/main libdevmapper1.02.1 amd64 2:1.02.48-4ubuntu3
Temporary failure resolving 'tr.archive.ubuntu.com'
Failed to fetch http://tr.archive.ubuntu.com/ubuntu/pool/main/l/lvm2/libdevmapper1.02.1_1.02.48-4ubuntu3_amd64.deb Temp
 
3:48 PM
ping www.ubuntu.com?
 
PING www.ubuntu.com (91.189.90.40) 56(84) bytes of data.
64 bytes from avocado.canonical.com (91.189.90.40): icmp_req=1 ttl=53 time=63.4 ms
64 bytes from avocado.canonical.com (91.189.90.40): icmp_req=2 ttl=53 time=63.8 ms
 
hrm... ping tr.archive.ubuntu.com
 
PING ftp.linux.org.tr (193.140.100.100) 56(84) bytes of data.
64 bytes from ftp.linux.org.tr (193.140.100.100): icmp_req=1 ttl=55 time=28.1 ms
64 bytes from ftp.linux.org.tr (193.140.100.100): icmp_req=2 ttl=55 time=28.2 ms
 
hrm.. ok, retry the apt-get
 
same error
can't i use en.archive.ubuntu.com for example?
 
3:50 PM
you could, but there doesn't appear to be anything wrong with tr
 
opps
just a minute
 
that's really weird that apt says it can't resolve it, but ping has no trouble
 
there are 2 terminal windows opened recently. and one of them chrooted .
if i try to ping tr.archive.ubuntu.com with chrooted terminal
i'm getting unknown host tr.archive.ubuntu.com error
 
ahh
ok... cat /etc/resolve.conf in both terminals, the chrooted one is probably wrong
 
if i try pinging with normal (new) terminal screen
it's pinging with no errors
 
3:52 PM
err, just resolv.conf, no e
 
i can execute apt-get command in normal terminal ?
 
no
cat /etc/resolv.conf in both terminals
you probably just need to copy the correct one into the chroot
 
ok
(chrooted)
root@ubuntu:/# cat /etc/resolv.conf
# Generated by NetworkManager

(normal)
ubuntu@ubuntu:~$ cat /etc/resolv.conf
# Generated by NetworkManager
domain domain.name
search domain.name
nameserver 192.168.1.1
now i'm executing apt-get at chrooted terminal
(same error)
 
yea, the one in the chroot is empty... do this in the chroot:
echo nameserver 192.168.1.1 >> /etc/resolv.conf
then try apt-get again
 
root@ubuntu:/# echo nameserver 192.168.1.1 >> /etc/resolv.conf
root@ubuntu:/# apt-get install --reinstall libdevmapper1.02.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 6 not upgraded.
Need to get 70.0 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://tr.archive.ubuntu.com/ubuntu/ oneiric/main libdevmapper1.02.1 amd64 2:1.02.48-4ubuntu3 [70.0 kB]
 
3:58 PM
oh boy, looks like you have other libraries that have been replaced with the 32bit version as well
 
maybe i should remove libdevmapper and then install it again. reinstalling not working
 
looks like libbz2 is also 32 bit... not going to be able to do much without that working
I think at this point your system is so hosed up you're just going to have to reinstall
 
oh please :/ there are too many files, application for backup
 
did you recently restore a backup you made of a 32bit system?
 
i don't have 32 bit system
ubuntu and windows 64 bit
 
4:00 PM
did you in the past, and made a backup of it, and recently restored that backup?
 
opps sorry i misunderstood you.
no i don't restore
anything
i installed fresh 64bit ubuntu
no restore
 
I'm wondering how on earth you managed to get all of these libraries replaced with the 32 bit versions ;)
 
me, too
what happens if i reinstall libbz2 ?
apt-get install --reinstall libbz2 ?
 
you probably can't
probably get the same error
 
lets try :)
root@ubuntu:/# apt-get install --reinstall libbz2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libbz2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
bzip2:i386 bzip2

E: Package 'libbz2' has no installation candidate
there is a "i386" . It should be amd64 .
 
4:03 PM
the correct name of the package is bzip2
 
Can not write log, openpty() failed (/dev/pts not mounted?)
dpkg-deb: error while loading shared libraries: libbz2.so.1.0: wrong ELF class: ELFCLASS32
dpkg: error processing /var/cache/apt/archives/bzip2_1.0.5-6ubuntu1.11.10.1_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/bzip2_1.0.5-6ubuntu1.11.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
:))
 
err, my bad.. it's libbz2-1.0
 
Can not write log, openpty() failed (/dev/pts not mounted?)
dpkg-deb: error while loading shared libraries: libbz2.so.1.0: wrong ELF class: ELFCLASS32
dpkg: error processing /var/cache/apt/archives/libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
 
yea... catch-22
 
catch-22?
 
4:06 PM
you can't install the library without already having the library installed
 
--reinstall ?
 
I have an idea though... outside the chroot, try this: sudo dpkg --root=/mnt/ubusda3 -i /mnt/ubusda3/var/cache/apt/archives/libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb
 
root@ubuntu:/home/ubuntu# sudo dpkg --root=/mnt/ubusda3 -i /mnt/ubusda3/var/cache/apt/archives/libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb
(Reading database ... 196784 files and directories currently installed.)
Preparing to replace libbz2-1.0 1.0.5-6ubuntu1.11.10.1 (using .../libbz2-1.0_1.0.5-6ubuntu1.11.10.1_amd64.deb) ...
Unpacking replacement libbz2-1.0 ...
Setting up libbz2-1.0 (1.0.5-6ubuntu1.11.10.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@ubuntu:/home/ubuntu#
 
now try reinstalling the libdevmapper in the chroot
 
ok
no errors :))))))
 
4:11 PM
now hopefully there aren't any other broken libs
 
root@ubuntu:/home/ubuntu# chroot /mnt/ubusda3root@ubuntu:/# apt-get install --reinstall libdevmapper1.02.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 6 not upgraded.
Need to get 0 B/70.0 kB of archives.
After this operation, 0 B of additional disk space will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 196784 files and directories currently installed.)
 
now go back and try to repair grub
 
which way? with steps from this question : askubuntu.com/questions/88384/… ?
and last questions. Should i reinstall libbz2 , too?
 
you already did libbz2
you just used the copy of dpkg on the livecd to reinstall it to the hd, rather than using the copy of apt-get from the hd
( which couldn't work without libbz2 )
as long as there are no other libs that are broken, you should be good to go now
 
or other way ?
 
4:19 PM
yes
 
ok . In 4th step : for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done . But i mounted my hd to /mnt/ubusda3 not /mnt . So how should i this? Like this ? : for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/ubusda3$i"; done
 
yes
 
ok. i'll exit from chroot and then do these steps
just a minute please
root@ubuntu:/home/ubuntu# for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/ubusda3$i"; done
root@ubuntu:/home/ubuntu# sudo chroot /mnt/sda3
chroot: cannot change root directory to /mnt/sda3: No such file or directory
root@ubuntu:/home/ubuntu# sudo chroot /mnt/ubusda3
root@ubuntu:/# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-17-generic
Found initrd image: /boot/initrd.img-3.0.0-17-generic
Found linux image: /boot/vmlinuz-3.0.0-16-generic
Found initrd image: /boot/initrd.img-3.0.0-16-generic
i2ll try reinstall grub. grub-install
or is there any fix for mapdevfs error?
 
that is really weird... I have never heard of "mapdevfs"
but it doesn't look like it's a fatal error
 
so what do you think is it reinstalled ?
should i restart my system?
 
4:26 PM
yea
 
ok i'm restarting now :)
bad news
nothing changed
 
5:15 PM
hrm... it looks like mapdevfs is part of the installer... it shouldn't be installed on the hd
 
well?
 
in the chroot what does which mapdevfs show?
and apt-cache policy ubiquity
 
just a minute i'll boot with live cdand try it.
Ok how can i find which mapdecs show?
 
6:13 PM
run "which mapdecs"
err, mapdevfs
 
/dev/mapdevfs
Sorry
/bin/mapdevfs
 
weird... that shouldn't be in an installed system, only on the livecd
apt-get remove ubiquity
 
root@ubuntu:/# apt-get remove ubiquity
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ubiquity is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
root@ubuntu:/# apt-cache policy ubiquity
ubiquity:
Installed: (none)
Candidate: 2.8.7
Version table:
2.8.7 0
500 http://tr.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
i executed them on chrooted terminal
 
6:35 PM
that's weird.. dpkg -S /bin/mapdevfs
 
root@ubuntu:/# dpkg -S /bin/mapdevfs
dpkg-query: no path found matching pattern /bin/mapdevfs.
 
according to apt-file, that files comes from the ubiquity package
 
did you read my last message
 
I wonder if whatever you did to muck up your system with those 32 bit libs also involved copying that file without the package being installed... sudo rm /bin/mapdevfs
once you get rid of it, try update-grub again
 
ok i execute that command
root@ubuntu:/# update-grub
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
 
6:38 PM
did you forget to setup the bind mounts before chrooting in?
 
i just mount /dev/sda3 to /mnt/ubusda3 , directly
 
then you need the for loop with the mount --bind
 
ok good news
this time there isn't ay error
any*
root@ubuntu:/# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-17-generic
Found initrd image: /boot/initrd.img-3.0.0-17-generic
Found linux image: /boot/vmlinuz-3.0.0-16-generic
Found initrd image: /boot/initrd.img-3.0.0-16-generic
Found linux image: /boot/vmlinuz-3.0.0-12-generic
Found initrd image: /boot/initrd.img-3.0.0-12-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda4
done
root@ubuntu:/#
 
there you go
 
ok lets try. give me a few minutes please
Nothing changed booting Windows automatically
 
6:48 PM
then you must not have grub installed to sda
 
So? :)
 
so you need a grub-install
probably anyway.. if you run the bootinfo script it would tell for sure
 
I have Super Grub Disk (Rescatux) and Boot-Repair-Disk . I can use one of them
ok here results.txt
 
you appear to have installed syslinux to your mbr, so you need to reinstall grub
 
grub-install command
ok. firstly i'll mount sda3 and then execute that for loop. . and chroot. and then grub-install command
root@ubuntu:/# grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--boot-directory=DIR install GRUB images under the directory DIR/grub
instead of the /boot/grub directory
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
what should i type for install_device on chrooted terminal
?
 
7:37 PM
ohh, the instructions left out the argument... grub-install /dev/sda
 
/dev/sda ? or /dev/sda3
root@ubuntu:/# grub-install /dev/sda
Installation finished. No error reported.
 
just sda
that should do it
 
restarting...
Grub menu ok :) but ubuntu not opening im getting kernel panic error and capslock and scroll lock flashing.
 

  last day (24 days later) »