# Configuring Gentoo 2004.2 for linux 2.6 and NPTL (Updated)

## Snooper

This guide is intended to help those wanting to build a Gentoo system using the NPTL and a 2.6 kernel.

Getting started:

You will need a Gentoo 2004.2 LiveCD, and an internet connection.

Installing Gentoo Linux:

With your LiveCD burned to a disk and your Bios configured to boot from CD go head and restart your PC.

Refer to the Gentoo Hanbook for more information about obtaining and burning a Gentoo 2004.2 LiveCD.

Now boot from the LiveCD and type smp at the boot prompt.

```
boot: smp
```

smp is a 2.6 kernel that will allow proc to be populated with information from a running 2.6 kernel rather than a 2.4 kernel like gentoo.

Refer to the Gentoo Handbook for options passable to the kernel during boot.

Check to ensure your PC has the correct time.

```
date
```

Preparing your hard drive for Gentoo Linux:

In this guide i will use fdisk to partition my hard drive.

```
fdisk /dev/hda
```

You will need atleast a / (root) and swap partition.

Create filesystems and mount partitions.

```
mke2fs /dev/hda1

mke2fs -j /dev/hda5

mkswap /dev/hda6

swapon /dev/hda6

mount /dev/hda5 /mnt/gentoo

mkdir /mnt/gentoo/boot

mount /dev/hda1 /mnt/gentoo/boot
```

It is important that you have booted using the smp kernel at this point in order for glibc to be compiled with NPTL support the kernel loaded must support it ie: 2.6

Installing the Gentoo Installation Files:

Change to the /mnt/gentoo directory.

```
cd /mnt/gentoo
```

Use links to download a stage1 tarball from a gentoo mirror.

```
links http://www.gentoo.org/main/en/mirrors.xml
```

You must have networking configured and enabled.

After downloading the stage1 tarball extract it.

```
tar -xvjpf stage?-*.tar.bz2 && rm stage?-*.tar.bz2
```

Mounting the proc filesystem.

```
mount -t proc none /mnt/gentoo/proc
```

Configuring make.conf.

```
nano -w /mnt/gentoo/etc/make.conf
```

Included as an example:

```
CHOST="i686-pc-linux-gnu"

CFLAGS="-O2 -march=athlon-xp -pipe"

CXXFLAGS="${CFLAGS}"

USE="nptl"
```

Installing the Gentoo Base System 

Optional

Selecting mirrors.

```
mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf
```

This command will populate GENTOO_MIRRORS in make.conf.

Copy DNS info.

```
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
```

Before we chroot into the new Gentoo environment you may want to run passwd to change the root password so it is possible to log into another vt.

Chrooting into the new Gentoo environment.

```
chroot /mnt/gentoo /bin/bash

env-update && source /etc/profile
```

Syncing the portage tree.

```
emerge sync
```

Installing the 2.6 kernel headers.

```
emerge -C linux-headers

emerge --nodeps linux26-headers
```

Bootstrapping the system.

```
cd /usr/portage

scripts/bootstrap.sh && env-update && source /etc/profile
```

To check if NPTL support was compiled into glibc type: /lib/libc.so.6 you should see NTPL in the output.

Building the base system.

```
emerge system && env-update && source /etc/profile
```

Configuring the Kernel

Configure timezone.

```
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
```

Remember to use your own timezone!

Selecting and configuring a kernel:

```
emerge gentoo-dev-sources
```

Refer to the Gentoo Handbook for other 2.6 kernels available and howto configure and install them.

Optional:

Installing udev.

```
emerge udev
```

Installing hotplug.

```
emerge hotplug && rc-update add hotplug default
```

Installing alsa.

```
emerge alsa-utils && nano -w /etc/modules.d/alsa && modules-update && rc-update add alsasound boot
```

Refer to the ALSA Handbook for further information on configuring a sound card.

Configuring your System:

Refer to the Gentoo Handbook on editing fstab, rc.conf, and network configuration files.

Installing Necessary System Tools

Install a system logger.

```
emerge metalog && rc-update add metalog default
```

Install a cron daemon.

```
emerge vixie-cron && rc-update add vixie-cron default
```

Optional

Installing gentoolkit.

```
emerge gentoolkit
```

Contains tools for working with portage.

Configuring the Bootloader:

Installing grub.

```
emerge grub
```

Refer to the Gentoo Handbook on configuring grub.

Finishing up:

Setting a root password.

```
passwd
```

Creating a user.

```
useradd username -m -G users,wheel,audio,tty -s /bin/bash

passwd username
```

You can now safely exit and restart your PC and boot into your new Gentoo installation.

```
exit

cd /

umount /mnt/gentoo/boot

umount /mnt/gentoo/proc

umount /mnt/gentoo

reboot
```

Last edited by Snooper on Fri Oct 15, 2004 12:56 am; edited 26 times in total

----------

## Snooper

To compile xorg-x11 you must first edit the ebuild and remove the following code:

/usr/portage/x11-base/xorg-x11/xorg-x11-6.7.0.ebuild

# Makes ld bail at link time on undefined symbols

# Suggested by Mike Harris <mharris@redhat.com>

