Bug 215084 - init ignore runlevel when it comes after a resume= kernel arg
init ignore runlevel when it comes after a resume= kernel arg
Product: Fedora
Classification: Fedora
Component: mkinitrd (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Jones
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2006-11-10 15:44 EST by Tobias Oed
Modified: 2008-05-06 12:46 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-06 12:46:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tobias Oed 2006-11-10 15:44:15 EST
Description of problem:
If I have resume=/dev/hda3 kernel parameter and add a 3 after it to boot to
runlevel 3 instead of default 5, init ignore it. If I put the 3 before the
resume arg it works

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. reboot your machine to grub
2. add resume=/dev/swap 3 to kernel params
2. boot
Actual results:
goes to runlevel 5

Expected results:
runlevel 3

Additional info:
If the 3 comes before the resume arg it works
Comment 1 Bill Nottingham 2006-11-10 15:48:17 EST
What are you trying to do - at what runlevel were you suspended?
Comment 2 Tobias Oed 2006-11-10 16:28:22 EST
I'm not suspended at all. Clean shutdown, trying to boot to runlevel 3. The
resume= arg is incidental: the machine won't resume because there is no resume
data in that swap partition. It's in my grub config for the case that I did
suspend which is not the case here. 
I wanted to boot to runlevel 3 so I added '3' at the end of the grub line, but
it went all the way to runlevel 5. After a few tries I found out I had to put
the 3 before the resume arg or remove the resume arg altoghether. 
It took me couple of reboots to get to runlevel 3 which is kind of anoying.
Does that make more sense?
Comment 3 Bill Nottingham 2006-11-10 16:49:41 EST
mkinitrd is truncating the arguments to init. Assigning there.
Comment 4 Tobias Oed 2006-11-11 21:12:15 EST
The following 1 liner fixes the issue for me.
The copy of the string doesn't get freed but given the general leakiness of
nash, I guess it's ok.

--- nash.c.orig 2006-09-14 19:47:49.000000000 +0200
+++ nash.c      2006-11-12 03:08:22.000000000 +0100
@@ -1365,6 +1365,7 @@
     if (resumedev == NULL) {
         resumedev = resume;
+    resumedev = strdup(resumedev);
     n = strcspn(resumedev, " \t\r\n");
     resumedev[n] = '\0';
Comment 5 Peter Jones 2006-11-14 11:45:55 EST
Committing this instead (as nash is _not_ generally leaky):

diff -u -p -r1.172 nash.c
--- nash/nash.c 14 Sep 2006 17:47:49 -0000      1.172
+++ nash/nash.c 14 Nov 2006 16:37:28 -0000
@@ -1366,7 +1366,10 @@ resumeCommand(char * cmd, char * end)
         resumedev = resume;
     n = strcspn(resumedev, " \t\r\n");
-    resumedev[n] = '\0';
+    if (!(resumedev = strndupa(resumedev, n))) {
+        eprintf("Unable to find resume device: %m\n");
+        return 1;
+    }
     qprintf("Trying to resume from %s\n", resumedev);
Comment 6 Tobias Oed 2006-11-15 14:05:31 EST
That's better than my attempt :)
I compiled it, and installed a kernel with it. That kernel boots to expected
Thanks Tobias.
Comment 7 Bug Zapper 2008-04-04 00:35:38 EDT
Fedora apologizes that these issues have not been resolved yet. We're
sorry it's taken so long for your bug to be properly triaged and acted
on. We appreciate the time you took to report this issue and want to
make sure no important bugs slip through the cracks.

If you're currently running a version of Fedora Core between 1 and 6,
please note that Fedora no longer maintains these releases. We strongly
encourage you to upgrade to a current Fedora release. In order to
refocus our efforts as a project we are flagging all of the open bugs
for releases which are no longer maintained and closing them.

If this bug is still open against Fedora Core 1 through 6, thirty days
from now, it will be closed 'WONTFIX'. If you can reporduce this bug in
the latest Fedora version, please change to the respective version. If
you are unable to do this, please add a comment to this bug requesting
the change.

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we are following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

And if you'd like to join the bug triage team to help make things
better, check out http://fedoraproject.org/wiki/BugZappers
Comment 8 Bug Zapper 2008-05-06 12:46:31 EDT
This bug is open for a Fedora version that is no longer maintained and
will not be fixed by Fedora. Therefore we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen thus bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.