You are not logged in.

#1 2012-05-31 17:45:54

konos5
Member
Registered: 2011-03-16
Posts: 56

How to re-install glibc? [SOLVED]

Hi everyone,

In my effort to upgrade to the new pacman 4.0, I accidentally uninstalled glibc from my system.
As a result I not cannot even run the sudo command or ls my current working directory.

Is there any way to fix this?

Last edited by konos5 (2012-06-02 13:50:09)

Offline

#2 2012-05-31 18:38:43

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: How to re-install glibc? [SOLVED]

boot a livemedia (such as an install cd/usb). then mount your drives and use pacman with the --root command to install glibc.

Offline

#3 2012-05-31 18:45:18

konos5
Member
Registered: 2011-03-16
Posts: 56

Re: How to re-install glibc? [SOLVED]

Could you be a tad more specific?

Apart from booting into the livecd, I totally lost you.
Which exact drive do I have to mount and how should I do it? Does it have anything to do with chroot?
Could also give the full syntax of the root command?

Sorry for asking spoonfeeding. I am pretty new to linux.

Offline

#4 2012-05-31 19:27:52

Avant-texte
Member
Registered: 2012-02-13
Posts: 136

Re: How to re-install glibc? [SOLVED]

konos5 wrote:

Apart from booting into the livecd, I totally lost you.
Which exact drive do I have to mount and how should I do it? Does it have anything to do with chroot?

No. If you chroot, you'll be back in the "I need this lib, but to get it I need it first" catch 22. Chrooting helps if you have a loggin issue, as it will completely bypass that.

Using a live Arch disk/stick, boot your machine. Then you mount the partition (of the proper drive if you have multiple) containing your system's root. If you have important parts of your filesystem (i.e. not /home or /boot in this case) spread across multiple partitions and/or drives, you will need to mount all of them into the propper places. If you're not sure about this, check your system's fstab.

Once you have your machine's filesystem mounted onto the live filesystem --lets say at /mnt, you can use pacman from the live disk/stick to fix you system. The key to making this happen is to tell pacman to pretend the root of its filesystem is somewhere else, /mnt in this case.

The pacman man page wrote:

       -r, --root <path>
           Specify an alternative installation root (default is /). This
           should not be used as a way to install software into /usr/local
           instead of /usr. This option is used if you want to install a
           package on a temporary mounted partition that is "owned" by another
           system.  NOTE: if database path or logfile are not specified on
           either the command line or in pacman.conf(5), their default
           location will be inside this root path.

Offline

#5 2012-05-31 19:38:17

Avant-texte
Member
Registered: 2012-02-13
Posts: 136

Re: How to re-install glibc? [SOLVED]

tomegun wrote:

boot a livemedia (such as an install cd/usb). then mount your drives and use pacman with the --root command to install glibc.

konos5 wrote:

Could you be a tad more specific?
...
Sorry for asking spoonfeeding. I am pretty new to linux.

For future reference, if someone mentions a command or an option thereof that you don't know, you can check its man page to learn what s/he's talking about.

$ man [command-name]

Will show you the local manual install with a package if it's  there.

[b]/[/b][some-search-term]

A good way to search for a specific word or phrase while looking at a file in man, less, vim, etc if you know what you're looking for.

Offline

#6 2012-05-31 22:09:01

konos5
Member
Registered: 2011-03-16
Posts: 56

Re: How to re-install glibc? [SOLVED]

Thank you for your quick responses.
I just did what you suggested but still experiencing some issues.

1) I booted up using a live Arch CD.
2) Located my drives (fdisk -l).
3) Created a new mount directory and mounted my system's root like below:

 mount /dev/sda1 /root/myDisk 

4) Downloaded the glibc-2.15-10-x86_64.pkg.tar.xz file into a USB stick which I also mounted and copied over to my new temporary local filesystem

5) Finally I did (using the directory where the glibc package is currently stored):

 pacman -U glibc-2.15-10-x86_64.pkg.tar.xz -r /root/myDisk 

...only to get this

error: problem setting dbpath '/root/myDisk/var/lib/pacman/' (couldn't find or read directory)' 

Any ideas?

Offline

#7 2012-05-31 23:24:17

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: How to re-install glibc? [SOLVED]

Does /root/myDisk/var/lib/pacman/ exist? If not it probably mean you have /var on a separate partition and need to mount it (to /root/myDisk/var).

Offline

#8 2012-06-01 18:02:48

konos5
Member
Registered: 2011-03-16
Posts: 56

Re: How to re-install glibc? [SOLVED]

OK...
Done as you suggested and mounted the /var partition which happened to reside on sda2.

I then managed to reinstall glibc 2.15 which was already stored on /var/cache/pacman/pkg
using the following command:

  pacman -U glibc-2.15-10-x86_64.pkg.tar.xz -r /root/myDisk 

However the system complained about not using the proper headers which I also installed from /var/cache/pacman/pkg using the same command.

And here comes the best part;
After I rebooted the system I got the following:

...
Decompressing Linux...Parsing ELF...done
Booting the kernel.
::Starting udevd...
done.
::Running Hook [udev]
::Triggering uevents...done.
switch_root: Failed to execute /sbin/init: No such file or directory

[2.744746] kernel panic - not syncing: Attempted to kill init!
[2.744779] Pid: 1, comm: switch_root Not tainted 3.1.5-1-ARCH #1
[2.744809] Call Trace:
...

I suspect that init cannot start because something might have gone wrong with the reinstallation of glibc...

Any ideas?

Offline

#9 2012-06-02 13:49:31

konos5
Member
Registered: 2011-03-16
Posts: 56

Re: How to re-install glibc? [SOLVED]

Hi,

I finally managed to solve the problem. I just had to do

rm /usr/bin/tzselect /usr/sbin/zdump /usr/sbin/zic

before reinstalling glibc.
After that the system booted up normally and I was up and running again!

Thank you all for your time.

Offline

Board footer

Powered by FluxBB