LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-07-2009, 11:11 PM   #1
BeefyElbow
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Rep: Reputation: 1
Angry Rebooting from Nash on Failed Startup (Vanilla 2.6.28.6 from Fedora 10)


Hi all,

I've got an issue plaguing me at the moment that I'd appreciate some help with.

I have a system which was previously running Fedora 10, but now uses a Vanilla kernel 2.6.28.6. Everything works absolutely fine, and I've got no problems running the Vanilla kernel.

However, I have intermittent issues on boot, whereby the hard drive partitions are not correctly detected before /root is mounted. The system runs only SATA drives (1 HDD and 3 DVD+-RWs). The hard drive is partitioned into sda1(boot) sda2(swap) and sda3(data). LVMs are NOT in use. The SATA controller is a SiI3114.

Sequence of Events:
1) Boot the system normally n times, grub is run and the kernel is booted absolutely perfectly.
2) Reboot the system on the n+1th time, grub is run on the boot partition, and begins to do it's thing with the initrd image.
3) The init script fails on the line which mounts /dev/sda3 on /sysroot with the error:
mount: error mounting /dev/sda3 as ext3 on /sysroot: no such file or directory.

In the above, 'n' is a totally random number.

I've extracted my initrd image and hacked the init nash script. Using the "access" command, I can see that, on a failure, /dev/sda1, /dev/sda2 and /dev/sda3 are NOT present. A bit weird since /dev/sda1 is the boot partition that started the whole ball rolling.

I'd like to be able to reboot the system if my call to "access -f /dev/sda3" fails. Is this possible? I've tried copying the shutdown executable from /sbin to the initrd image sbin directory and rebuilding the image, but I get "Shutdown: unable to send message: Connection Refused" when that part of the init script is run.

I guess in a nutshell, what I'm asking is: How do I add an executable to my initrd image so that it's available from Nash on boot?

init script follows:

Code:
#!/bin/nash

mount -t proc /proc /proc
#setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/fb c 29 0
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
/lib/udev/console_init tty0
daemonize --ignore-missing /bin/plymouthd
plymouth --show-splash
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo Creating character device nodes.
mkchardevs
echo "Loading sata_sil module"
modprobe -q sata_sil
#modprobe scsi_wait_scan
#rmmod scsi_wait_scan
mkblkdevs
resume /dev/sda2
#echo Creating root device.
#mkrootdev -t ext3 -o defaults,ro /dev/sda3
#cond -ne 0 echo mkrootdev returned non-zero!
access -f /dev/sda1
cond -ne 0 echo Cannot find /dev/sda1
access -f /dev/sda2
cond -ne 0 echo Cannot find /dev/sda2
access -f /dev/sda3
cond -ne 0 echo Cannot find /dev/sda3
shutdown -r now
echo Mounting root filesystem.
#mount /sysroot
mount --ro -t ext3 /dev/sda3 /sysroot
cond -ne 0 plymouth --hide-splash
echo Setting up other filesystems.
setuproot
loadpolicy
plymouth --newroot=/sysroot
echo Switching to new root and running init.
switchroot
echo Booting has failed.
sleep -1
I know this is only a workaround, and the real issue is why the drives aren't detected, but this is an embedded app and the workaround will do until I can figure out what the heck is going on with my SATA drives.

TIA,

Beef
 
Old 07-08-2009, 09:20 AM   #2
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 285

Rep: Reputation: 61
This is a fairly common problem with fast motherboards. The solution is generally to increase the wait time before attempting to boot the OS to allow the disks to spin up and come online. Many mother boards have a
BIOS or EFI configuration option to adjust the wait time.
 
Old 07-08-2009, 03:36 PM   #3
BeefyElbow
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Original Poster
Rep: Reputation: 1
Thanks for the heads-up. My searches have found that it's very common for boots to fail every time, but less common for boots to fail with the irregularity I'm seeing.

Thanks for the info, I'll root through the BIOS settings and see what I can find.
 
Old 07-08-2009, 03:49 PM   #4
BeefyElbow
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Original Poster
Rep: Reputation: 1
Lightbulb Solved: Workaround

Well, it's not really a real solution to the problem, but I can get the behaviour I want using the following method:

1) In my init script, I use access -f to check for the existence of the /dev/sda<x> partitions.
2) If /dev/sda3 does not exist, I simply call exit
3) The init script exits, then the kernel is attempted to be booted. Of course, because the /dev/sda3 doesn't 'exist', and root hasn't been mounted, the kernel can't be booted properly, hence I get a kernel panic.
4) I added a little-known kernel option 'panic=1' to my kernel line in grub.conf. This reboots the system after a 1-second wait in the event of a kernel panic.
5) The system reboots and finds the drives correctly next time.

I only lose the time it takes from boot -> loading and failing the initrd image. From an external point-of-view this just looks like the system has a longer startup than usual (20-30 seconds). It's not perfect, but it does what I need it to (for now).

Hope this helps someone else in their google searches.
 
  


Reply

Tags
reboot, workaround


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to build a stock/vanilla kernel on a fedora 8 chipotphe Fedora 3 09-11-2008 02:21 PM
Dhcpcd rebooting router upon startup swampdog2002 Slackware 4 01-10-2008 06:01 AM
Red Hat nash version 4.2.15 (Fedora Core 4) Booting Problem infantaņoako Linux - Newbie 1 01-23-2007 10:53 AM
LPIC 1 Certification Bible by Angie Nash and Jason Nash RomanMoz Linux - Certification 3 12-30-2006 12:39 PM


All times are GMT -5. The time now is 03:33 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration