Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script to automatically reboot to newly compiled kernel with fallback Post 302382982 by tridus_08 on Sunday 27th of December 2009 09:16:45 PM
Old 12-27-2009
Script to automatically reboot to newly compiled kernel with fallback

Hi,
I'm new here. Just started playing around with kernel compilation.
I need a little bit of advice.
I'm trying to do a bash script to automatically compile a kernel package and reboot to that new kernel by default, with fallback to the old kernel.
So far, I'm getting stuck at the part where I need to reboot and load the new kernel as default.
I'm intending for this script to be used on systems using grub (legacy).

If I'm not wrong, I would need to change the menu.lst file to something like this:
Code:
default saved
fallback 1
timeout 5

title New, kernel 2.x.xa
root (hd0,0)
kernel /new root=/dev/sda1
initrd /boot/initrd.img-2.x.xa
savedefault 1

title Orig, kernel 2.x.xb
root (hd0,0)
kernel /old root=/dev/sda1
initrd /boot/initrd.img-2.x.xb

title Other, kernel 2.x.xc
root (hd0,0)
kernel /old root=/dev/sda1
initrd /boot/initrd.img-2.x.xc

If so, how should I go about to manipulate the menu.lst file?
I'm guessing that I might need to use awk to parse through the file, count the entries to get the entry number of the new kernel and the original kernel.
If that is the case, how can I do that with awk? (Not too good with awk, I usually use sed. )
Or are there better alternatives to this?
Thanks in advance.

Last edited by pludi; 12-28-2009 at 02:42 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. AIX

Automatically mounting a filesystem after a reboot

Hi All, I am new to AIX. I am having problems mounting a filesystem after a system reboot. Steps: 1. Create and Map LUN to host 2. On the host, to detect/configure the LUN: /usr/sbin/cfgmgr 3. Create a filesystem: mkfs -V vxfs /dev/hdisk757 4. Create a mountpoint: mkdir -p... (3 Replies)
Discussion started by: austin4397
3 Replies

2. Red Hat

Kernel panic after hard reboot and fsck

Could you please help with problem with megaraid controller and Dell PowerEdge 2850, all that I can see on thi screenshot: All drives successfuly passed verifing from LSI controllers (Ctrl+A at startup), also I tried to boot from rescue llive cd and mount all the morrored drives and check... (22 Replies)
Discussion started by: nikkadim
22 Replies

3. UNIX for Dummies Questions & Answers

Make sure kernel was compiled with NFS server support

Hi there, I have a Debian Squeeze server. How can I check if my kernel was compiled with NFS server support? Extra question: if it is not, how do I enable NFS support in my kernel? Thanks for your help. Santiago (3 Replies)
Discussion started by: chebarbudo
3 Replies

4. Solaris

Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags

Hello experts, This issue has kept me busy all day long. It started off with openssl compilation which was giving linking error with following message: /usr/local/bin/ld: target elf32-sparc not found collect2: ld returned 1 exit status I tried every step possible thing that I could think... (2 Replies)
Discussion started by: d_shanke
2 Replies

5. Shell Programming and Scripting

How to run script automatically on reboot as root user?

Hi friends,,, I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory /myserver/start_server.sh How can I do this ? and some scripts I am having that I... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

6. AIX

Loading AIX kernel extensions on reboot

Greetings, Does anyone know how to load AIX kernel extensions on reboot? I know that Oracle loads it's postwait kernel extension via a executable in /etc/inittab. I'm assuming this executable calls the "sysconfig" system call and loads it. What if I wrote my own? What is the proper way in AIX to... (3 Replies)
Discussion started by: jbleistein
3 Replies

7. AIX

How can we re-mount the RAM disk automatically after the reboot on AIX?

Hi All, I was trying to know more about RAM disk concept in AIX. I found something on IBM site. I was able to create and use/delete RAM disk as per IBM instructions. But as you guys know, this RAM disk is a temporary storage. (*when ever we reboot the AIX LPAR, content/RAM disk will be... (4 Replies)
Discussion started by: System Admin 77
4 Replies

8. IP Networking

[ipv6_test] Kernel is not compiled with IPv6 support

Hello, i tried to enable IPv6 networking and after service network restart i seen these messages: FATAL: Error inserting ipv6 (/lib/modules/2.6.18-348.16.1.el5.028stab108.1/kernel/net/ipv6/ipv6.ko): Device or resource busy CRITICAL : Kernel is not compiled with IPv6 support Bringing up... (6 Replies)
Discussion started by: postcd
6 Replies

9. Red Hat

Update kernel Linux without reboot?!

Hi Is it a way ? When Linux kernel updated that don't want reboot it means without reboot the new kernel performances Thanks (7 Replies)
Discussion started by: mnnn
7 Replies

10. Shell Programming and Scripting

Run a script before and after reboot automatically and send output to two locations.

Hello Team . I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are 1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ? 2. The same... (2 Replies)
Discussion started by: Varja
2 Replies
MKDUMPRD(8)							   User Manuals 						       MKDUMPRD(8)

NAME
mkdumprd - (Re)build the initramfs for kdump SYNOPSIS
mkdumprd [-h] [-q] [-f] [-k kernelver] [-i opts] DESCRIPTION
mkdumprd (re-)builds the kdump initrd. For kdump, a special initrd is used because o the kdump initrd should include network modules and network configuration (and therefore is larger as the normal initrd used for booting), o the kdump initrd should use no splash screen, o the kdump initrd includes kdumptool(8) and all required libraries. This script calls mkinitrd(8) with all required parameters. If the initrd already exists, it checks first if the configuration file or the kernel are newer, and only rebuilds the initrd if necessary. OPTIONS
All option parsing is done via the getopt(3) function, and therefore follows all standard command line parsing rules. -h | --help Shows help output and exits. -k kernelversion Specifies the kernel version. If no version is specified and also no kernel or initrd are specified, then mkdumprd uses kdumptool(8) to find out the correct kernel and initrd. -K kernel Specifies the kernel binary. If you specify that option, also specify -I. -I initrd Specifies the resulting initrd. If you specify that option, also specify -K. -q Be quiet. Don't output status messages. Used to call mkdumprd(8) from /etc/init.d/kdump init script. -i parameters Append the specified parameters to mkinitrd(8) call. FILES
/etc/sysconfig/kdump Kdump configuration. See kdump(5). BUGS
Please report bugs and enhancement requests at https://bugzilla.novell.com. COPYING
Copyright (c) 2008 Bernhard Walle <bwalle@suse.de>. Free use of this software is granted under the terms of the GNU General Public License (GPL), version 2 or later. SEE ALSO
kdumptool(8), mkinitrd(8), http://en.opensuse.org/Kdump kdump 0.8.1 07/05/2010 MKDUMPRD(8)
All times are GMT -4. The time now is 10:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy