LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Gentoo (https://www.linuxquestions.org/questions/gentoo-87/)
-   -   unmerging linux-headers and broken system (https://www.linuxquestions.org/questions/gentoo-87/unmerging-linux-headers-and-broken-system-4175494646/)

fuorviato 02-12-2014 08:11 AM

unmerging linux-headers and broken system
 
First of all, I do admit I did a stupid thing :). Being a debian user, thought removing kernel-headers would have beeen harmless so I unmerged it.
As the result, I cannot emerge it again, not to speak about any other program I'd like to install. Basically, nothing emerges failing with the following:
I'd appreciate any help and promise I'll be a good user next time :]

Quote:

 * Package: sys-kernel/linux-headers-3.10
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE: abi_x86_32 elibc_glibc kernel_linux userland_GNU x86
 * FEATURES: preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking gentoo-headers-base-3.10.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Unpacking gentoo-headers-3.10-1.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Source unpacked in /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Preparing source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment: line 1226: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment: line 1226: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)
* Applying various patches (bugfixes/updates) ...
* 00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch ...
 [ ok ]
* 00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch ...
 [ ok ]
* 00_all_0003-Omnikey-Cardman-4000-pull-in-ioctl.h-in-user-header.patch ...
 [ ok ]
* 00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch ...
 [ ok ]
* 00_all_0005-netfilter-pull-in-limits.h.patch ...
 [ ok ]
* 00_all_0006-convert-PAGE_SIZE-usage.patch ...
 [ ok ]
* 00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch ...
 [ ok ]
* 00_all_0008-unifdef-drop-unused-errno.h-include.patch ...
 [ ok ]
* 00_all_0009-Btrfs-use-__u64-in-exported-user-headers.patch ...
 [ ok ]
* 00_all_0010-x86-make-stat-statfs-64-bit-for-x86_64-kernels.patch ...
 [ ok ]
* Done with patching
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
>>> Source compiled.
>>> Test phase [not enabled]: sys-kernel/linux-headers-3.10

>>> Install linux-headers-3.10 into /var/tmp/portage/sys-kernel/linux-headers-3.10/image/ category sys-kernel
make -j3 headers_install INSTALL_HDR_PATH=/var/tmp/portage/sys-kernel/linux-headers-3.10/image///usr/include/.. ARCH=x86 CROSS_COMPILE=i686-pc-linux-gnu-
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
WRAP arch/x86/include/generated/asm/clkdev.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
HOSTCC arch/x86/tools/relocs_32.o
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
HOSTCC arch/x86/tools/relocs_64.o
In file included from arch/x86/tools/relocs.h:10:0,
from arch/x86/tools/relocs_64.c:1:
/usr/include/errno.h:1:31: fatal error: asm-generic/errno.h: No such file or directory
compilation terminated.
In file included from arch/x86/tools/relocs.h:10:0,
from arch/x86/tools/relocs_32.c:1:
/usr/include/errno.h:1:31: fatal error: asm-generic/errno.h: No such file or directory
compilation terminated.
make[1]: *** [arch/x86/tools/relocs_64.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [arch/x86/tools/relocs_32.o] Error 1
make: *** [archscripts] Error 2
make: *** Waiting for unfinished jobs....
* ERROR: sys-kernel/linux-headers-3.10::gentoo failed (install phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=sys-kernel/linux-headers-3.10::gentoo'`,
* the complete build log and the output of `emerge -pqv '=sys-kernel/linux-headers-3.10::gentoo'`.
* The complete build log is located at '/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment'.
* Working directory: '/var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10'
* S: '/var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10'

i92guboj 02-13-2014 02:23 AM

Right,I guess you missed the big red warning when unmerging that ;)

In any case, don't worry. It's easy to get back from this one using a prebuilt package.

As I am typing from an x86 box I just packaged it with quickpkg, and uploaded it to my server. All you need to do is to download this into your root fs /.

Then tar xf it. After that, you should re-emerge linux-headers (first thing), to replace my hand-made package with a legitimate Gentoo one.

http://www.jesgue.es/files/gentoo-x8...aders-3.9.tbz2

By the way, you might be interested in adding this to your make.conf, so portage automatically builds packages at least for system packages. Those packages come in handy when you break something vital.

Code:

FEATURES="buildsyspkg"

syg00 02-13-2014 02:57 AM

So this would be right up there with unmerging python ?. Did that once, several years ago ....

i92guboj 02-13-2014 03:24 AM

Unmerging python is slightly worse, both practically and philosophically speaking. However, the worst thing is unmerging glibc and/or tar, that will require a livecd to recover.

fuorviato 02-13-2014 03:35 AM

Quote:

Originally Posted by i92guboj (Post 5116717)
Right,I guess you missed the big red warning when unmerging that ;)

In any case, don't worry. It's easy to get back from this one using a prebuilt package.

As I am typing from an x86 box I just packaged it with quickpkg, and uploaded it to my server. All you need to do is to download this into your root fs /.

Then tar xf it. After that, you should re-emerge linux-headers (first thing), to replace my hand-made package with a legitimate Gentoo one.

http://www.jesgue.es/files/gentoo-x8...aders-3.9.tbz2

By the way, you might be interested in adding this to your make.conf, so portage automatically builds packages at least for system packages. Those packages come in handy when you break something vital.

Code:

FEATURES="buildsyspkg"

Thanks for that :) I untared the usr folder to the root . However, I have no idea why but system seems to be really messed up. Look at the examples:

Quote:

emerge -av linux-headers-3.10
Fatal Python error: Failed to open /dev/urandom
Aborted
Gentoo-20121221 / # eselect python list
/usr/share/eselect/libs/core.bash: line 83: /dev/null: No such file or directory
!!! Error: Couldn't source /usr/share/eselect/libs/default.eselect
Call stack:
* do_action (core.bash:84)
* main (eselect:203)
exiting


/usr/share/eselect/libs/core.bash: line 83: /dev/null: No such file or directory
!!! Error: Couldn't source /usr/share/eselect/libs/default.eselect
Call stack:
* do_action (core.bash:84)
* es_do_list_modules (eselect:126)
* es_do_help (eselect:102)
* main (eselect:206)
exiting
Yesterday, I copied over the usr directory from the official stage3 to my system being convinced it will recover the missing headers. It seems, however that I've made it more messy than before.
Is there any way-out of this except for reinstalling the whole system?

i92guboj 02-13-2014 03:44 AM

Ugh, if you did that, then I am afraid that re-installing is the fastest way out of this problem.

The fact that there's not even a valid /dev/null means that your system is horribly broken. Note that by replacing your whole /usr with the one in the stage you probably downgraded glibc. That alone is enough to turn your system into a dead boulder.

fuorviato 02-13-2014 03:56 AM

Eh, I should have waited but to tell the truth I was quite sure gentoo user-experts would have just ignored me having realized my stupidity.
I've been switching to gentoo for a while being still a noob for some matters. All the same, I want to learn but hardly, there's a way to achieve unless making mistakes :)

Thanks for your support.

i92guboj 02-13-2014 04:11 AM

Quote:

Originally Posted by fuorviato (Post 5116749)
Eh, I should have waited but to tell the truth I was quite sure gentoo user-experts would have just ignored me having realized my stupidity.

Hey! we've all been there at some point, so, please, ask as much as you need, either here, at the Gentoo fora, the mailing lists, irc or wherever you feel more comfortable. Even "experts" commit mistakes from time to time ;)

Quote:

I've been switching to gentoo for a while being still a noob for some matters. All the same, I want to learn but hardly, there's a way to achieve unless making mistakes :)
That's the spirit. But next time, if you are in doubt just ask. Sometimes there's an easy way back, that is, until you give the definitive step that will make things horribly worse :)

Quote:

Thanks for your support.
You're very welcome.

Emerson 02-13-2014 04:40 AM

I really wonder what broke your system, linux-headers is a system package alright and you get a big fat warning when removing it. In actuality it is used to build glibc only and should not cause havoc, at least not instantly.
Anyhow, methinks for stable Gentoo binary packages can be downloaded from attic if need arises?

fuorviato 02-13-2014 05:22 AM

Quote:

Originally Posted by Emerson (Post 5116771)
I really wonder what broke your system, linux-headers is a system package alright and you get a big fat warning when removing it. In actuality it is used to build glibc only and should not cause havoc, at least not instantly.

And, infact - it works! I just rebooted, remounted all the partitions, mounted proc and dev and it was it.
I am still having the problem with linux-headers-3.10 but this time, the error is different and the compilation process seems to have gone few steps further. Am I right?

Quote:

[32;01m * Package: sys-kernel/linux-headers-3.10
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE: abi_x86_32 elibc_glibc kernel_linux userland_GNU x86
 * FEATURES: preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking gentoo-headers-base-3.10.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Unpacking gentoo-headers-3.10-1.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Source unpacked in /var/tmp/portage/sys-kernel/linux-headers-3.10/work
>>> Preparing source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment: line 1226: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment: line 1226: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)
* Applying various patches (bugfixes/updates) ...
* 00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch ...
 [ ok ]
* 00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch ...
 [ ok ]
* 00_all_0003-Omnikey-Cardman-4000-pull-in-ioctl.h-in-user-header.patch ...
 [ ok ]
* 00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch ...
 [ ok ]
* 00_all_0005-netfilter-pull-in-limits.h.patch ...
 [ ok ]
* 00_all_0006-convert-PAGE_SIZE-usage.patch ...
 [ ok ]
* 00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch ...
 [ ok ]
* 00_all_0008-unifdef-drop-unused-errno.h-include.patch ...
 [ ok ]
* 00_all_0009-Btrfs-use-__u64-in-exported-user-headers.patch ...
 [ ok ]
* 00_all_0010-x86-make-stat-statfs-64-bit-for-x86_64-kernels.patch ...
 [ ok ]
* Done with patching
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10 ...
>>> Source compiled.
>>> Test phase [not enabled]: sys-kernel/linux-headers-3.10

>>> Install linux-headers-3.10 into /var/tmp/portage/sys-kernel/linux-headers-3.10/image/ category sys-kernel
make -j3 headers_install INSTALL_HDR_PATH=/var/tmp/portage/sys-kernel/linux-headers-3.10/image///usr/include/.. ARCH=x86 CROSS_COMPILE=i686-pc-linux-gnu-
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
WRAP arch/x86/include/generated/asm/clkdev.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
HOSTCC arch/x86/tools/relocs_32.o
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
HOSTCC arch/x86/tools/relocs_64.o
In file included from arch/x86/tools/relocs_32.c:17:0:
arch/x86/tools/relocs.c: In function 'read_ehdr':In file included from arch/x86/tools/relocs_64.c:17:0:
arch/x86/tools/relocs.c: In function 'read_ehdr':
arch/x86/tools/relocs.c:334:13: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c:334:13: note: each undeclared identifier is reported only once for each function it appears in

arch/x86/tools/relocs.c:334:13: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c:334:13: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/tools/relocs.c: In function 'read_shdrs':
arch/x86/tools/relocs.c:398:27: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c: In function 'read_strtabs':
arch/x86/tools/relocs.c:436:35: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c: In function 'read_shdrs':
arch/x86/tools/relocs.c:398:27: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c: In function 'read_strtabs':arch/x86/tools/relocs.c: In function 'read_symtabs':
arch/x86/tools/relocs.c:436:35: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c: In function 'read_symtabs':
arch/x86/tools/relocs.c:461:35: error: 'errno' undeclared (first use in this function)

arch/x86/tools/relocs.c: In function 'read_relocs':
arch/x86/tools/relocs.c:494:35: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c:461:35: error: 'errno' undeclared (first use in this function)
arch/x86/tools/relocs.c: In function 'read_relocs':
arch/x86/tools/relocs.c:494:35: error: 'errno' undeclared (first use in this function)
make[1]: *** [arch/x86/tools/relocs_32.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [arch/x86/tools/relocs_64.o] Error 1
make: *** [archscripts] Error 2
make: *** Waiting for unfinished jobs....
* ERROR: sys-kernel/linux-headers-3.10::gentoo failed (install phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=sys-kernel/linux-headers-3.10::gentoo'`,
* the complete build log and the output of `emerge -pqv '=sys-kernel/linux-headers-3.10::gentoo'`.
* The complete build log is located at '/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-kernel/linux-headers-3.10/temp/environment'.
* Working directory: '/var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10'
* S: '/var/tmp/portage/sys-kernel/linux-headers-3.10/work/gentoo-headers-base-3.10'
.

i92guboj 02-13-2014 07:06 AM

Your system is broken.

The first errors (the ones about your locales) are probably easily fixable by re-editing /etc/locale.gen (if needed, just to make sure it's ok), and then running "locale-gen" as root.

You must make sure that you generate the locales that portage is complaining about (en_US.UTF-8).

But the rest of errors about undefined symbols and that stuff is probably due to your toolchain being completely broken, which, as I said, is to be expected when your system binaries have been built against a toolchain that you abruptly overwrote with another one.

If you truly want to recover from this, as a learning exercise, you can look into the [url=http://tinderbox.dev.gentoo.org/]gentoo tinderbox[/u], which has prebuilt binaries for the most critical packages. You might be able to do something using those, you'll need to restore portage, glibc, gcc, binutils, coreutils, sandbox, libtool, python and probably some others.

The x86 branch is here:

http://tinderbox.dev.gentoo.org/default-linux/x86/

You can put the packages in /usr/portage/packages and use emerge -K to force installation via binary packages. Or, if that doesn't work, just use tar as before (your system can't possibly go any worse, so...).

If you get to the point where you can use "eselect" to pick the new binary toolchain, and then "emerge -e system" then that's a good start.

fuorviato 02-13-2014 08:56 AM

Quote:

You can put the packages in /usr/portage/packages and use emerge -K to force installation via binary packages. Or, if that doesn't work, just use tar as before (your system can't possibly go any worse, so...).

If you get to the point where you can use "eselect" to pick the new binary toolchain, and then "emerge -e system" then that's a good start.
OK. I will give it a try in next days when I get more free time. As you said - it can't go any worse :).
Stay tuned for more ;)

fuorviato 02-17-2014 05:34 AM

Quote:

If you truly want to recover from this, as a learning exercise, you can look into the [url=http://tinderbox.dev.gentoo.org/]gentoo tinderbox[/u], which has prebuilt binaries for the most critical packages. You might be able to do something using those, you'll need to restore portage, glibc, gcc, binutils, coreutils, sandbox, libtool, python and probably some others.

The x86 branch is here:

http://tinderbox.dev.gentoo.org/default-linux/x86/

You can put the packages in /usr/portage/packages and use emerge -K to force installation via binary packages. Or, if that doesn't work, just use tar as before (your system can't possibly go any worse, so...).
I downloaded portage binary file from tinderbox, created /usr/portage/rescue dir to have all the system binaries stored.
When I emerge
Quote:

Gentoo-20121221 rescue # emerge -K portage-2.2.7.tbz2
I'm getting

Quote:

*** emerging by path is broken and may not always work!!!
*** You need to adjust PKGDIR to emerge this package.
I adjusted, the PKGDIR variable to
Quote:

PKGDIR="${PORTDIR}/packages/rescue"
so it should be good to go.
What am I missing?

i92guboj 02-17-2014 05:40 AM

You just

Code:

emerge -K "=portage-2.2.7"

fuorviato 02-17-2014 05:59 AM

Quote:

emerge -K "=portage-2.2.7"

* IMPORTANT: 5 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.

Calculating dependencies... done!

emerge: there are no ebuilds to satisfy "=portage-2.2.7".

I've also tried untaring. 2 dirs /usr and /etc extract from the archive. Should I copy them over?
I'm afraid, I'm stopping understanding what I am doing.


All times are GMT -5. The time now is 03:26 AM.