# [SOLVED w00t!] I did a system update and now X won't start.

## GivePeaceAChance

Last night I ran:

```

# emerge --update --deep --newuse world

# emerge --depclean

# revdep-rebuild
```

As suggested by the Gentoo Docs: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1

I followed it up by just going over about 20 of the 129 config files that had to be updated. Wow. How the HECK did I manage to get that many config files to be examined from my full update? Is that gonna happen every time I do that? (maybe once, twice a month, for sure on weekends)

Anyway, after getting bored of config files, I decided to restart my computer to make sure all was well.  It wasn't.

Admittedly, the only thing that looks wrong is that it doesn't pick up my nvidia drivers, so that's probably the onyl issue, but when I tried to emerge nvidia-drivers from the console, it failed after a bit, giving me some errors. IIRC, it had something to do with being unable to determine my kernel.  So that didn't sound too good.  Anyway, I took a video of the process and sifted through the error logs it gave me. Here is what I deem important for this issue.  If anyone can help me figure this out in the next few days, that'd be great, because I don't want to head back to university with a broken laptop.

Unable to star X server. Crap.

Build Operating System: UNKNOWN

Current: Linux GentooHost 2.6.21-gentoo-r4

Failed to load module "nvidia" (module does not exist, 0)

No drivers available

Fatal server error:

no screens found

```
From xorg.conf, it's now telling me that TTF, OTF, local, cryillic, don't exist anymore

Warning: Open APCI failed (/var/run/apcid.socket) (No such file or directory)

Information: No APM support in BIOS or kernel

Warning, couldn't open module nvidia

EE: Failed to load module "nvidia" (module does not exist, 0)

```

----------

## the.ant

you gave the answer yourself, it's either some wrong kernel-setting why the driver didn't get loaded or some bug with the driver. or both. 

changing the driver from nvidia to vesa or alike in /etc/X11/xorg.conf should make X startable again. check your kernel-settings, recompile and recompile/install nvidia drivers.  

Or if you are lazy take the short route and just reinstall nividia drivers. Afterwards you can still figure out that it isn't working and that you have to check the kernel first...

----------

## Nick C

check that acpid is running ( /etc/init.d/acpid status ), also check /var/log/messages and see if anything is there that shows a problem.

Also check your kernel config and make sure that you have acpi support loaded.

That might help you start eliminating possible problems.

Also make sure you recompile any out of kernel modules that you use (ie. any kernel module that you install via portage) as you need to do this any time you upgrade your kernel.

If you have updated your kernel make sure your /usr/src/linux symlink is pointing towards your currently running kernel or else anything that needs the kernel src to build may break (for example the nvidia drivers).

Hopefully some of these ideas help.

----------

## Hu

When you have pending configuration files, always check that you have completed all the "important" updates before you reboot.  An update is important if it is relevant to any part of the boot process, or if it is needed by a process you leave running.

Since you did not specify what configuration files required an update, it is difficult to say whether this will be a regular occurrence.  I suspect that most of the files were from a change in xkeyboard-config, for which it is usually safe to upgrade most of the files non-interactively.

----------

## GivePeaceAChance

I'm not on my box atm, but how do I automatically update the files, because I have 100 of them that need looking at, and as of yet, I have not automated that process. How do I automate it using dispatch-conf and xxdiff? (I'm assuming man dispatch-conf will tell me something, so I'll check that out later)

----------

## BitJam

Do you have the symlink USE flag set?  You can check by running emerge --info.  This USE flag is documented as:

```
symlink - Force kernel ebuilds to automatically update the /usr/src/linux symlink
```

If this symlink is pointing to the wrong kernel source directory, it could cause several of the problems you've encountered.    If you are using the symlink USE flag then Portage may have emerged a new set of kernel source files and changed the symlink behind your back.

----------

## GivePeaceAChance

```
# /etc/init.d/acpid status

status: stopped

# /etc/init.d/acpid start

can't open /proc/acpid/event: Device or resource busy

Failed to start

# make menuconfig

No rule to make target 'menuconfig'. Stop.
```

My /var/log/messages is 134  MB and has over 140 000 lines. I can't scroll to the bottom of that in a good amount of time using nano.

I don't get why I need to check my kernel config, as it was fine before I did the update, and I didn't change my kernel - I just ran emerge --uNDv world.  As it stands though, make menuconfig doesn't work in the state my system is in anyhow.

The error when I try to 

```
emerge nvidia-sources
```

 *Quote:*   

> Could not find a Makefile in the kernel source directory
> 
> Please ensure that /usr/src/linux points to a complete set of linux sources
> 
> ...
> ...

 

It seems to me like the two biggest issues are

1) My kernel isn't being recognized for some reason.... Someone is going to have to walk me through the steps, because I tried cp bzImage /boot/kernel-2.6.21-gentoo-r4 and that didn't help.

2) Nvidia isn't loading - doesn't show up on lsmod, or anything, and because of problem 1) I can't re-emerge the drivers for it.

So does anyone have any tips/commands for resolving 1) ?

EDIT:

Here's some output:

```

total 10787

lrwxrwxrwx    1 root root      27 Aug 14 05:20 System.map -> System.map-2.6.21-gentoo-r4

-rw-r--r--       1 root root      1185527 Dec 28 13:09 System.map-2.6.21-gentoo-r4

-rw-r--r--       1 root root      1026433 Aug 13 12:43 System.map-2.6.21-gentoo-r4.old

lrwxrwxrwx    1 root root      31 Aug 14 05:20 System.map.old -> System.map-2.6.21-gentoo-r4.old

lrwxrwxrwx    1 root root      1 Aug  2 22:43 boot -> .

lrwxrwxrwx    1 root root      23 Aug 14 05:20 config -> config-2.6.21-gentoo-r4

-rw-r--r--       1 root root      46667 Dec 28 13:09 config-2.6.21-gentoo-r4

-rw-r--r--       1 root root      45639 Aug 13 12:43 config-2.6.21-gentoo-r4.old

lrwxrwxrwx    1 root root      27 Aug 14 05:20 config.old -> config-2.6.21-gentoo-r4.old

drwxr-xr-x     2 root root      1024 Aug  4 15:56 grub

-rw-r--r--       1 root root      3225208 Dec 30 23:39 kernel-2.6.21-gentoo-r4

drwxr-xr-x     2 root root      12288 Aug  2 20:07 lost+found

lrwxrwxrwx    1 root root      24 Aug 14 05:20 vmlinuz -> vmlinuz-2.6.21-gentoo-r4

-rw-r--r--       1 root root      2729912 Aug 14 05:20 vmlinuz-2.6.21-gentoo-r4

-rw-r--r--       1 root root      2718424 Aug 13 12:43 vmlinuz-2.6.21-gentoo-r4.old

lrwxrwxrwx    1 root root      28 Aug 14 05:20 vmlinuz.old -> vmlinuz-2.6.21-gentoo-r4.old

```

The one thing that jumps out at me as suspicious is that boot is a symlink to nothing.... Not sure what this all means though. :S

----------

## BitJam

Please see my previous post.

----------

## GivePeaceAChance

What do you mean by "do i have it set"? I don't have any flag set, nor do i know where to set it, etc etc. I'm really quite lost here.  If you have the time, a bit of an explanation would be great.  :Smile: 

Edit: I don't have the symlink flag set in my make.conf, no.

----------

## BitJam

 *BitJam wrote:*   

> Do you have the symlink USE flag set?  You can check by running emerge --info. 

 

You can also check the symlink directly by comparing the output of ls -l /usr/src/linux to the output of uname -r.  On my system I get:

```
$ ls -l /usr/src/linux

lrwxrwxrwx 1 root root 22 2007-12-10 19:59 /usr/src/linux -> linux-2.6.23-gentoo-r3

$ uname -r

2.6.23-gentoo-r3
```

Notice that the directory the symlink points to is has the same version number as the output of uname -r.  This means my symlink is correct.  If your symlink is not correct then you can change it with these commands:

```
$ cd /usr/src

$ sudo rm linux

$ sudo ln -s linux-2.6.23-gentoo-r3 linux
```

Of course you would need to use the directory name that corresponds to the version reported by uname -r.

You may find the Gentoo Kernel upgrade guide useful.

----------

## BitJam

I think I know what your problem is.  I think when you ran emerge --depclean it deleted all the old versions of your kernel sources including the version you were actually using.

If this is indeed the problem, then the first thing to do is try to get a copy of your kernel .config file.  With any luck, it is still at /usr/src/linux/.config.  If so, make a copy of it in your home directory (without the leading dot so it is not hidden).  You might also be able to get a copy from /proc/config.gz.  You can make a copy with the command:

```
$ gunzip -c /proc/config.gz > ~/config2
```

which will leave a copy called config2 in your home directory.

Next, you will need to re-emerge the kernel version you are actually using.  You can use uname -r to figure out which version you want.  For my system I would use the command:

```
$ sudo emerge -a =sys-kernel/gentoo-sources-2.6.23-r3 
```

Then make sure the .config file is a copy of the one you saved in the steps above.  This might be enough to get you back up and running but you might also need to rebuild your kernel and modules.

----------

## GivePeaceAChance

The output of uname -r showed a symlink to the kernel version I was using, so that doesn't seem to be the problem.

I'm just about to run:

```
emerge -a =sys-kernel/gentoo-sources-2.6.21-r4
```

However it's going to USE="-build -symlink"

Do I want this?  What use flags should I set/not set?

----------

## BitJam

Those USE flags are good.  The big question is whether or not the kernel source is still there.  What is the output of du -sh /usr/src/linux-2.6.21-gentoo-r4?  Here is what I have:

```
$ du -sh /usr/src/linux-2.6.21-gentoo-r4

285M    /usr/src/linux-2.6.21-gentoo-r4
```

Small variations are to be expected but if your result is drastically smaller, then it is likely that re-emerging the kernel source is the way to solve your problem.  If your size is roughly the same as  the size above then the problem is likely elsewhere, but re-emerging the kernel sources probably won't hurt anything as long as you don't make mistakes.  The upgrade guide I linked to above may be useful in this regard.  Also, try to keep a copy of your /usr/src/linux/.config file so you don't have to go to the trouble of re-configuring your kernel.

----------

## GivePeaceAChance

In my /usr/src/ dir I have:

115M /usr/src/linux-2.6.21-gentoo-r4

296M /usr/src/linux-2.6.23-gentoo-r3

 :Smile: 

Should I run:

```
USE="-build -symlink" emerge -a =sys-kernel/gentoo-sources-2.6.21-r4
```

EDIT: the 115 vs. 296 seems suspicious to me... 115 seems to be too small for my regular kernel configuration... perhaps it was somehow moved to .23, and the version of .21 you see there is just a blank? I can't tell, sadly, because for some reason "make menuconfig" in /usr/src/linux doesn't work. "No rule to make target 'menuconfig'"

----------

## BitJam

As I explained in the post that started "I think I know what your problem is. ...", I'm pretty sure your emerge --dep-clean unmerged the kernel source you were using (2.6.21-r4) and only left intact the most recent version (2.6.23-r3).   The results of the du command confirmed this suspicion.  If you have the eix program installed and up-to-date then you could run eix gentoo-sources to double check, but I'm confident we've found the (first?) problem. This is good news since emerging the source again (and possibly recompiling the kernel) should fix your problem.

You shouldn't ever set USE flags on the command line because Portage does not remember which flags you used for which package.  If you need to use per-package flags then you should set them in /etc/portage/package.use.  But in this case my original supposition was wrong, the symlink USE flag was not set (otherwise the symlink would be pointing to the most recent kernel source, which is doesn't) therefore I suggest you simply use:

```
# emerge -a =sys-kernel/gentoo-sources-2.6.21-r4
```

Since both those USE flags are already off, the command you suggested would work just as well but it is a bad habit to get into.

----------

## GivePeaceAChance

Alright. I'll give it a shot and see what happens.  :Smile: 

Edit: OK, so now what do I do, now that I've emerged the sources?

Edit^2: I tried make menuconfig, it works, and the settings I had look to be intact from a quick check, so I'm running make && make_modules install, then I'll run cp /arch/i386/bzImage /boot/kernel-2.6.21-gentoo-r4, and hopefully I'll be in business again.  So just wondering... how can I prevent this from happening again (in the event that this actually fixes it)?  Because I want to get in the habit of doing an emerge -NDvu every few weeks or once every month, but I don't want to ahve to worry about this.

Woohoo! Seems to work now, except "Gentoo Emergence" the boot dealy wasn't found, so I'm stuck with a flower theme (yuck!) until I fix it. But all looks to be in working order - 23 config files to update.  :Very Happy: 

----------

