# genkernel - removing initramfs

## MrMe01

Just a quick question,

How do I remove initramfs without the system panicking? I've extracted the initramfs onto the system but it panics. Does genkernel inform the kernel that it'll be built with an initramfs? If so, how can I change that without recompiling the kernel?

----------

## NeddySeagoon

MrMe01,

Genkernel builds a fully modular kernel and puts the modules into the initrd.

The initrd is a temporary root filesystem in a file.

The bootloader loads the kernel and initrd into RAM and jumps to the kernel start address.

The kernel decompresses itself, does some initlaisation, then mounts the initrd as its root filesystem.

It loads the modules.

Some of these modules are needed to mount the real root filesystem, since they are for your SATA chip set, file systems and so on.

Unaided, a genkernel kernel knows how to mount the initrd as root but it cannot communicate with the HDD.  That's one of the things the initrd provides.

You need a kernel that can mount the HDD root without outside help.

Pappy wrote it up at kernel-seeds.  The method is still valid but the seeds are out of date.

You can still use genkernel if you must but you need to switch some settings from <M> to <*>.

Then you don't need an initrd at all.

----------

## MrMe01

Thanks NeddySeagoon,

I asked as a quick and dirty workaround for the problem I'm facing here,

https://forums.gentoo.org/viewtopic-t-1034188-highlight-.html

I'm not sure if this is on the system or inside the initramfs.

----------

## szatox

 *Quote:*   

>  I've extracted the initramfs onto the system but it panics

 

What is the message for kernel panic?

Also, whow us your bootloader config and /etc/fstab.

Modules needed for SATA controller is one thing, but it's also possible your boot options are incorrect with the new setup

----------

## MrMe01

 *szatox wrote:*   

>  *Quote:*    I've extracted the initramfs onto the system but it panics 
> 
> What is the message for kernel panic?
> 
> Also, whow us your bootloader config and /etc/fstab.
> ...

 

Running GRUB 0.97, with the line for initramfs #'ed out, fstab is setup for a single partition. I just rebooted with fstab in place, no difference.

I should explain that I'm trying to make a modular set of images, as explained here https://forums.gentoo.org/viewtopic-t-1034188-highlight-.html, at the moment I'm just hacking stuff to get me from GRUB to the CLI login prompt.

----------

## Buffoon

Kernel has to mount root filesystem in order fstab being read. Genkernel has HDD controller support as module in initramfs. Remove it and it will never gain access to the hard drive.

----------

## MrMe01

 *Buffoon wrote:*   

> Kernel has to mount root filesystem in order fstab being read. Genkernel has HDD controller support as module in initramfs. Remove it and it will never gain access to the hard drive.

 

I've worked that out  :Razz: 

I'm just trying to hack a system together from GRUB to CLI login at the moment, as I've previously commented on. I just want to know how the system boots and what files are used to get there, but I've come unstuck. I'd appreciate any input you'd have on this though, https://forums.gentoo.org/viewtopic-t-1034188-highlight-.html.

I'm trying to work out if what's going on is inside the initramfs or on the filesystem itself as I do see (booting) initramfs 

http://s23.postimg.org/rai15h6kb/seg.png

----------

## NeddySeagoon

MrMe01,

From your image, the initrd has done its stuff, or was not needed as OpenRC is running.

What do you have in /etc/group and /etc/passwd?

There are no passwords in /etc/passwd any more.

----------

## szatox

 *Quote:*   

> Kernel has to mount root filesystem in order fstab being read.

 

Kernel can't read fstab posted at the forums either. However this:

 *Quote:*   

> show me you grub.conf and fstab

 

is much more clear than this:

 *Quote:*   

> describe your general setup in a way you think would give us some insight into your position allowing us spot potential pitfalls, so we can waste time reading something completely useless because if you knew what is suitable you would have already posted it in the first place to get you precious hints sooner

 

And finding the pitfalls is much easier when we know what you're doing and how you fail.

----------

## MrMe01

 *szatox wrote:*   

>  *Quote:*   Kernel has to mount root filesystem in order fstab being read. 
> 
> Kernel can't read fstab posted at the forums either. However this:
> 
>  *Quote:*   show me you grub.conf and fstab 
> ...

 

Your point being?

If you had read the first post on the other thread, you'd know I'm not looking for a run of the mill answer.

From that same thread, in the first post, you'd also see that GRUB was working. It's also quite plausible that fstab was not to blame here as it's not needed this early in the boot process. In fact, I'd hazard a guess that init would complain about it not being there, after the panic not having an initramfs would cause.

----------

## szatox

My point being you don't bother to read, refuse to provide clues, and expect a helpful answer pulled out of the thin air.

We've asked you about 5 or 6 different things, you failed to provide any of them. Fine, stay where you are.

----------

## MrMe01

 *szatox wrote:*   

> My point being you don't bother to read, refuse to provide clues, and expect a helpful answer pulled out of the thin air.
> 
> We've asked you about 5 or 6 different things, you failed to provide any of them. Fine, stay where you are.

 

To reiterate what I am doing, because I obviously have not made it clear;

I have a clone of a system that I have deliberately broken by moving all but the files in /kernel (see below) into a folder called 1, I am moving files from that folder where the original system structure remains . I am making a list of the files that is required to boot the system, by making it break and giving it what it needs. So far it has not asked for an fstab. Therefore, I haven't copied it into /etc. I am using ldd to determine the .so* files required. This has stopped working. I am using my DSLR to capture the screen before what I assume is agetty takes over and removes anything of value from the screen.

It's GRUB 0.97, this isn't complicated to work out what it looks like.

I haven't copied in the files Neddy had mentioned as I'm stumped for an answer as to what the system is looking for next. I have copied in /etc/passwd and group, but the error remains. 

But, for the sake of what you're asking for,

```

grub.conf

title Gentoo Linux (sda2 kernel)

root (hd0,1)

kernel /kernel/kernel-genkernel-x86-4.1.12-gentoo root=/dev/sda2 

initrd /kernel/initramfs-genkernel-x86-4.1.12-gentoo

```

/kernel to make sure it's booting the right partition

```

fstab

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

#/dev/BOOT      /boot      ext2      noauto,noatime   1 2

/dev/sda2         /      ext3      noatime      0 1

/dev/SWAP      none      swap      sw      0 0

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

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

```

Group

root:x:0:root

bin:x:1:root,bin,daemon

daemon:x:2:root,bin,daemon

sys:x:3:root,bin,adm

adm:x:4:root,adm,daemon

tty:x:5:

disk:x:6:root,adm

lp:x:7:lp

mem:x:8:

kmem:x:9:

wheel:x:10:root

floppy:x:11:root

news:x:13:news

uucp:x:14:uucp

console:x:17:

audio:x:18:

cdrom:x:19:

tape:x:26:root

video:x:27:root

cdrw:x:80:

usb:x:85:

users:x:100:

portage:x:250:portage

utmp:x:406:

nogroup:x:65533:

nobody:x:65534:

sshd:x:22:

man:x:15:

input:x:249:

```

```

passwd

root:x:0:0:root:/root:/bin/bash

bin:x:1:1:bin:/bin:/bin/false

daemon:x:2:2:daemon:/sbin:/bin/false

adm:x:3:4:adm:/var/adm:/bin/false

lp:x:4:7:lp:/var/spool/lpd:/bin/false

sync:x:5:0:sync:/sbin:/bin/sync

shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown

halt:x:7:0:halt:/sbin:/sbin/halt

news:x:9:13:news:/var/spool/news:/bin/false

uucp:x:10:14:uucp:/var/spool/uucp:/bin/false

operator:x:11:0:operator:/root:/bin/bash

portage:x:250:250:portage:/var/tmp/portage:/bin/false

nobody:x:65534:65534:nobody:/var/empty:/bin/false

sshd:x:22:22:added by portage for openssh:/var/empty:/sbin/nologin

man:x:13:15:added by portage for man-db:/usr/share/man:/sbin/nologin

```

I hope this helps.

----------

## MrMe01

Here's a list of the files I have so far.

```
/kernel

      initramfs-genkernel-x86-4.1.12-gentoo

      kernel-genkernel-x86-4.1.12-gentoo

/sbin

      agetty

      halt

      init

      openrc

      rc

      reboot

      shutdown

      switch_root

/lib

      ld-2.21.so

      ld-linux.so.2

      libblkid.so.1

      libblkid.so.1.1.0

      libc-2.21.so 

      libc.so.6

      libdl-2.21.so

      libdl.so.2

      libeinfo.so

      libeinfo.so.1

      libmount.so.1

      libmount.so.1.1.0

      libncurses.so.5

      libncurses.so.5.9

      libpam.so.0

      libpam.so.0.84.1

      libpcre.so.1

      libpcre.so.1.2.4

      libpthread-2.21.so

      libpthread.so.0

      librc.so

      librc.so.1

      libreadline.so.6

      libreadline.so.6.3

      libutil-2-21.so

      libutil.so.1

      libuuid.so.1

      libuuid.so.1.3.0

      /rc

         /bin

            eerror

            eval_ecolors

            ebegin

            fstabinfo

            einfo

            mountinfo

            checkpath

         /sh

            init.sh

            functions.sh

            gendepends.sh

            rc-functions.sh

/etc

      inittab

/bin

      sh

      bash

      mount

      cat

      grep
```

----------

## NeddySeagoon

MrMe01,

Edit your inittab ...

```
# TERMINALS

c1:12345:respawn:/sbin/agetty 38400 --noclear tty1 linux
```

that will stop the terminal being cleared at the end of the boot process. 

What do you have in /dev and how is /dev being porulated?

The kernel option DEVTMPFS is one answer but if /dev is empty, not much happens.

You need at least /dev/null and /dev/console device nodes.  You don't seen to have a /dev at all.

With /etc/init.d and /etc/conf.d both empty, Openrc won't find any of the scripts and configs that it needs.

```
roy@NeddySeagoon_Static ~ $ /sbin/rc-update | grep sys

                devfs |                       sysinit

                dmesg |                       sysinit                       

                sysfs |                       sysinit

         tmpfiles.dev |                       sysinit
```

You need to get those services running.  More conventional users than me will have udev or a udev replacement.

I have a static /dev. 

You will also find 

```
$ /sbin/rc-update | grep boot

               binfmt | boot                         

             bootmisc | boot                         

                 fsck | boot                         

             hostname | boot                         

              hwclock | boot                         

              keymaps | boot                         

           localmount | boot                         

             loopback | boot                         

              modules | boot                         

                 mtab | boot                         

               net.lo | boot                         

               procfs | boot                         

                 root | boot                         

                 swap | boot                         

            swapfiles | boot                         

               sysctl | boot                         

         termencoding | boot                         

       tmpfiles.setup | boot                         

              urandom | boot          

```

useful.  Well, swapfiles is only useful if you have swap in a file.

----------

