Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
My system is in big trouble. I removed glibc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Sun Feb 22, 2015 4:09 pm    Post subject: My system is in big trouble. I removed glibc Reply with quote

I was trying to clean up my system and remove masked packages. I KNOW I KNOW. I screwed up.
So I removed glibc (not smart) and I was going to reinstall it .

Can I boot to a previous kernel and save my system?

I am currenly logged in as root and as a normal user.
I can not su - from a normal user.


Here is my group information:

Code:

cwc@azzerare ~ $ groups
0 5 10 14 18 19 20 21 27 80 81 100 102 194 196 985 1001

azzerare ~ # groups
0 1 2 3 4 10 11 20 26 27


Here is what happens when I try to re-install portage and glibc
azzerare ~ # emerge 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.

Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-apps/portage-2.2.14::gentoo
 * portage-2.2.14.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...                                                            [ ok ]
chgrp: invalid group: ‘portage’

azzerare ~ # emerge  glibc
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.


_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Sun Feb 22, 2015 4:24 pm    Post subject: Reply with quote

cwc,

If you have not rebooted, the bits in memery are still there. If you reboot, it will fail as almost eveything needs glibc. e.g. bash.
The easiest way to fix it is to get a binary tarball of the correct glibc from a trusted source and untar it to your root filesystem.

If you use FEATURES=buildpkg, you already have a suitable binary.

You can't start new programs that need glibc so you will need to use a statically built busybox, or reboot using a liveCD.
chrooting won't work ... no bash.

If you need a binhost, try http://packages.gentooexperimental.org/packages/
Do not downgrade glibc accidently.

If you need more details post back.

Oh many years ago emerge --depclean did this to me :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Sun Feb 22, 2015 4:44 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cwc,

If you have not rebooted, the bits in memery are still there. If you reboot, it will fail as almost eveything needs glibc. e.g. bash.
The easiest way to fix it is to get a binary tarball of the correct glibc from a trusted source and untar it to your root filesystem.

If you use FEATURES=buildpkg, you already have a suitable binary.

You can't start new programs that need glibc so you will need to use a statically built busybox, or reboot using a liveCD.
chrooting won't work ... no bash.

If you need a binhost, try http://packages.gentooexperimental.org/packages/
Do not downgrade glibc accidently.

If you need more details post back.

Oh many years ago emerge --depclean did this to me :)


Thank you Neddy, So the question is:
Do I back up and reinstall or try to fix the system.

I had a maksed version of glibc installed. glibc-2.20-r2.tbz2
http://packages.gentooexperimental.org/packages/amd64-unstable/sys-libs/

I think I'd like to reinstall. Is there a way I can resintall the system using the system rc cd and preserve my data?
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Sun Feb 22, 2015 4:58 pm    Post subject: Reply with quote

cwc,

Reboot using live media,
Mount your gentoo at /mnt/gentoo as if you were going to chroot.
Fetch your glibc from gentooexperimental.org to say /tmp
Now treat it as a single package stage3
Code:
tar -xpf /tmp/glibc-2.20-r2.tbz2 -C /mnt/gentoo

Ignore the warning about extra garbage ignored. Thats some portage data appended to the tarball.

Reboot into your system normally.
Rebuild glibc for yourself, so you get your USE flags.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Sun Feb 22, 2015 5:11 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cwc,

Reboot using live media,
Mount your gentoo at /mnt/gentoo as if you were going to chroot.
Fetch your glibc from gentooexperimental.org to say /tmp
Now treat it as a single package stage3
Code:
tar -xpf /tmp/glibc-2.20-r2.tbz2 -C /mnt/gentoo

Ignore the warning about extra garbage ignored. Thats some portage data appended to the tarball.

Reboot into your system normally.
Rebuild glibc for yourself, so you get your USE flags.


will do . thank you.

I'll report back in a day or two. Work calls.
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Wed Feb 25, 2015 1:02 pm    Post subject: I've decided to rebuild my system Reply with quote

Please throw me a bone if I forgot anything. Thanks wise one!

I got thing to work on my system. But I'd like to rebuild the os from scratch again.
Thanks for the help. This system has been running for a few years. 3 or 4.

- I will use the systemRC CD or usb to install the system.
And use this guide: https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation

I will get a new hard drive 500 GB then my back drives ate 2x1tb.

I'd like to post my check list of files to keep for reference:

1. /etc/make.conf
2. /usr/portage/ package.use files package.mask package.use package.keywords package.unmask
3. /etc/fstab
4. /etc/conf.d/net


azzerare conf.d # more net
#cwc new 140119
dns_domain_lo="azzerare"
config_eth0="192.168.1.14/24"
config_eth0="192.168.1.14 netmask 255.255.255.0"
dns_servers_eth0="192.168.1.1"
routes_eth0="default via 192.168.1.1"
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Wed Feb 25, 2015 8:06 pm    Post subject: Reply with quote

cwc,

For a rebuild, thats a lot of work.

If you really want a rebuild, this is in place.
Code:
emerge --sync
cd /usr/portage
scripts/bootstrap.sh

Thats the stage1 part of a stage1 install.
Use gcc-config to select a new gcc, in case you have one.
Code:
emerge -e @system --with-bdeps=y
emerge -e @world --with-bdeps=y
emerge -p --depclean
etc-update

Run emerge --depclean once you think its safe.

To build on a new drive, copy over /etclportage, /usr/portage if you want to. You could leave it on the old drive and mount it in the new install.
Copy over /var/lib/portage/world, which is the list of pacages you have installed.

/etc/make.conf is depreciated. Move it to /etc/portage/make.conf
/etc/fstab may need serious surgery, depending on your setup
/etc/conf.d/net will need changes if you use a static IP
/etc/resolv.conf is handy for networking in the chroot.

With the world file preserved, get into the chroot and do
Code:
emerge -e @world --with-bdeps=y

This will rebuild all the packages in your world file and everything they depend on.

There is a lot of other usuful things to preserve too. /home
/etc/group
/etc/passwd
/etc/shadow
/etc/ssh

It all depends on the details of your new install.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Thu Feb 26, 2015 12:07 am    Post subject: Reply with quote

Epic post. Good to know about make.conf
Thank you Neddy

I'm going to to do both just for fun.
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 318

PostPosted: Thu Feb 26, 2015 12:24 am    Post subject: Reply with quote

Nice post NeddySeagoon 8)

I'd take a copy of
/etc the whole tree
/usr/src/linux/.config
/home or wherever else you keep user data
/var/lib/portage/world so you have a list of whats installed
and /usr/local/portage or wherever else you have local overlay information

... other stuff is install specific
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Sat Feb 28, 2015 2:35 am    Post subject: Reply with quote

jonathan183 wrote:
Nice post NeddySeagoon 8)

I'd take a copy of
/etc the whole tree
/usr/src/linux/.config
/home or wherever else you keep user data
/var/lib/portage/world so you have a list of whats installed
and /usr/local/portage or wherever else you have local overlay information

... other stuff is install specific


thank you! got it copied.
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1281
Location: Tri-Cities, WA USA

PostPosted: Fri Mar 06, 2015 5:11 am    Post subject: Reply with quote

Neddy,

This did the trick. "tar -xpf /tmp/glibc-2.20-r2.tbz2 -C /mnt/gentoo"
After I chroot my system from the sys-rescue-cd.
I'll stick with this system. It's too old.

I think I'll find some parts and build another gentoo box rather than fix this one.

Now for a lesson:

What exactly does this do:
tar -xpf /tmp/glibc-2.20-r2.tbz2 -C /mnt/gentoo"

-x = extract
-p = preserve (? the location)
-f = (? file)

what does the -C do?

Thanks again.
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Fri Mar 06, 2015 9:35 pm    Post subject: Reply with quote

cwc,

-p is preserve permissions on the extracted file(s)

-C is Change dir so the unpacked files go into /mnt/gentoo regardless oy your current dir.
The default is to unpack to ./

Code:
man tar

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum