# missing boot after new kernel

## carpenterguy

I believe my mistake was to compile a kernel as root, I have since read the guide in faq and know to compile the kernel as user....now.   :Embarassed: 

What I really needed was info on what to do, after a world gives you a new kernel. Seems their would be a few simple commands to configure it, add it to grub and boot it. my google-fu failed, so I compiled a new one. If anyone could share a link, would be appreciated.

 # df -H /boot

Filesystem             Size   Used  Avail Use% Mounted on

/dev/sda2               52G   5.9G    44G  13% /

# fdisk -l

Disk /dev/sda: 119.7 GB, 119775648256 bytes

255 heads, 63 sectors/track, 14561 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x0b0b0b0b

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        6387    51199155   83  Linux

/dev/sda3            6388        6642     2048287+  82  Linux swap / Solaris

/dev/sda4            6643       14561    63609367+  83  Linux

In    " / " I have the boot dir but it is empty, also,surprising enough still boots fine in original kernel with no errors.

I am not sure of the correct way to fix this, was thinking of a chroot and using fdisk to redo the boot partition, re-install grub etc...

Anyone got a better idea?

----------

## Jaglover

 *Quote:*   

> Anyone got a better idea?

 

Yes, look at your fstab and see if your /boot gets mounted automatically or you have to mount it by hand. Hint: Is your /boot really 52 GB?   :Razz: 

----------

## carpenterguy

sda2 is /   I have looked at boot several times and all was fine,  lost and found   kernel images  grub

never went mia untill after the update or I compiled the new kernel, I assume it was me.

 <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1               /boot           ext2            noauto,noatime  1 2

/dev/sda2               /               ext3            noatime         0 1

/dev/sda3               none            swap            sw              0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0

#/dev/fd0               /mnt/floppy     auto            noauto          0 0

https://forums.gentoo.org/viewtopic-t-539024.html

from this link in faq

Important Warning: The kernel developers advise against uncompressing the kernel source code, configuring or building the kernel as root. It should be done as an ordinary user. Only the one or two commands needed to install the kernel and the modules should be run as root. There have been bugs in the build process in the past which have caused files in /dev to be deleted when run as root and uncompressing the kernel archive as root can lead to some files getting the wrong permissions. gkh-lkn: "None of the primary kernel developers build kernels as root"

----------

## Anon-E-moose

what does "mount" return

----------

## carpenterguy

frgginmiricale genfool # mount

/dev/sda2 on / type ext3 (rw,noatime)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)

shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)

usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

frgginmiricale genfool #

----------

## Anon-E-moose

/boot is not mounted

Edit to add:

what does 

```
mount /boot
```

 do

and from the opening post

 *Quote:*   

> I believe my mistake was to compile a kernel as root,

 

you have to compile the kernel as root

----------

## carpenterguy

frgginmiricale genfool # mount /boot

mount: unknown filesystem type 'ext2'

tried the mount command again and is the same.

 *Quote:*   

> 
> 
> Important Warning: The kernel developers advise against uncompressing the kernel source code, configuring or building the kernel as root. It should be done as an ordinary user. Only the one or two commands needed to install the kernel and the modules should be run as root. There have been bugs in the build process in the past which have caused files in /dev to be deleted when run as root and uncompressing the kernel archive as root can lead to some files getting the wrong permissions. gkh-lkn: "None of the primary kernel developers build kernels as root"

 

Just going by this, I thought it odd as when installing the system, everything is done in a chroot.

----------

## Anon-E-moose

what does this return 

```
grep EXT2 /usr/src/linux/.config
```

----------

## carpenterguy

frgginmiricale genfool # grep EXT2 /usr/src/linux/.config

# CONFIG_EXT2_FS is not set

hmmm, did I forget something?

----------

## poly_poly-man

You're either going to have to boot an older kernel, or chroot in. From there, just add the ext2 option to the kernel and rebuild. From that system, you should have access to the /boot partition to move things around.

It probably makes sense to build the kernel with the right option in your normal system, and just copy it over from a livecd.

----------

## Jaglover

 *carpenterguy wrote:*   

> frgginmiricale genfool # mount /boot
> 
> mount: unknown filesystem type 'ext2'
> 
> 

 

No need for full rebuild, enable EXT2 as module, make modules, make modules_install. You even do not need to reboot.

----------

## carpenterguy

certainly something is wrong here, I used the live dvd to install, like cruising in a Cadilac, very nice.

I used the cp arch/i386/boot/bzimage /boot/kernel-2.xxx command with no errors  emerged grub wrote my grub.conf file

this is all gone missing from /boot  I thought I read that ext2 and ext3 is already compiled into the kernel, so I did not change anything in that option

 frgginmiricale genfool # uname -a

Linux frgginmiricale 2.6.30-gentoo-r7 #1 SMP Mon Oct 19 22:07:49 GMT 2009 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz GenuineIntel GNU/Linux

Available kernel symlink targets:

  [1]   linux-2.6.30-gentoo-r7

  [2]   linux-2.6.30-gentoo-r8 *

I really would like to boot the new kernel from update and found missing grub  empty boot.

I will make ext2 as a module and try that

CG, shakes head and wonders if he imagined editing grub.

----------

## Jaglover

 *Quote:*   

> I will make ext2 as a module and try that 

 

You need to use sources for your running kernel indeed, uname -r.

----------

## Anon-E-moose

You might very well have modified the /boot/grub/grub.conf file, 

but you did it on the /boot partition.

If you can't mount that partition, then you can't access it.

----------

## Hu

 *Anon-E-moose wrote:*   

>  *Quote:*   I believe my mistake was to compile a kernel as root, 
> 
> you have to compile the kernel as root

 

No.  You need root access to install the kernel, but you can, and should, build it as non-root, as the quote from GregKH mentions above.

----------

## carpenterguy

# uname -r

2.6.30-gentoo-r7

one more twist to the tale, after the update,  --depclean wanted to remove 1 package gentoo-sources for r7

since r8 was pulled in, I let it   my bad. I do not have those sources 

and have issues with booting the r8 kernel because of ext2 issues

cool thing with linux, if you do not get it right the first time....you will get to do it again   :Smile: 

my first thought is to chroot in and add the ext2 module to r8  would that work?

my second thought is to compile a new kernel

since this is a new install and have learned much from it, sure I could do better next time

3rd option is to reinstall    I hate to be a quitter though, a fresh clean install does not take that long

obvious I am a noob, but am trying to think of the best way to deal with this, I do not have sources for running kernel, have sources for a kernel I cant boot, is a fresh install with nothing but some time on it and has taught me a bunch.

seems I dug a deep hole.

----------

## Jaglover

You can emerge those sources back if you want to.

emerge -av =gentoo-sources-2.6.30-r7

 *Quote:*   

> cool thing with linux, if you do not get it right the first time....you can fix it  

 

You .config file for this version is probably still there.

----------

## Anon-E-moose

 *Hu wrote:*   

>  *Anon-E-moose wrote:*    *Quote:*   I believe my mistake was to compile a kernel as root, 
> 
> you have to compile the kernel as root 
> 
> No.  You need root access to install the kernel, but you can, and should, build it as non-root, as the quote from GregKH mentions above.

 

then you need to make sure that the permissions on all files, and the kernel directory structure is set up for normal users.

On my system, it was setup as root from the very beginning and root does all the emerging of packages, and creating of directories,

with root style permissions. I've been compiling linux kernels since the 0.* days as root and have never had any problems with

permissions or build bugs or files being deleted from /dev.

----------

## carpenterguy

thanks jaglover

sure would be nice to mark this as solved

I set the kernel to r7,  rebooted, and am running r7. emerged the sources, and am now in menuconfig

     File systems  --->  

 < > Second extended fs support                                             │ │

  │ │     <*> Ext3 journalling file system support                                   │ │

  │ │     [ ]   Default to 'data=ordered' in ext3 (legacy option)                    │ │

  │ │     [*]   Ext3 extended attributes                                             │ │

  │ │     [*]     Ext3 POSIX Access Control Lists                                    │ │

  │ │     [*]     Ext3 Security Labels                                               │ │

  │ │     < > The Extended 4 (ext4) filesystem                                       │ │

  │ │     [ ] JBD (ext3) debugging support                                           │ │

  │ │     < > Reiserfs support                                                       │ │

  │ │     < > JFS filesystem support                                                 │ │

  │ │     < > XFS filesystem support                                                 │ │

  │ │     < > OCFS2 file system support                                              │ │

  │ │     < > Btrfs filesystem (EXPERIMENTAL) Unstable disk format                   │ │

  │ │     [*] Dnotify support                                                        │ │

  │ │     [*] Inotify file change notification support                               │ │

  │ │     [*]   Inotify support for userspace                                        │ │

  │ │     [*] Quota support                                                          │ │

  │ │     [*]   Report quota messages through netlink interface                      │ │

  │ │     [ ]   Print quota warnings to console (OBSOLETE)                           │ │

  │ │     < > Old quota format support                                               │ │

  │ │     <*> Quota format v2 support                                                │ │

  │ │     < > Kernel automounter support                                             │ │

  │ │     <*> Kernel automounter version 4 support (also supports v3)                │ │

  │ │     < > FUSE (Filesystem in Userspace) support                                 │ │

  │ │         Caches  --->                                                           │ │

  │ │         CD-ROM/DVD Filesystems  --->                                           │ │

  │ │         DOS/FAT/NT Filesystems  --->                                           │ │

  │ │         Pseudo filesystems  --->                                               │ │

  │ │     [*] Miscellaneous filesystems  --->                                        │ │

  │ │     [*] Network File Systems  --->                                             │ │

  │ │         Partition Types  --->                                                  │ │

  │ │     -*- Native language support  --->                                          │ │

  │ │     < > Distributed Lock Manager (DLM)  --->                                   │ │

  │ │                                                                                │ │

  │ │           

everything for ext3 is checked and see nothing for ext2, am I missing something?

----------

## Jaglover

< > Second extended fs support 

This is the EXT2   :Smile: 

----------

## Anon-E-moose

```
File systems --->

< > Second extended fs support │ │ 
```

Edit to add:   :Laughing: 

----------

## carpenterguy

ahh, so it is. I have checked it as a module

so with all this great help everyone has offered, I want to get it right.....feeling the pressure   :Smile: 

save the config and run   make modules, make modules_install   ?

----------

## Anon-E-moose

 *carpenterguy wrote:*   

> ahh, so it is. I have checked it as a module
> 
> so with all this great help everyone has offered, I want to get it right.....feeling the pressure  
> 
> save the config and run   make modules, make modules_install   ?

 

yep

----------

## carpenterguy

hmm, I missed something. I did eselect correct kernel, rebooted and uname confirms correct kernel.

The error I receive is,

frgginmiricale linux # make modules, make modules_install

  HOSTLD  scripts/kconfig/conf

scripts/kconfig/conf -s arch/x86/Kconfig

make: *** No rule to make target `modules,'.  Stop.

frgginmiricale linux #

Since I have both r7 and r8 sources,  how can I control which sources are being used when starting menuconfig?

Or is that not the problem.

----------

## Anon-E-moose

when you do "eselect kernel show"

That is the currently selected kernel sources

when you "cd /usr/src/linux" 

you will be in that currently selected kernel.

When you run make, make modules or make modules_install 

it will be doing things with those kernel sources

---

```
[1] linux-2.6.30-gentoo-r7

[2] linux-2.6.30-gentoo-r8 *
```

these are your kernel sources, /usr/src/linux from the above points to /usr/src/linux-2.6.30-gentoo-r8

when you cd to /usr/src/linux then you are working on kernel 2.6.30-gentoo-r8

and uname -a should reflect that with 2.6.30-gentoo-r8

that makes it all consistent.

----------

## carpenterguy

current profile

frgginmiricale linux # uname -r

2.6.30-gentoo-r7

frgginmiricale linux # eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.30-gentoo-r7 *

  [2]   linux-2.6.30-gentoo-r8

frgginmiricale linux #

I reset it as is and then emerged the r7 resources and then rebooted before make menuconfig while in...  ok think I am in wrong dir.

frgginmiricale linux # ls -ltr /usr/src

total 8

drwxr-xr-x 23 root root 4096 Oct 24 21:14 linux-2.6.30-gentoo-r8

lrwxrwxrwx  1 root root   22 Oct 24 21:20 linux -> linux-2.6.30-gentoo-r7

drwxr-xr-x 23 root root 4096 Oct 24 23:56 linux-2.6.30-gentoo-r7

what I want is in /src

rgginmiricale src # dir

linux  linux-2.6.30-gentoo-r7  linux-2.6.30-gentoo-r8

While in /src

rgginmiricale src #  make modules, make modules_install

make: *** No rule to make target `modules,'.  Stop.

rgginmiricale src # make menuconfig

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

seems my files are not where they should be and causing issues. not sure I understand it, maybe in the near future I could understand it and correct it. do not understand now though.

Since I already have 3 kernels that do not use ext2 and have had problems with compiling the kernel in the first place, I am going to wipe and reload doing it right this time.

I would imagine as a  sysadmin. I should be fired.  good thing I am a carpenter    :Smile: 

time is money, I already have 1 1/2 days on this issue trying to correct my self inflicted problems...I can reload to my current state in 3 - 4 hours....except it will be a working install with no errors and have learned from my mistakes on this install. give me a couple more months and will be able to correct these mistakes.

----------

## Hu

Failure to make modules, is normal, because the target is named modules, without a comma.  Failure to make menuconfig is not normal, and is most commonly seen when you have unmerged the source version you are trying to reconfigure.  You should be in /usr/src/linux-VERSION when running any of the kernel-related make targets.  This implicitly controls the version you build, since you cd to that version before starting.  This also means that you can build a version other than the one made active by eselect.  Theoretically, running a kernel other than the selected one can confuse the build process of some external kernel modules.  I have not used any modules that become confused in this manner, though.

Anon-E-Moose: support for unprivileged builds has improved quite a bit since the early days.  It is now rare that a build needs root permissions for anything other than truly privileged operations, such as making device nodes.  To the best of my recollection, I have not seen any situations where permissions were not already suitable for unprivileged work.

----------

