Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 128845 - Problem with reboot.sh script and /sbin/reboot (kexec-related)
Summary: Problem with reboot.sh script and /sbin/reboot (kexec-related)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 17:38 UTC by Chris Slycord
Modified: 2006-04-07 17:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Slycord 2006-04-04 17:38:06 UTC
In my .bashrc I have the following entry:
alias reboot="sudo /sbin/reboot -idp"

And my /etc/init.d/reboot.sh looks like this:
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

/sbin/reboot -idpk

# hmm, if the above failed, that's kind of odd ...
# so let's force a reboot
/sbin/reboot -f

I would expect, when I type "reboot", for the system to reboot to the bios, as bashrc sets the alias. But instead, I end up with the system restarting using kexec and avoiding the bios. And when I edited the reboot.sh file to remove the "k" option it rebooted to the bios. So this means that something's going on where the alias I set is being avoided altogether.

Not sure if this is a bash or baselayout issue.

Portage 2.1_pre7-r4 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.4-r1, 2.6.15-a rchck7 i686)
=================================================================
System uname: 2.6.15-archck7 i686 AMD Athlon(tm) XP 3000+
Gentoo Base System version 1.6.14
distcc 2.18.3 i586-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disable d]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X1 1/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/t erminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe -fvisibility-inlines-h idden"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical"
FEATURES="autoclean autoconfig candy ccache distlocks maketest metadata-transfer  nostrip parallel-fetch prelink sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://localhost http://distfiles.gentoo.org"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow X aac aalib alsa audiofile avi bash-completion bitmap-fonts brows erplugin bzip2 cdr divx4linux dvd dvdr dvdread encode f77 ffmpeg fortran gif gno me gtk gtk2 imlib jpeg lcms mad mikmod mmx mp3 mpeg ncurses nls nptl nptlonly ns plugin ogg oggvorbis opengl oss pam pic png python quicktime readline real sdl s lang spell sse ssl tcpd tiff truetype unicode userlocales vorbis win32codecs wmf  xml xml2 xmms xv xvid zlib elibc_glibc input_devices_keyboard input_devices_mou se kernel_linux userland_GNU video_cards_nvidia"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS

And here's the relevant bash version info
[ebuild   R   ] app-shells/bash-3.0-r12  USE="-bashlogger -build nls" 0 kB
Comment 1 Chris Slycord 2006-04-04 19:23:01 UTC
Now I am even more confused.

With reboot.sh looking like this:
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

/sbin/reboot -idpk

# hmm, if the above failed, that's kind of odd ...
# so let's force a reboot
/sbin/reboot -f

I then entered (as root) "/sbin/reboot -idp" and it restarted using kexec.
Then I removed the "k" in reboot.sh and again entered "/sbin/reboot -idp" and was rebooted to bios.

This makes absolutely no sense to me. The way a command responds shouldn't be effected by another script that can be used to call that command.
Comment 2 SpanKY gentoo-dev 2006-04-07 17:40:07 UTC
if you look at the source code of sysvinit you'll see that the behavior of running reboot depends largely on what init level you're currently in

i mentioned this user-unfriendliness upstream with the kexec project but i dont recall them being able to come to a solution ... iirc, i pushed for something like `reboot -k` to use kexec but `reboot -K` to not use kexec

what i do is add the kexec init.d script to my default run level so that the kernel gets tagged automatically at boot for use with kexec ... but if i want to reboot into the bios, i stop the kexec script before rebooting

so try changing your alias to something like:
alias reboot='sudo /etc/init.d/kexec stop ; sudo reboot'