Project

General

Profile

Bug #12256

reboot(1m) looks for 32-bit kernel only

Added by Marcel Telka 12 months ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

# beadm create new
Created successfully
# reboot -f -- rpool/ROOT/new
reboot: rpool/ROOT/new is not a root disk or dataset
# truss reboot -f -- rpool/ROOT/new 2>&1 | grep unix
stat64("/tmp/.fastboot.root/platform/i86pc/kernel/unix", 0x08045C90) Err#2 ENOENT
#

Related issues

Related to illumos gate - Feature #8685: uts and mdb: do not build 32bit kernelClosedToomas Soome2017-09-26

Actions
#1

Updated by Marcel Telka 12 months ago

  • Related to Feature #8685: uts and mdb: do not build 32bit kernel added
#2

Updated by Marcel Telka 12 months ago

Root cause

The problem seems to be that validate_disk() does this (unconditionally):

648    (void) snprintf(kernpath, MAXPATHLEN, "%s/platform/i86pc/kernel/unix",
649        mountpoint);
650
651    if (stat64(kernpath, &statbuf) != 0) {
652        (void) fprintf(stderr,
653            gettext("%s: %s is not a root disk or dataset\n"),
654            cmdname, arg);
655        return (1);
656    }

The validate_disk() is called from parse_fastboot_args() and few lines after the call there is platform detection implemented, but it is too late for us:

1102    /*
1103     * If BE is not specified, look for disk argument to construct
1104     * mountpoint; if BE has been specified, mountpoint has already been
1105     * constructed.
1106     */
1107    if (newarg && newarg[0] != '-' && !bename) {
1108        int tmprc;
1109
1110        if ((tmprc = validate_disk(newarg, mountpoint)) == 0) {

...

1132        }
1133    }

...

1143    /*
1144     * Look for unix argument
1145     */
1146    if (newarg && newarg[0] != '-') {
1147        bcopy(newarg, &unixfile[mplen], strlen(newarg));
1148        newarg = strtok(NULL, " ");
1149        rootlen = (newarg) ? (newarg - head) : buflen;
1150    } else if (mplen != 0) {
1151        /*
1152         * No unix argument, but mountpoint is not empty, use
1153         * /platform/i86pc/$ISADIR/kernel/unix as default.
1154         */
1155        char isa[20];
1156
1157        if (sysinfo(SI_ARCHITECTURE_64, isa, sizeof (isa)) != -1)
1158            (void) snprintf(&unixfile[mplen],
1159                sizeof (unixfile) - mplen,
1160                "/platform/i86pc/kernel/%s/unix", isa);
1161        else if (sysinfo(SI_ARCHITECTURE_32, isa, sizeof (isa)) != -1) {
1162            (void) snprintf(&unixfile[mplen],
1163                sizeof (unixfile) - mplen,
1164                "/platform/i86pc/kernel/unix");
1165        } else {
1166            (void) fprintf(stderr,
1167                gettext("%s: Unknown architecture"), cmdname);
1168            return (EINVAL);
1169        }
1170    }
#3

Updated by Marcel Telka 12 months ago

  • Subject changed from reboot(1m) still looks for 32-bit kernel to reboot(1m) looks for 32-bit kernel only
#5

Updated by Marcel Telka 12 months ago

Testing Done

Without the fix:

# beadm create new
Created successfully
# reboot -f -- rpool/ROOT/new
reboot: rpool/ROOT/new is not a root disk or dataset
# beadm destroy -fF new
#

With the fix:

# beadm create new
Created successfully
# reboot -f -- rpool/ROOT/new
Connection to localhost closed by remote host.
Connection to localhost closed.
$
#6

Updated by Marcel Telka 12 months ago

  • Status changed from In Progress to Pending RTI
#7

Updated by Electric Monk 12 months ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit 4e995f2a014b6efa1fa6b0cf17c7f63ed51acf69

commit  4e995f2a014b6efa1fa6b0cf17c7f63ed51acf69
Author: Marcel Telka <marcel@telka.sk>
Date:   2020-01-31T15:46:07.000Z

    12256 reboot(1m) looks for 32-bit kernel only
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Alexander Pyhalov <alp@sfedu.ru>
    Reviewed by: C Fraire <seeemef@mac.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF