Project

General

Profile

Actions

Bug #5377

closed

bootadm update-archive misidentifies BEs as ramdisks

Added by Josef Sipek about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
High
Category:
cmd - userland programs
Start date:
2014-12-01
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

Suppose you make a BE which starts with the string "ramdisk" - for example:

jeffpc@osiris:~$ beadm list
BE                       Active Mountpoint      Space Policy Created
hipster                  NR     /               14.5G static 2014-12-01 11:04
ramdisk-base-nd-1        -      -               114K  static 2014-12-01 10:48

Then, you mount it, and try to rebuild the boot archive:

jeffpc@osiris:~$ sudo beadm mount ramdisk-base-nd-1
Mounted successfully on: '/tmp/tmp.NKaWHc'
jeffpc@osiris:~$ df -h /tmp/tmp.NKaWHc/
Filesystem                    Size  Used Avail Use% Mounted on
rpool/ROOT/ramdisk-base-nd-1   38G   11G   27G  29% /tmp/tmp.NKaWHc
jeffpc@osiris:~$ sudo bootadm update-archive -v -R /tmp/tmp.NKaWHc/ ; echo $?
bootadm: /tmp/tmp.NKaWHc/ is on a ramdisk device
0

Note that the command did not fail. It just did nothing. If you don't specify

-v
, you will not see the message about ramdisk device. Of course, you can't boot with a busted boot archive.

A quick look at usr/src/cmd/boot/bootadm/bootadm.c reveals a function called

is_ramdisk
which attempts to determine whether the BE is on a ramdisk. It does so by comparing the special devices against a string ("/ramdisk") using
strstr
.
update_archive
calls
is_ramdisk
early on and if the device is determined to be a ramdisk, it just bails.

In my case, since "rpool/ROOT/ramdisk-base-nd-1" contains "/ramdisk" it is incorrectly deemed to be a ramdisk.

It looks like this bug has been around for a long time.

Actions #1

Updated by Alexander Eremin about 7 years ago

  • Assignee set to Alexander Eremin
Actions #2

Updated by Electric Monk about 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 08db0dbccad017e19ad23f4b307e9fd0dc96cda1

commit  08db0dbccad017e19ad23f4b307e9fd0dc96cda1
Author: Alexander Eremin <a.eremin@nexenta.com>
Date:   2014-12-04T15:18:21.000Z

    5377 bootadm update-archive misidentifies BEs as ramdisks
    Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Dan McDonald <danmcd@omniti.com>

Actions

Also available in: Atom PDF