You are not logged in.

#1 2009-03-02 18:55:44

Milosz
Member
From: Ottawa, Canada
Registered: 2009-03-02
Posts: 4
Website

Kernel Panic

Hello,

I tried doing something weird during an installation and my system crashed. Shock and awe. But perhaps someone could help me out with this. My goal is to create a system that has only a kernel, a shell, a text editor, a bootloader, and any dependencies for the previous 4 items. It's for a computer of mine that has more than one operating system on it, but no Linux. I have created a 250 MB partition with the purpose of harboring a tiny Linux installation that serves 2 purposes: managing a GRUB that would allow me to select the other operating systems the way I like to select operating systems, and having a powerful file removal tool in case of infection of one of the Windowses. This installation does not need to be updateable and therefore needs no package manager. It also needs no networking. I got my hands on an Arch LiveCD (~700MB) and I carefully chose the packages from base that I would be needing. At first I installed them all in one chunk, but automatic order chosen for their installation created some conflicts. So, I split the package installation into 2 chunks. Chunk 1:

findutils, grep, gzip, mktemp, sed, udev (dependencies: kernel-headers, glibs, ncurses, readline, bash, gcc, pcre, db, cracklib, pam, shadow, attr, acl, coreutils, zlib, e2fsprogs, util-linux)

Chunk 2:

kernel, vi, grub (non-overlapping dependencies: module-init-tools, klibc, klibc-extras, klibc-udev, gen-init-cpio, mkinitcpio)

The installation went swimmingly. I was met with no errors in my tty5. I booted up the machine. Grub worked fine, listing my other operating systems and my tiny Arch Linux partition. I choose the Arch Linux partition to make sure everything is fine. Everything is not fine:

...
Waiting 0 s before mounting root device...
kinit: Mounted root (ext2 filesystem) readonly.
sh: root=/dev/sda3: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

It is beyond doubt that the Arch Linux installation is in fact on /dev/sda3. Furthermore, in several ways my computer has proven to me that it is aware of it. For one, it booted GRUB with no errors. Second, it mounted an ext2 filesystem readonly and the only ext2 filesystem is on /dev/sda3. Furthermore, I can see the ext2 partition from Windows (ext2IFS) all the files and folder look to me like a healthy Linux installation. The only saving grace here is that it's sh that caused the error. Apparently, one of my scripts failed. Does anyone have any suggestions? My guess is that I didn't install a package from base that I should have installed.

Offline

#2 2009-03-02 23:40:29

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

Two things that come to my mind:
• initial ramdisk doesn't give the kernel the means to mount partition, so you should revise mkinitcpio's configs, initrd's creation process, initrd's placement and grub's option,
• don't be angry about that smile—are you perfectly sure that your root partition is placed on third primary partition of first hdd? Like I said: don't be angry about this question: grub use different convention to denote disks and partitions than linux does, so it can run perfectly ok when kernel fails to mount /dev/sda3. You can check what partition grub uses as "root" by pressing "e" when "archlinux" position is highlighted on grub's boot menu. If grub files are indeed on /dev/sda3 then you sould be able to see "root (hd0,2)" in grub options. If so then the first "thing" is more probable.


It's not the best thing when they call you a "member" you know… wink

Offline

#3 2009-03-03 00:30:15

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Kernel Panic

Show us the GRUB config.

Offline

#4 2009-03-03 22:57:10

Milosz
Member
From: Ottawa, Canada
Registered: 2009-03-02
Posts: 4
Website

Re: Kernel Panic

menu.lst

# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst

# DEVICE NAME CONVERSIONS 
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/hda        (hd0)
#  /dev/hdb2       (hd1,1)
#  /dev/hda3       (hd0,2)
#

#  FRAMEBUFFER RESOLUTION SETTINGS
#     +-------------------------------------------------+
#          | 640x480    800x600    1024x768   1280x1024
#      ----+--------------------------------------------
#      256 | 0x301=769  0x303=771  0x305=773   0x307=775
#      32K | 0x310=784  0x313=787  0x316=790   0x319=793
#      64K | 0x311=785  0x314=788  0x317=791   0x31A=794
#      16M | 0x312=786  0x315=789  0x318=792   0x31B=795
#     +-------------------------------------------------+

# general configuration:
timeout   2
default   0
color light-blue/black light-cyan/blue

# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

title Windows BOOTMGR (fixme)
rootnoverify (hd0,0)
makeactive
chainloader +1

title  Arch Linux
root   (hd0,2)
kernel /boot/vmlinuz26 root=/dev/sda3 ro vga=0x361
initrd /boot/kernel26.img

mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES="ata_generic ahci ata_piix"

# BINARIES
# This setting includes, into the CPIO image, and additional
# binaries a given user may wish.  This is run first, so may
# be used to override the actual binaries used in a given hook.
# (Existing files are NOT overwritten is already added)
# BINARIES are dependancy parsed, so you may safely ignore libraries
BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in anyway.  This is useful for config files.
# Some users may wish to include modprobe.conf for custom module options,
# like so:
#    FILES="/etc/modprobe.conf"
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'modload' may be used in place of 'udev', but is not recommended
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
#    This setup specifies all modules in the MODULES setting above.
#    No raid, lvm2, or encrypted root is needed.
#    HOOKS="base"
#
#    This setup will autodetect all modules for your system and should
#    work as a sane default
#    HOOKS="base udev autodetect ide scsi sata filesystems"
#
#    This setup will generate a 'full' image which supports most systems.
#    No autodetection is done.
#    HOOKS="base udev ide scsi sata usb filesystems"
#
#    This setup assembles an ide raid array with an encrypted root FS.
#    Note: See 'mkinitcpio -H raid' for more information on raid devices.
#    HOOKS="base udev ide raid encrypt filesystems"
#
#    This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev usb lvm2 filesystems"
HOOKS="base udev autodetect pata scsi sata filesystems"

I can't find anything strange in these two files. Other than the suggested device name conversions tongue. I've never dealt with initrd before. What are some associated configuration files?

Offline

#5 2009-03-03 23:23:44

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

Yep! "menu.lst" seems ok… the names too wink.

So it appears that you've got to check your initrd for neccessary modules and files. Use

bsdtar -tf /boot/kernel26.img

to list ramdisk contents and to see if there's a module to handle ext2 filesystem (can post the result here).

You might be interrested in this thread: http://bbs.archlinux.org/viewtopic.php?id=59832.

As for initrd and its config files. Initrd is created by e.g. mkinitcpio (arch default). One of possible mkinitcpio config files is "/etc/mkinitcpio.conf". You can read more about configuring mkinitcpio in arch wiki: http://wiki.archlinux.org/index.php/Con … mkinitcpio.


It's not the best thing when they call you a "member" you know… wink

Offline

#6 2009-03-03 23:25:48

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Kernel Panic

I think I understand. You didn't install sysvinit, so there's no /sbin/init. Therefore the kernel falls back on /bin/sh. Since you're also trying to start up in full multiuser mode, it passes the appropriate arguments to /bin/sh that it would pass to init. So it runs

/bin/sh root=/dev/sda3 ...

sh interprets arguments as scripts to run, so therefore the error:

sh: root=/dev/sda3: No such file or directory

that you got.

Either install sysvinit and initscripts, or boot single-user by putting "single" on the end of your kernel command line.

Offline

#7 2009-03-04 11:20:44

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

ataraxia wrote:

I think I understand. You didn't install sysvinit, so there's no /sbin/init. Therefore the kernel falls back on /bin/sh. Since you're also trying to start up in full multiuser mode, it passes the appropriate arguments to /bin/sh that it would pass to init. So it runs

/bin/sh root=/dev/sda3 ...

sh interprets arguments as scripts to run, so therefore the error:

sh: root=/dev/sda3: No such file or directory

that you got.

Either install sysvinit and initscripts, or boot single-user by putting "single" on the end of your kernel command line.

Quite cunning! smile

We me both be right since "sysvinit" contains "init" binary and also this "init" must be a part of initrd. So while generating initrd one needs "sysvinit" to be there.


It's not the best thing when they call you a "member" you know… wink

Offline

#8 2009-03-04 16:17:23

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Kernel Panic

The "init" I'm talking about is the one not inside the initrd. The one that's inside the initrd is just a shell script. I don't know if there really is a dependency of building an initrd on sysvinit for other reasons, though. You might be the only one who is trying to do it big_smile

Offline

#9 2009-03-04 17:38:57

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

[slam!]

OK… ataraxia: you right, me wrong! wink (don't know what I was thinking wink)


It's not the best thing when they call you a "member" you know… wink

Offline

#10 2009-03-04 22:50:57

Milosz
Member
From: Ottawa, Canada
Registered: 2009-03-02
Posts: 4
Website

Re: Kernel Panic

Thank you to both of you for all your help! The system booted up in full after I installed the init packages. ataraxia was right, though I'd like to point out for future reference that booting into single-user mode without installing these packages did not work and threw the same errors.

Now I'm dealing with a new problem - setting the hostname to localhost failed, ifconfig doesn't exist and I can't get into a shell because there is no user database, so I'm stuck at a prompt that says "(none) login:" and doesn't accept any login information ("root" is not a valid user). A commonsensical person would give up and either enlarge the partition to allow for a full installation, or just use DSL, but my stubborn personality is making me keep trying this until I get it right, haha.

It would be nice to know what commands/programs come from what package. For instance, I'd like to get ifconfig because it appears to be indispensable. I'd also like to know where the passwd tools are. Does anyone know where to obtain a list of core Arch Linux commands organized by package of origin? I've scoured the internet to the best of my ability but didn't come up with much of use.

P.S.: Cześć Bodzio tongue

Last edited by Milosz (2009-03-04 22:51:30)

Offline

#11 2009-03-04 23:50:29

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

Milosz wrote:

Now I'm dealing with a new problem - setting the hostname to localhost failed, ifconfig doesn't exist and I can't get into a shell because there is no user database, so I'm stuck at a prompt that says "(none) login:" and doesn't accept any login information ("root" is not a valid user).

As for "ifconfig" and "hostname" you need "net-tools". Don't know if you created some user during installation so you may need to fiddle with "/etc/passwd" and "/etc/shadow" hashes smile.

Milosz wrote:

A commonsensical person would give up and either enlarge the partition to allow for a full installation, or just use DSL, but my stubborn personality is making me keep trying this until I get it right, haha.

…or die trying wink but let's hope it won't happen wink

Milosz wrote:

It would be nice to know what commands/programs come from what package. For instance, I'd like to get ifconfig because it appears to be indispensable. I'd also like to know where the passwd tools are. Does anyone know where to obtain a list of core Arch Linux commands organized by package of origin? I've scoured the internet to the best of my ability but didn't come up with much of use.

In fact… I think that's a good idea to attach a list of files a package provides in its description on arch website. This could even help in tracking "owning same file" conflicts type. However I think it would be too much to push such info trough sync db (waste of bandwidth IMHO).

Milosz wrote:

P.S.: Cześć Bodzio tongue

A tak właśnie podejrzewałem narodowość smile. Pozdrowienia z Polski!

[translation: I've suspected such nationality smile. Greetings from Poland!]


It's not the best thing when they call you a "member" you know… wink

Offline

#12 2009-03-10 12:29:28

Milosz
Member
From: Ottawa, Canada
Registered: 2009-03-02
Posts: 4
Website

Re: Kernel Panic

Hey,

Just decided I'd post about the aftermath of my little experiment. I wasn't able to figure this out completely. Every time I solved one problem, another came up. It seems that almost all of the packages from base are essential to the functioning of Arch Linux. I ended up enlarging the partition by a couple hundred megabytes and installing (almost) all of base.

Like any other failure, this was a good learning experience. Thanks to both of you for your help!

@ TheBodziO: Odwzajemniam pozdrowienia, lecz moje są z Kanady!

Offline

#13 2009-03-10 18:22:18

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Kernel Panic

At least we all know that "base" is really "base" wink

@Milosz: Dzięki, dzięki! smile


It's not the best thing when they call you a "member" you know… wink

Offline

Board footer

Powered by FluxBB