Jump to content
Forums in Read-Only Mode - Please use Reddit ×
  • 0

removed glibc how do I reinstall it?


biocyberman

Question

Found the "wrong" version of glibc installed (version 2.26-r6) which does not have xlocale.h. I was ignorant to remove glibc because I did not see any way to downgrade to version 2.25-r11. Now portage does not work, all vital system commands stop working:

id
uid=1000 gid=1000 groups=1000,10,27,35,100,106,993,994

sudo su
sudo: unknown uid 1000: who are you?

wget from root terminal fails: 

/tmp/portage-2.3.8 # /tmp/portage-2.3.8/bin/emerge -1k sys-apps/portage
!!! Repository name or alias 'gentoo', defined for repository 'core-kit', overrides existing alias or repository.
!!! Repository 'gentoo' is missing masters attribute in '/usr/portage/metadata/layout.conf'
!!! Set 'masters = core-kit' in this file for future compatibility
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

WARNING: One or more repositories have missing repo_name entries:

	/usr/portage/profiles/repo_name

NOTE: Each repo_name entry should be a plain text file containing a
unique name for the repository on the first line.


Calculating dependencies... done!

!!! The following installed packages are masked:
- app-emulation/wine-2.3::gentoo (masked by: package.mask)
/var/git/meta-repo/kits/core-kit/profiles/package.mask/00-gentoo:
# Michał Górny <mgorny@gentoo.org> (28 Nov 2017)
# Replaced by split packages. Please install one of:
# - app-emulation/wine-vanilla (the only choice for stable)
# - app-emulation/wine-staging
# - app-emulation/wine-d3d9
# - app-emulation/wine-any
# For more information, please read the news item:
# https://www.gentoo.org/support/news-items/2017-04-10-split-and-slotted-wine.html
# If you really need the old ebuilds, you can use the 'wine' repository.
# Removal in 30 days.

For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.


>>> Verifying ebuild manifests

>>> Emerging (1 of 3) dev-lang/python-3.4.6-r1::python-kit
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log
>>> Downloading 'http://distfiles.gentoo.org/distfiles/Python-3.4.6.tar.xz'
--2018-04-27 13:45:55--  http://distfiles.gentoo.org/distfiles/Python-3.4.6.tar.xz
Resolving distfiles.gentoo.org... failed: Device or resource busy.
wget: unable to resolve host address ‘distfiles.gentoo.org’
>>> Downloading 'http://www.python.org/ftp/python/3.4.6/Python-3.4.6.tar.xz'
--2018-04-27 13:45:55--  http://www.python.org/ftp/python/3.4.6/Python-3.4.6.tar.xz
Resolving www.python.org... failed: Device or resource busy.
wget: unable to resolve host address ‘www.python.org’
!!! Couldn't download 'Python-3.4.6.tar.xz'. Aborting.
 * Fetch failed for 'dev-lang/python-3.4.6-r1', Log file:
 *  '/var/tmp/portage/dev-lang/python-3.4.6-r1/temp/build.log'

>>> Failed to emerge dev-lang/python-3.4.6-r1, Log file:

>>>  '/var/tmp/portage/dev-lang/python-3.4.6-r1/temp/build.log'

 * Messages for package dev-lang/python-3.4.6-r1:

 * Fetch failed for 'dev-lang/python-3.4.6-r1', Log file:
 *  '/var/tmp/portage/dev-lang/python-3.4.6-r1/temp/build.log'

My question is,  how do I rescue this system? I posting from this broken computer because it has not been rebooted since the incident. 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

This is working: 

1. Downloaded the latest stage3 file of the same characteristics as the stage3 I used to install funtoo. 

2. Create a dir: /root/2018stage3

3. Cd to the dir: cd /root/2018stag3/ and save the latest stage3 there. 

4. Untar: tar xpf lateststage3.tag.xz. Waring for future readers: Untar the stage3 directly to root file system cause you to lose all customized files  in /etc (including passwd, group) and also list of installed packages. Be careful not to make this mistake. 

5. Follow the "Chroot into Funtoo" section in this guide: https://www.funtoo.org/Install

Quote

Chroot into Funtoo

Before chrooting, there are a few things that need to be done to set up the chroot environment. You will need to mount /proc, /sys and /dev inside your new system. Use the following commands to do so:


# cd /mnt/funtoo
# mount -t proc none proc
# mount --rbind /sys sys
# mount --bind /dev dev # needs read/write bind for glibc compilation later.

You'll also want to copy over resolv.conf in order to have proper resolution of Internet hostnames from inside the chroot:


# cp /etc/resolv.conf /mnt/funtoo/etc/

Now you can chroot into your new system. Use env before chroot to ensure that no environment settings from the installation media are pulled in to your new system:


# env -i HOME=/root TERM=$TERM /bin/chroot . bash -l
It's also a good idea to change the default command prompt while inside the chroot. This will avoid confusion if you have to change terminals. Use this command:

# export PS1="(chroot) $PS1"

Test internet name resolution from within the chroot:


# ping -c 5 google.com

Now I have a working basic chroot environment similar to my Funtoo . I can use this to mimic the broken Funtoo and create compatible packages for it.  I am now following the upgrade process following this guide: 

 

After that I will create binary package to install on the broken system. It's a long workaround but still faster than reinstalling from scratch.

Link to comment
Share on other sites

  • 0

More log:

/usr/portage/distfiles # /tmp/portage-2.3.8/bin/emerge -1k glibc
!!! Repository name or alias 'gentoo', defined for repository 'core-kit', overrides existing alias or repository.
!!! Repository 'gentoo' is missing masters attribute in '/usr/portage/metadata/layout.conf'
!!! Set 'masters = core-kit' in this file for future compatibility
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

WARNING: One or more repositories have missing repo_name entries:

	/usr/portage/profiles/repo_name

NOTE: Each repo_name entry should be a plain text file containing a
unique name for the repository on the first line.


Calculating dependencies... done!

>>> Verifying ebuild manifests
>>> Running pre-merge checks for sys-libs/glibc-2.26-r6
chgrp: invalid group: ‘portage’
chgrp: invalid group: ‘portage’
chgrp: invalid group: ‘portage’
chgrp: invalid group: ‘portage’
chgrp: invalid group: ‘portage’
chgrp: invalid group: ‘portage’
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

make -j5 -s glibc-test 
glibc-test.c:1:17: fatal error: pwd.h: No such file or directory
 #include <pwd.h>
                 ^
compilation terminated.
make: *** [<builtin>: glibc-test] Error 1
emake failed
 * Simple build failed ... assuming this is desired #324685
make -j5 -s glibc-test 
glibc-test.c:1:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
make: *** [<builtin>: glibc-test] Error 1
emake failed
 * Simple build failed ... assuming this is desired #324685
/var/git/meta-repo/kits/core-kit/sys-libs/glibc/glibc-2.26-r6.ebuild: line 166: tc-enables-pie: command not found
 * PIE hardening not applied, as your compiler doesn't default to PIE
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

chgrp: invalid group: ‘portage’
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.


>>> Emerging (1 of 1) sys-libs/glibc-2.26-r6::core-kit
>>> Downloading 'http://distfiles.gentoo.org/distfiles/glibc-2.26.tar.xz'
--2018-04-27 14:12:04--  http://distfiles.gentoo.org/distfiles/glibc-2.26.tar.xz
Resolving distfiles.gentoo.org... failed: Device or resource busy.
wget: unable to resolve host address ‘distfiles.gentoo.org’
>>> Downloading 'http://ftpmirror.gnu.org/glibc/glibc-2.26.tar.xz'
--2018-04-27 14:12:04--  http://ftpmirror.gnu.org/glibc/glibc-2.26.tar.xz
Resolving ftpmirror.gnu.org... failed: Device or resource busy.
wget: unable to resolve host address ‘ftpmirror.gnu.org’
>>> Downloading 'http://ftp.gnu.org/gnu/glibc/glibc-2.26.tar.xz'
--2018-04-27 14:12:04--  http://ftp.gnu.org/gnu/glibc/glibc-2.26.tar.xz
Resolving ftp.gnu.org... failed: Device or resource busy.
wget: unable to resolve host address ‘ftp.gnu.org’
!!! Couldn't download 'glibc-2.26.tar.xz'. Aborting.
 * Fetch failed for 'sys-libs/glibc-2.26-r6', Log file:
 *  '/var/tmp/portage/sys-libs/glibc-2.26-r6/temp/build.log'

>>> Failed to emerge sys-libs/glibc-2.26-r6, Log file:

>>>  '/var/tmp/portage/sys-libs/glibc-2.26-r6/temp/build.log'

 * Messages for package sys-libs/glibc-2.26-r6:

 * Simple build failed ... assuming this is desired #324685
 * Simple build failed ... assuming this is desired #324685
 * PIE hardening not applied, as your compiler doesn't default to PIE

 * Messages for package sys-libs/glibc-2.26-r6:

 * Fetch failed for 'sys-libs/glibc-2.26-r6', Log file:
 *  '/var/tmp/portage/sys-libs/glibc-2.26-r6/temp/build.log'

 

Link to comment
Share on other sites

  • 0
4 hours ago, palica said:

@biocyberman, yes you have learned the hard way that glibc is one of the essential libraries on linux system.

try following https://www.funtoo.org/System_resurrection

 

 

Yeah, it went like this: I feel stomachache. What's inside, why is it causing pain? Stab, grab, pull.... Hey I pulled off my gut, what do I do?

I was also reading this https://wiki.gentoo.org/wiki/Fix_My_Gentoo and I am inclined to do follow it rather than the Funtoo's guide. This is a dead end:

 

# cd /tmp
# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
# tar -xJf Python-3.6.1.tar.xz
# cd Python-3.6.1
# ./configure --enable-shared --with-fpectl --with-system-expat --with-system-ffi
# make

make is complaining that it can't find crt1.o file. 

Link to comment
Share on other sites

×
×
  • Create New...