ramdisk systems have no boot_archive
When the system boots, we make an early decision to mount a root file system (e.g., from a disk, or the network) or to commit to the ramdisk as our root file system. In a system booted from a ramdisk, such as an installer miniroot or a live system like SmartOS, there is no separate boot archive to manage. We should detect the ramdisk case and skip any boot archive checks.
From inside the kernel it is easy enough to tell:
> *rootdev::devt MAJOR MINOR 87 1 > *rootdev::dev2major | ::major2name ramdisk
We should provide a helper program in
/usr/lib and use it within the appropriate boot scripts.
Updated by Joshua M. Clulow about 1 year ago
Existing persistent installation system¶
On a stock OpenIndiana system, I installed my test build of the change and checked that the helper program worked as expected:
root@oi0:~# /lib/svc/bin/rootisramdisk -v major = 259 driver = zfs root@oi0:~# echo $? 3
I also edited the following files to add
-x to the
sh arguments in interpreter line so that I could see the debugging output:
In particular, note that the service continues after the
smf_root_is_ramdisk function and proceeds to run the boot archive check.
root@oi0:~# tail -n 50 $(svcs -L boot-archive) [ Mar 8 13:46:10 Enabled. ] [ Mar 8 13:46:11 Executing start method ("/lib/svc/method/boot-archive"). ] + . /lib/svc/share/smf_include.sh + SMF_EXIT_OK=0 + SMF_EXIT_NODAEMON=94 + SMF_EXIT_ERR_FATAL=95 + SMF_EXIT_ERR_CONFIG=96 + SMF_EXIT_MON_DEGRADE=97 + SMF_EXIT_MON_OFFLINE=98 + SMF_EXIT_ERR_NOSMF=99 + SMF_EXIT_ERR_PERM=100 + . /lib/svc/share/fs_include.sh + vfstab=/etc/vfstab + FILELIST=/etc/svc/volatile/boot_archive_filelist + UPDATEFILE=/etc/svc/volatile/boot_archive_needs_update + smf_is_nonglobalzone + [ global '!=' global ] + return 1 + smf_root_is_ramdisk + /lib/svc/bin/rootisramdisk + /sbin/bootadm update-archive -vnC + 2> /dev/null cannot find: /etc/cluster/nodeid: No such file or directory cannot find: /etc/devices/mdi_ib_cache: No such file or directory cannot find: /etc/devices/retire_store: No such file or directory cannot find: /etc/ppt_aliases: No such file or directory + [ 0 '=' 0 ] + exit 0 [ Mar 8 13:46:11 Method "start" exited with status 0. ]
I build a basic ramdisk, effectively using
pkg image-create to install a bare bones illumos system into a ramdisk that I then wrapped in a UFS file system image and a bootable ISO, in a fashion similar to installer miniroots. Before the change, we would see a warning about needing to update the boot archive on the console. After the change, this no longer happens. The helper also appears to work as expected:
unknown console login: root Password: Mar 9 08:15:26 unknown login: ROOT LOGIN /dev/console The illumos Project testing/1310-0-g6fbff6e538 March 2021 root@unknown:~# /lib/svc/bin/rootisramdisk -v major = 96 driver = ramdisk root@unknown:~# echo $? 0 root@unknown:~# grep ufs /etc/mnttab /devices/ramdisk:a / ufs rw,intr,largefiles,xattr,onerror=panic,dev=1800001 1615277716
Updated by Electric Monk about 1 year ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit f6c47fdeea63a9c5d1abefdffb93d3f87e12b7d0 Author: Joshua M. Clulow <email@example.com> Date: 2021-03-10T06:11:24.000Z 13605 ramdisk systems have no boot_archive Reviewed by: Andy Fiddaman <firstname.lastname@example.org> Reviewed by: Hans Rosenfeld <email@example.com> Reviewed by: Toomas Soome <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>