echo "#define SharedLibraryLoadFlags  -shared -Wl,-z,defs" \

>> config/cf/host.def

this line makes xorg bomb out at XF86Rush. from what i can gather it's an issue with the new binutils 2.15 and up.

then just run:

emerge xorg-x11

and enjoy!

----------

## Snooper

While running the smp kernel from the livecd i had some issues with keycodes i am using a microsoft wireless multimedia keyboard and to get rid of those just type:

setkeycodes ### ## for me it was setkeycodes e001 81 at some point i need to figure out how to fix this and add them to the keymap. both of the numbers should show the first with the error and the second above the error in the form of 0x81 or what ever for the key...

----------

## ian!

Moved from 'IG' to 'DT&T'.

----------

## StringCheesian

 *Snooper wrote:*   

> once you have finished downloading a stage1 tarball we need to extract it:
> 
> tar -xvjpf stage?-*.tar.bz
> 
> you can delete the tarball after it has been extracted:
> ...

 

Not that it matters (it wouldn't really confuse anybody here anyway), but I think those .bz's are supposed to be .bz2's.

----------

## TenPin

Why is it necessary to emerge alsa-oss if you are running a 2.6.5 kernel which includes the alsa-oss kernel module ?

----------

## Snooper

i was going off the alsa configuration guide when i installed alsa-oss i can remove it if it really isn't needed i have nore heard otherwise doubt it hurts anything being there though?

----------

## dotme

Followed your HOWTO to replace my old rh8-installation.

Unfortunately binutils-2.15* got masked this night. Exactly at the moment when I were advancing from bootstrapping to 'emerge system'.  I noticed that binutils get downgraded in the output of 'emerge --pretend system',  but didn't realized the drawback:

  ld's cmd switch '--as-needed'  no longer exists

and breaks gcc  (gcc conftest.c - ld error).

Think I have to start again.

----------

## Snooper

Yes if you bootstrap one version and you try to downgrade to another version it breaks binutils. i'm sure they masked it because of xorg-x11.

if you just start again and bootstrap it will use the other binutils and you should be fine. if it's 2.14 you don't need to edit the xorg-x11 ebuild.

----------

## BlackDuck

Thanks for this How-To. I've been meaning to give NPTL a go. Will try setting up the system over the weekend.   :Smile: 

----------

## boroshan

I had this built, albeit with some kludging on friday. Then I went off for the weekend and came back. Thought to myself "let's do it properly - save problems long term". And I find there's a new version of portage and linux26-headers and bootstrap-2.6.sh don't want to play nice together. Specifically, I get the "Blocked" message when it tried to upgrade the headers.

Any ideas?

----------

## Snooper

I have noticed that myself and am working to fix it but until portage x.x.51 comes out i don't think we can do a bootstrap-2.6 you have to start with a stage 2 or 3 and emerge -C linux-headers then emerge --oneshot linux26-headers then put in the nptl use flag and go from there i was thinking about making a stage1 with the linux26-headers included but i'm waiting for 2004.2 when i figure all this mess in portage will be cleaned up. they moved it in order to make it easyer but broke how we do it know and it's in preperation for the new gcc/glibc coming soon with better nptl support but in the mean time you can do the above then emerge -e world would recompile everything against the 2.6 headers and glibc with nptl support

----------

## yoosty69

Hmm... I have a quick and dirty hack that seems to be working for me at the moment...

1. I created a tbz2 pkg of linux26-headers on my working gentoo box

2. Transferred it to the new gentoo box

3. Changed my /etc/make.profile/virtuals from:

```

...

virtual/kernel                  sys-kernel/linux-headers

...

virtual/os-headers              sys-kernel/linux-headers

...

```

to

```

...

virtual/kernel                  sys-kernel/linux26-headers

...

virtual/os-headers              sys-kernel/linux26-headers

...

```

4. unmerged linux-headers

5. Emerging the pkg didn't seem to work, so I just unzipped the pkg into the root dir

6. cd /usr/portage

7. ./scripts/bootstrap-2.6.sh

Dirty?  Yes

Working so far?  Yes

----------

## boroshan

I was just about to report back. Snooper, that worked fine for me, thank you for all your efforts. The only issue so far is some segfaulting plugins for xmms, which I fixed by removing the shared libs - it's on bugzilla somewhere, so no worries there. Apart from that things are looking very good.

For anyone pondering going NPTL - at first blush this looks very good. The system feels smooth and responsive. Well worth the effort.

----------

## Snooper

I have come up with one more option for a 2.6 NPTL system.

Start with a stage1, bootstrap it using bootstrap.sh. Then once that has finished emerge unmerge linux-headers, then emerge linux26-headers.

Then emerge -e system with nptl in your use flags.

This way you can bootstrap with your cflags and use flags excluding nptl then once that finishes remove the 2.4 headers install the 2.6 and emerge the system using -e this will recompile everything and give you a stage3 where everything has been compiled against 2.6 headers and nptl support:-)

----------

## boroshan

Oddly enough, I was just trying this. I've been happy enough with NPTL on my desktop, so I thought I'd give the laptop the same treatment.

Anyhow. I did just that: bootstrap from stage one, unmerge linux-headers, emerge linux26 headers, edit make.config and emerge -e system

And it died moaning about not finding perl. No idea why. That said, I typed emerge perl and then emerge system and it seems to be back on track. Once it's finished, I'll probably do another -e system. But I found it needs a little nursing

----------

## Snooper

It could be the use flags you have selected when doing the bootstrap and emerge system you should use only what is needed and nothing more until it's finished and then start adding the use flags you want for other things. you can do this by USE="-* hardened pie pic ncurses perl python xml nptl" etc...

better yet just use the default profile and leave your use flags empty until you need nptl than add that and then emerge system and go from there.

----------

## boroshan

That's probably it then - I copied over my make.conf from the live partition.

Useful to know, thanks

----------

## Snooper

One more method, and i think i'll rewrite the howto soon when i have more time.

Starting with a stage1 tarball:

in /etc/make.profile/virtuals change any instance of linux-headers to linux26-headers there should be 2 one for kernels, and the other for os-headers.

then after an emerge sync, emerge patch, emerge -C linux-headers,

edit /etc/portage/package.keywords and add sys-kernel/linux-headers -* ~x86 then emerge --oneshot linux26-headers.

Now cd /usr/portage, and run scripts/bootstrap-2.6.sh then emerge -e system or just emerge system to take up less time.

to get a stable base with the 2.6 headers and kernel just add the kernel to the package.keywords like so:

sys-kernel/hardened-dev-sources -* ~x86

sys-kernel/gentoo-dev-sources -* ~x86

instead of using ACCEPT_KEYWORDS="~x86" in make.conf... hope this helps

----------

## wilburpan

Very nice installation guide. 

However, is this really necessary?

 *Snooper wrote:*   

> Sync the portage tree.
> 
> ```
> emerge sync
> ```
> ...

 

Presumably you want to make sure that you get the most up to date mirror, which is why you are emerge sync'ing 3 times in a row.  But according to this logic, you would emerge sync 3 times in a row every time you want to update your portage tree.  Portage netiquette suggests that you only emerge sync once every 24 hours.  For an initial install, one reasonably up to date portage tree is probably good enough.

----------

## Snooper

True, it was just my way of making sure i was upto date as of the moment i build from scratch i have had so many times where i build sync an hour later and 1 or 3 packages have been updated when using the unstable tree:-) it's at your discretion and be sure to read the rest of the post there have been many updated to portage concerning linux26-headers and how to install them for a bootstrap these days...

----------

## MaxDamage

What's the problem with the "patch" package? Won't I be able to update it when I have installed the 2.6 headers?

----------

## boroshan

you can update it right enough. It's just one of those circular dependency things. once it's all in place the package updates just fine. you just need to be a little presuasive when it comes to getting the nedw headers in and glibc compiled without patch trying to recompile itself first.

It all works very well on this box anyhow  :Very Happy: 

----------

## blackwhite

In the compling, it warned that

 *Quote:*   

> 
> 
> Calculating dependencies ...done!
> 
> >>> emerge (1 of 1) sys-libs/glibc-2.3.3.20040420 to /
> ...

 

Afer check the ebuild:

```
nano /usr/portage/sys-kernel/linux26-headers/linux26-headers-2.6.7-r4.ebuild
```

you will find it only supports:

 *Quote:*   

> KEYWORDS="-* ~amd64"

 

How can I solve this? BTW, booted with livecd2004.2

Thanks a lot.

----------

## Snooper

Well that error could be a number of things usually not booting with a 2.6 kernel. When you boot from the LiveCD you need to make sure you use the "smp" kernel this is a 2.6 kernel.

second it could be header related as in you don't have the 2.6 headers installed. to install the headers you need to follow the guide and thats installing patch then removing linux-headers and installing linux26-headers.

Then make sure you have edited the virtuals file if you don't bootstrap will downgrade the headers back to 2.4.

also make sure sys-kernel/linux26-headers -* ~x86 is in your package.keywords file else you will not be able to install the headers.

-* is simply a blocker for other archs when you see "arm hppa etc" that means it's stable on those arches, when it's "-* ~x86 ~arch etc" that means it's available in the unstable branch using ACCEPT_KEYWORDS="~x86" to use. and "-*" is just a blocked by that keyword and is not tested on much of anything to be stable. so it needs to go into package.keywords like so sys-kernel/linux26-headers -* and that will allow you to use that package that is blocked by the -* keyword:-)

----------

## blackwhite

thanks. I try it again. I definitely do it following the HOWTO.

----------

## dmitrio

I have copied this HOWTO, with permission of Snooper to gentoo-wiki.com 

http://gentoo-wiki.com/HOWTO_Gentoo_2004.2_for_linux_2.6_and_NPTL

If you see anything that should be added or changed, feel free to do so. 

Thank you for a great HOWTO.

----------

## blackwhite

I did it again according to the HOWTO exactly. there are still same problems.

after the Bootstrapping the system: (Stage1 to Stage2)

```
cd /usr/portage

scripts/bootstrap-2.6.sh && env-update && source /etc/profile
```

After executing /lib/libc.so.6, I just see this output

```
GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6).

Compiled on a Linux 2.6.7 system on 2004-07-29.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        linuxthreads-0.10 by Xavier Leroy

        BIND-8.2.3-T5B

        libthread_db work sponsored by Alpha Processor Inc

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Report bugs using the `glibcbug' script to <bugs@gnu.org>.

```

.There is no NPTL.

Now my question is: Is there NPTL in the output now after the stage from 1 to 2?

Thanks for your help.

----------

## blackwhite

I have done it correctly. Maybe I make some errors in the installaion.

 *Quote:*   

> livecd portage # /lib/libc.so.6
> 
> GNU C Library stable release version 2.3.3, by Roland McGrath et al.
> 
> Copyright (C) 2004 Free Software Foundation, Inc.
> ...

 

Thanks.

----------

## lutel

Snooper thank you for this very nice and helpful howto. Could you expand it on how to make bootstrap with gcc-3.4.x ?

----------

## Snooper

Ignore my earlier post on using the gcc34-x86-2004.2 profile.

The frame work is done for using a 2.6 kernel, and headers. It's very simple to configure.

You will need to:

A. Boot with the "smp" kernel.

B. Download the stage1 2004.2 image.

C. emerge sync

D. rm /etc/make.profile && ln -sf /usr/portage/profiles/gcc34-x86-2004.2 /etc/make.profile

E. ensure "ACCEPT_KEYWORDS="~x86" is in your make.conf

F. emerge -C linux-headers

G. emerge --oneshot --nodeps linux26-headers

H. scripts/bootstrap-2.6.sh

The profile is all ready configured to install the 2.6 headers... Just follow the Gentoo Handbook with the exception of adding ACCEPT_KEYWORDS="~x86" to make.conf, and creating a link to gcc34-x86-2004.2 profile  :Rolling Eyes:  (I stand corrected the dv just changed the profile back to linux-headers so just change the linu-headers in the virtual file back to linux26-headers. you can follow the profile in the GCC 3.4 topic just do a search for it, it's like a good 67 pages long so far i have got the base and system to compile and bootsplash, udev,hotplug,grub,syslog-ng,vixie-cron,ufed,genlop,gentoolkit to compile and genkernel doesn't work until dietlibc is updates it's not compliant with gcc 3.4, and i'm trying to get xorg-x11 to compile right now my first attempt didn't work but i think that was a hardware issue and not software (i hope anyway)...

----------

## hunky

Thanks for this how-to. I'm trying to speed my system up - it is a

Pentium 4 HT 2.8 with SATA harddrives and I got a system running but am disappointed with the performance. Hence one thing led to another and I gave this a shot on an already installed system. (Am I showing my ignorance?)

Anyway, things were progressing until about 60 of 89 compiles were done when I got this error:

```
glibc/glibc-bugs.h -I../include-glibc -I//usr/include -DIPSEC_DEBUG -DIPSEC -DINET6 -Wall   -c -o ipsec_get_policylen.o ipsec_get_policylen.c

mv y.tab.c policy_parse.c

mv: cannot stat `y.tab.c': No such file or directory

make: *** [policy_parse.c] Error 1

make: *** Waiting for unfinished jobs....

!!! ERROR: net-misc/iputils-021109-r3 failed.

!!! Function src_compile, Line 63, Exitcode 2

!!! libipsec failed

```

A quick paste into search led me here:

https://forums.gentoo.org/viewtopic.php?t=206109&highlight=iputils021109r3+failed&sid=276ca27f923a429869a495e11bc9e0ca

I've made his fix and hit emerge -e system again and was a bit surprise to see it start back at 1 of 89. Dang! Guess I better read up some more but is this natural behavior?

Off to bed for now.. cheers, Hunky

----------

## iptech

I followed the instructions exactly, with the exception of choosing the latest love-sources (2.6.8-rc2-love3) for the kernel (I followed the wiki that was posted by dmitrio).  Looking at the /lib/libc.so.6 did show that nptl was installed.  It starts booting OK, but I get the following halfway through:

```
mount_devfs_fs(): unable to mount devfs, err: -2

Freeing unused kernel memory: 180k freed

Warning: unable to open an initial console.

Kernel panic: no init found.  Try passing init= option to kernel.
```

I do have all the necessary items selected in the kernel and grub appears to be configured correctly.

When rebooting with the 2004.2 live cd, it will not chroot; it says the kernel is too old.  Using the love-sources live-cd v2 does let me chroot.  I checked things out and tried a few options in grub, such as passing nodevfs to the kernel, with no success.  Any thoughts?  This is not my first time installing Gentoo, but it has been a while.  Here are some details on the system:

Dell Inspiron 3700

PIII 500Mhz 512MB RAM, 40GB HD, DVD/CDRW

/dev/hda1 - Dell hibernation partition

/dev/hda2 - /boot (ext2)

/dev/hda3 - NTFS

/dev/hda4 - extended

/dev/hda5 - swap

/dev/hda6 - / (reiserfs)

/dev/hda7 - /home (reiserfs)

/dev/hda8 - /var (reiserfs)

/dev/hda9 - /usr (resierfs)

----------

## Snooper

Can you post your grub config file: /boot/grub/grub.conf and kernel config /usr/src/linux/.config

Are you running udev or devfs?

----------

## iptech

OK Snooper, here is my current configs

grub.conf:

```
timeout 30

default 0

fallback 1

splashimage=(hd0,1)/grub/splash.xpm.gz

# For booting Linux

title  Gentoo Linux

root (hd0,1)

kernel /bzImage root=/dev/hda2

# For booting Windows XP

title Windows XP

rootnoverify (hd0,2)

makeactive

chainloader  +1
```

.config

```

#removed to make the thread smaller  :D 

```

I had Gentoo running on this laptop with a 2.4 kernel, but it was out of date and I wanted to do a complete reinstall to refresh my memory and set up the partitions a little better.  When I saw this tip on installing nptl support, it gave me even more reason to reinstall.  This kernel config is very much like the old one, but I used LILO on the old setup.Last edited by iptech on Fri Aug 13, 2004 6:40 pm; edited 1 time in total

----------

## iptech

Forgot to mention...  I did emerge udev according to the wiki, and I tried passing nodevfs to the kernel in grub.conf to see if that would help.  It did not.

----------

## iptech

Doh..  I found it.  Grub was pointing the root to /dev/hda2 when it should be /dev/hda6.    :Embarassed:  Time to go lick my wounds and finish installing.  Thanks for the help.

----------

## Eowyn

 *Snooper wrote:*   

> 
> 
> Bootstrapping the system: (Stage1 to Stage2)
> 
> ```
> ...

 

is bootstrap.sh right or is it bootstrap-2.6.sh?

----------

## thechris

hmm, i unmerged my linux headers and then couldn't compile the new ones.  even with most basic cflags.  i don't like this new method.

----------

## OneOfMany

Eowyn:

I'm pretty sure (assuming you emerged the linux26-headers by hand) that you're supposed to use bootstrap.sh for now.  bootstrap-2.6.sh tries to merge your headers for you (and currently that points only to the 2.4 headers...for some reason the 2.6 headers aren't just a new version of "sys-kernel/linux-headers").

thechris:

Specific error(s) you hit?  I don't think much is actually compiled in the headers (they're basically just a bunch of text files that are included by a ton of stuff).  So I doubt your cflags would matter much...

----------

## dmitrio

can i use nptl on single CPU box?

```
#uname -a

 Linux axon 2.6.7-gentoo-r11 #3 Fri Aug 6 09:19:13 CDT 2004 i686 AMD Athlon(tm) XP 2500+ AuthenticAMD GNU/Linux
```

emerge -u glibc gave me 

```
 * Caching service dependencies...

>>> emerge (2 of 2) sys-libs/glibc-2.3.3.20040420-r1 to /

>>> md5 src_uri ;-) glibc-2.3.2.tar.bz2

>>> md5 src_uri ;-) glibc-linuxthreads-2.3.2.tar.bz2

>>> md5 src_uri ;-) glibc-2.3.3-branch-update-20040420.patch.bz2

nptl

 * Checking kernel headers for broken sysctl.h ... 

nonptl

 * You have "nptl" in your USE, but your kernel version or

 * architecture does not support it!
```

and output of /lib/libc.so.6 after compilation is

```
GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6).

Compiled on a Linux 2.6.7 system on 2004-08-10.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        linuxthreads-0.10 by Xavier Leroy

        BIND-8.2.3-T5B

        libthread_db work sponsored by Alpha Processor Inc

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Report bugs using the `glibcbug' script to <bugs@gnu.org>.
```

can enabling SMP in /usr/src/llinux/.config help me?

```
# CONFIG_SMP is not set

CONFIG_PREEMPT=y
```

----------

## thechris

ok, i'll come back for NPTL.  i'm pretty mad about the linux26-headers name-change -- wtf it is 10x harder now.

here is where i'm at now.  finished bootstrap.  emerged linux26-headers and unmerged linux-headers.  attempted to re-emerge glibc -- it warns me that I WON'T GET NPTL!!!

do i have to re-bootstrap?

----------

## thechris

attempted tore-bootstrap.  in a stroke of pure luck i checked the status just as it told me NPTL wasn't gonna happen.  so my question is how do i enable NPTL support after bootstrap?

----------

## Half_Elf

Nice tutorial but I found a very bad error in it.

When you give this CFLAGS example, you are using double "--" syntax that GCC doesn't (seems to) support.

```
CHOST="i686-pc-linux-gnu" 

CFLAGS="-march=athlon-xp -O3 -pipe [b]--[/b]fomit-frame-pointer" 

CXXFLAGS="${CFLAGS}" 

```

the "--fomit-frame-pointer" was causing error there, I had to change it to "-fomit-frame-pointer".

configure script weregiving me error about "your C compiler cannot create executable file". Pretty confusing, I had hard time to find were this was coming from.

----------

## OneOfMany

dmitrio:

Yes, you can use nptl on a single CPU box.  As I say below...to use nptl you need the 2.6 headers (and to be running a 2.6 kernel...which is the reason you choose "smp" at the LiveCD boot prompt--the "gentoo" kernel is 2.4, the "smp" kernel is 2.6) and to have nptl in your USE= line of make.conf.

thechris:

Did you do this part?

```
mkdir /etc/portage

nano -w /etc/portage/package.keywords

(then inside the file you just created...add)

sys-kernel/linux26-headers ~x86
```

And I assume you removed the old linux-headers then emerged linux26-headers (the reverse of what you said).  Assuming you have only the 2.6 headers installed and "nptl" in your use flags, then you should be set when you re-emerge glibc.  You are doing this inside a 2.6 version kernel, right?

----------

## Snooper

http://gentoo-wiki.com/HOWTO_Gentoo_2004.2_for_linux_2.6_and_NPTL

Use the version of this tutorial there i keep it updated more than this one it's to much work to go back and forth.

I'm also working on a stage1 tarball that will be ready to just bootstrap without messing with the 2.6 headers or nptl it's using a custom profile that i made that will take care of it all. only thing it's also using udev by default and gcc-3.4.1 and glibc-2.3.4 it's based on the gcc34 profile but modified to replace devfs with udev and added gentoolkit to the system and added nptl to use in the profile so you don't have to put it in make.conf:-) i'll create a new topic when i release it hopefully this weekend...

----------

## dmitrio

 *OneOfMany wrote:*   

> Yes, you can use nptl on a single CPU box.  As I say below...to use nptl you need the 2.6 headers (and to be running a 2.6 kernel...which is the reason you choose "smp" at the LiveCD boot prompt--the "gentoo" kernel is 2.4, the "smp" kernel is 2.6) and to have nptl in your USE= line of make.conf.
> 
> 

 

Hmm, I used smp boot up kernel with 2004.2

as you see in output i have nptl in my /etc/make.conf

and compilation just ignored it  :Sad: 

I used wiki's guide.

Cann't figure out where to dig  :Sad: 

2 Snooper I left some notes on talk page

----------

## thechris

has anyone actually gotten this to work because it won't work for me.  it keeps saying that i need a new kernel version.  i'm assuming its becuase the linux26-headers aren't detected as 2.6 headers by the glibc 2.3.3 ebuilds.  is everyone using glibc2.3.4?

----------

## zerojay

 *thechris wrote:*   

> has anyone actually gotten this to work because it won't work for me.  it keeps saying that i need a new kernel version.  i'm assuming its becuase the linux26-headers aren't detected as 2.6 headers by the glibc 2.3.3 ebuilds.  is everyone using glibc2.3.4?

 

Nope, worked perfectly fine here for me with glibc 2.3.3.

----------

## thechris

i guess i'm unlucky then.

i wonder if NPTL will affec my acovea runs?  if so i guess i should enable it...

----------

## fxlamare

Hi!

i also failed compiling glibc with ntpl support.

Followed steps in this thread with the bootstrap26.sh script.

Guess i should try again the full setup with the updated wiki.

Had 2.6.5 kernel and 2.6.7 headers but the problem is not here (emerged 2.6.5 headers without success).

The last difference is that I boot with smb-nofb for scrolling performance reasons.

Will post my results when i'll back home.

FX

----------------------------------------

from france, where it's rainy today

----------

## preacher

If you check this thread, you can read about my experiences with nptl.

I could bootstrap and emerge system fine, but it's day-to-day emerging that doesn't seem to utilize my quad cpu system as much as it did before.

----------

## OneOfMany

One last thing I can think of is the keywords.  If you haven't either enabled "ACCEPT_KEYWORDS=~x86", or whatever it should be for your CPU's architecture, in /etc/make.conf for all packages or the linux26-headers specifically (by doing the "mkdir /etc/portage" and creating a package.keywords file with "sys-kernel/linux26-headers ~x86" in it) then emerge won't install the right headers (running "emerge -s linux26-headers should tell you if you've got them installed).

Wrongs headers then you won't get the enabled glibc.  Beyond that...I guess you're just cursed  :Wink: .

----------

## fxlamare

Back home (it's 2am...)

Ok, i saved my downloaded files to spare time downloading them (hey we're late in France, 512kbps for about 30$/month   :Laughing:  ).

To make it short, I tried again and followed the wiki page's instructions. I discovered I had forgotten to set my CHOST to i686 in my make.conf (in stage 1 it comes with i386). 

I guess it was the reason why it didn't work past times (shouldn't work that late..).   :Embarassed: 

Now i'm waiting for the bootstrap step to finish in a few minutes. I guess it's OK now because some nptl-related strings appeared during compilation (i missed the beginning of glibc's compilation -- number 2   :Wink:  )

thanks!!

----------

## Hauser

Hmm, I recompiled glibc with nptl flag, the /lib/libc.so.6 output shows nptl is there:

```
$ /lib/libc.so.6

GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6).

Compiled on a Linux 2.6.5-gentoo-win4lin system on 2004-08-14.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        NPTL 0.61 by Ulrich Drepper

        BIND-8.2.3-T5B

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Thread-local storage support included.

Report bugs using the `glibcbug' script to <bugs@gnu.org>.
```

However, I don't have linux26-headers on my system:

```
$ emerge -s linux26-headers

Searching...

[ Results for search key : linux26-headers ]

[ Applications found : 1 ]

*  sys-kernel/linux26-headers [ Masked ]

      Latest version available: 2.6.7-r4

      Latest version installed: [ Not Installed ]

      Size of downloaded files: 34,269 kB

      Homepage:    http://www.kernel.org/ http://www.gentoo.org/

      Description: Linux 2.6.7 headers from kernel.org

      License:     GPL-2

```

Does this mean nptl doesn't really need 2.6 headers?

----------

## Snooper

If you compiled glibc with nptl after you had a built system with a 2.6 kernel installed i have heard the build script will look and see if the install kernel source is 2.6 if so it will use that and ignore the installed headers package. But if you don't install the 2.6 headers and bootstrap then glibc won't be nptl because there where no 2.6 headers found. Also unless you do a emerge -e world "i think" everything will be built against the 2.4 headers and not 2.6 witch may not be a problem but it could lead to issues...

----------

## Digital Storm

Hi

I just recently reinstalled my gentoo install with nptl...The only thing I changed in the guide was the bootstrapping, where I manually editted the "bootstrap-2.6.sh" as it was complaining about linux headers...I had removed the old one and installed the new ones just like the guide said...So I editted the "bootstrap-2.6.sh" and removed the portion where it wanted to emerge the headers, ran it and went onto "emerge system" and everything came out fine with nptl running...

----------

## Snooper

You actually don't have to run bootstrap-2.6.sh that i imagine is just still left behind from when the 2.6 headers where still part of the linux-headers ebuild. running plain bootstrap.sh will work just fine and it will not try and download the 2.6 headers and install them again. It's just there from the good ole days when you could just add linux-headers -* to package.keywords and run bootstrap-2.6.sh and it took care of everything but the move to linux26-headers from linux-headers blocks each other from both being installed and the script doesn't know to uninstall the old headers first then install the new ones... Maybe it will be fixed or they will release 2 stages one based on 2.6 headers, and another on the 2.4 headers so both groups could follow the Gentoo Handbook for installing  :Wink: 

----------

## jetblack

Great HOWTO, Snooper. I just followed it to reinstall gentoo on my laptop with NPTL support, and it worked like a charm.

----------

## taskara

Just wondering where teh GCC section is in this howto?

Following the instructions seems to still build gcc 3.3

Also, following instructions, /lib/libc.so.6 is still built with 2.4.21 kernel, and there is no nptl.. any ideas?

cheers

----------

## Snooper

Are you doing a clean bootstrap.sh from a stage1? I don't go into how to update an existing install.

But to get rolling you need a Gentoo LiveCD with a 2.6 kernel. 2004.1 or 2004.2 will do. when the boot prompt comes up asking for what kernel you want to boot with type smp this is a 2.6 kernel and supports nptl.

Now you will need to download a stage1 and emerge sync (follow the guide) and add nptl to USE in /etc/make.conf then remove the old linux-headers, emerge the linux26-headers (following the guide) and you should have a 2.6 system w/nptl support.

----------

## taskara

 *Snooper wrote:*   

> Are you doing a clean bootstrap.sh from a stage1? I don't go into how to update an existing install.
> 
> But to get rolling you need a Gentoo LiveCD with a 2.6 kernel. 2004.1 or 2004.2 will do. when the boot prompt comes up asking for what kernel you want to boot with type smp this is a 2.6 kernel and supports nptl.
> 
> Now you will need to download a stage1 and emerge sync (follow the guide) and add nptl to USE in /etc/make.conf then remove the old linux-headers, emerge the linux26-headers (following the guide) and you should have a 2.6 system w/nptl support.

 

Yep, that's exactly what I did.. (2004.2, smp, stage1, etc) I'll try again and see  :Confused: 

I have done it before! So it was strange that it didn't work this time.

Anyhow, could you tell me is there a better way to get GCC 3.4 into my system? In the past I just hacked ebuilds etc (since the very first one available  :Wink: ).

Then last time I remember doing something with make.profile or some such.

Any ideas?

edit: never mind, foud your thoughts on page 2  :Smile: 

Cheers!

----------

## hadees

I am kind of confused, at the top of this post it says it is for using gcc 3.4 but on the wiki it makes no mention of it.  So how do I do all this and add gcc 3.4? can you add the instructions to the wiki

----------

## taskara

 *hadees wrote:*   

> I am kind of confused, at the top of this post it says it is for using gcc 3.4 but on the wiki it makes no mention of it.  So how do I do all this and add gcc 3.4? can you add the instructions to the wiki

 

it is on page 2,

[quote]The frame work is done for using a 2.6 kernel, and headers. It's very simple to configure. 

 You will need to: 

 A. Boot with the "smp" kernel. 

 B. Download the stage1 2004.2 image. 

 C. emerge sync 

 D. rm /etc/make.profile && ln -sf /usr/portage/profiles/gcc34-x86-2004.2 /etc/make.profile 

 E. ensure "ACCEPT_KEYWORDS="~x86" is in your make.conf 

 F. emerge -C linux-headers 

 G. emerge --oneshot --nodeps linux26-headers 

 H. scripts/bootstrap-2.6.sh 

[/code]

basically you just remove /etc/make.profile after you have emerge sync'd

then you link the gcc 3.4 profile to /etc/make.profile

and add ACCEPT_KEYWORDS="~x86" to you make.conf, and continue with the install..

----------

## Snooper

Follow this below linkg to a guide to using the gcc34-x86-2004.2 profile:

https://forums.gentoo.org/viewtopic.php?p=1452485&highlight=#1452485

at the end of the thread i have some info for package.keywords so you don't have to use ~x86 in make.conf and use a stable system with the exception of gcc-3.4.1, libstdc++-v3, and glibc-2.3.4

----------

## javock

 *Snooper wrote:*   

> 
> 
> Selecting and configuring a kernel:
> 
> ```
> ...

 

Hello,

    Is this particular kernel the ONLY one that works with NPTL? I've tried to compile nitro / mm kernels with no success... I NEED reiser4 and gentoo-sources does not have it (4kb not compiled)... I will try gentoo-dev-sources, but I would really like to have a nitro kernel...

Great Howto...

Regards

----------

## taskara

generally any kernel has worked for me

the thing that HASN'T worked is genkernel.. dietlibc crashes out when trying to build the initrd, which is most frustrating  :Wink: 

but if I do a manual build everything seems to work.. development, vanilla, gentoo-dev, mm-sources, ck-sources etc..

----------

## javock

 *taskara wrote:*   

> generally any kernel has worked for me
> 
> development, vanilla, gentoo-dev, mm-sources, ck-sources etc..

 

Ahhhhhhhhhh.....

Must ... Not ... Become ... more ... no0b ...

will try again

... and again...

... and again....

Thanks.

----------

## Lepaca Kliffoth

Help! I used this guide and everything worked fine!! WHY???

----------

## zerojay

 *Lepaca Kliffoth wrote:*   

> Help! I used this guide and everything worked fine!! WHY???

 

Hah. Give this guy a ceee-gar.

----------

## -=Zepplock=-

This was an excellent tutorial.

Everything worked.

Thank you.

----------

## the_real_one_maniac

warning: my english is bad.

I have one very strange and maybe stupid question  :Smile: 

I take a look on yours output of /lib/libc.6.so  (when you have nptl) and I notice that everyone have:

 *Quote:*   

> 
> 
> Available extensions:
> 
>      ...
> ...

 

But I have:

 *Quote:*   

> 
> 
>     ...
> 
>  Native POSIX Threads Library by Ulrich Drepper et al
> ...

 

I just have finish stage1->stage2 phase  :Wink: 

I realize that  I have nptl built  :Smile:  , but I see everyone in this thread have different from mine string in "available extensions". And just ask this (maybe) stupid question. Is everything ok  :Laughing:  ?

@Snooper: Realy great tutorial ! But if you don't read the thread man will not understand some things about installation of nptl (you need either headers of 2.6 kernel or working 2.6 kernel for example  :Wink:  ).

----------

## wharding

the_real_one_maniac: I was about to post the exact same message. I have a feeling that the string was updated.

I am just finishing a full install on my laptop that includes:

1) nitro-sources 2.6.9-nitro2

2) reiser4

Laptop is running like a rocket now and I am really happy.

If anyone is looking for a LiveCD that includes nitro sources as well as reiser4 support I found one here:  http://lxnay.dnsalias.org/.

Good luck and happy nptl'ing.

P.S. If you are wondering whether its worth it to convert to NPTL and/or reiser4  all I can say is that I have NEVER seen my laptop run as fast as it i running right now  :Smile: 

xorg, firefox, tbird, gimp, xmms streaming audio, 4 compiles all running at the same time on a P4 1.6Ghz with 512MB RAM, and it's looking at me like "Is that all you got?"  :Smile: 

----------

## taskara

I have built three gentoo machiens lately, and installed with nptl as I have the previous 5 times before that.. but this time when I check libc.so.6, there is no NPTL listed.. am I crazy?

```
master root # /lib/libc.so.6

GNU C Library 20041006 release version 2.3.4, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.4.2  (Gentoo Linux 3.4.2-r2, ssp-3.4.1-1, pie-8.7.6.5).

Compiled on a Linux 2.6.8 system on 2004-10-18.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        linuxthreads-0.10 by Xavier Leroy

        The C stubs add-on version 2.1.2.

        BIND-8.2.3-T5B

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

        Glibc-2.0 compatibility add-on by Cristian Gafton

        GNU Libidn by Simon Josefsson

        libthread_db work sponsored by Alpha Processor Inc

Thread-local storage support included.
```

----------

## SchAmane

 *taskara wrote:*   

> I have built three gentoo machiens lately, and installed with nptl as I have the previous 5 times before that.. but this time when I check libc.so.6, there is no NPTL listed.. am I crazy?

 

I have the same problem.

libc is compilet for nptl and non-ntpl support.

I am not sure, but maybe USE="nptlonly" should help. There is /lib/tls/libc.so.6 with ntpl also, but i think all apps do not use it.

----------

## arkaine

I tried compiling xorg, the latest one 6.8.0-r1 I believe and it froze when it was unpacking the source. I checked the ebuild and the lines you told to remove were already commented out. So yah, how can I get this working...?

----------

