TrueNAS SCALETrueNAS SCALE Nightly Development Documentation
This content follows experimental early release software. Use the Product and Version selectors above to view content specific to a stable software release.

Bootenv

The SCALE CLI guide is a work in progress! New namespace and command documentation is continually added and maintained, so check back here often to see what is new!

Bootenv Namespace

The bootenv namespace has 7 commands, and is based on boot environment functions found in the SCALE API and web UI. It provides access to environment management methods through the bootenv namespace commands.

Bootenv Commands

The following bootenv namespace commands allow you to create or delete boot environments, manage existing environments, and activate an environment.

You can enter commands from the main CLI prompt or from the system namespace prompt.

Activate Command

The activate command sets a boot environment to activate on reboot.

Using the Activate Command

Description

activate has one required property, id. Use query to find the boot environment id.

activate returns true when successful. query returns active values of N (now) for the current boot environment and R (reboot) for the pending one. Enter system reboot to reboot the system and activate the pending boot environment.

Usage

From the CLI prompt, enter:

system bootenv activate id="TEST"

Where TEST is the id of the boot environment to activate.

Press Enter.

Command Example
system bootenv activate id="TEST"
true

Create Command

The create command adds a new boot environment.

Using the Create Command

Description

create has one required property, name, and one optional property, source.

The boot environment name may include only alphanumeric characters, dashes (-), underscores (_), or periods (.).

If source is defined, the new boot environment is created as a clone of an existing boot environment. Use query to find the id of an existing boot environment.

create returns a blank line when successful. Use query to confirm.

Usage

From the CLI prompt, enter:

system bootenv create name="TEST2" source="TEST"

Where TEST2 is a name for the new boot environment and TEST is the id of an existing boot environment to clone, if needed.

Press Enter.

Command Example
system bootenv create name="TEST2" source="TEST"

Delete Command

The delete command removes an existing boot environment from the system.

Using the Delete Command

Description

delete has one required property, id. Use query to find the boot environment id.

You cannot delete the default or any active entries. To delete the active boot environment, first activate another entry and then delete the environment you want to remove.

delete returns the task progress as a percentage.

Usage

From the CLI prompt, enter:

system bootenv delete id="TEST"

Where TEST is the id of an existing boot environment.

Press Enter.

Command Example
system bootenv delete id="TEST"
[0%] ...
[100%] ...

Get_instance Command

The get_instance command returns configuration for an existing boot environment.

Using the Get_instance Command

Description

get_instance has one required property, id. Use query to find the boot environment id.

get_instance returns a table containing boot environment information.

Usage

From the CLI prompt, enter:

system bootenv get_instance id="TEST"

Where TEST is the id of an existing boot environment.

Press Enter.

Command Example
system bootenv get_instance id="TEST"
+--------------+---------------------------+
|           id | TEST                      |
|     realname | TEST                      |
|         name | TEST                      |
|       active |                           |
|    activated | false                     |
| can_activate | true                      |
|   mountpoint | -                         |
|        space | 8.0K                      |
|      created | 2023-09-22T11:56:00+00:00 |
|         keep | false                     |
|     rawspace | 8192                      |
+--------------+---------------------------+

Query Command

The query command allows you to view all boot environments stored on the system. It indicates the current active boot environment and which environment activates on system reboot.

Using the Query Command

Description

query does not require entering properties or arguments. Enter the command, then press Enter.

query returns a table containing information about all stored boot environments on the system. The active boot environment is identified with N (now) under active and R (reboot). If a boot environment activate is pending, the current environment is identified with N and the pending environment with R.

Usage

From the CLI prompt, enter:

system reboot query

Press Enter.

Command Example
system bootenv query
+------------------------------+------------------------------+------------------------------+--------+-----------+--------------+------------+-------+---------------------------+-------+------------+
| id                           | realname                     | name                         | active | activated | can_activate | mountpoint | space | created                   | keep  | rawspace   |
+------------------------------+------------------------------+------------------------------+--------+-----------+--------------+------------+-------+---------------------------+-------+------------+
| 23.10-RC.1-INTERNAL.9        | 23.10-RC.1-INTERNAL.9        | 23.10-RC.1-INTERNAL.9        |        | false     | true         | -          | 2.35G | 2023-09-15T09:04:00+00:00 | false | 2527326208 |
| 23.10-MASTER-20230922-042925 | 23.10-MASTER-20230922-042925 | 23.10-MASTER-20230922-042925 | NR     | true      | true         | legacy     | 2.33G | 2023-09-22T11:26:00+00:00 | false | 2497949696 |
| Initial-Install              | Initial-Install              | Initial-Install              |        | false     | true         | -          | 7.1M  | 2023-08-31T09:02:00+00:00 | true  | 7442432    |
| 23.10-BETA.1                 | 23.10-BETA.1                 | 23.10-BETA.1                 |        | false     | true         | -          | 2.31G | 2023-08-31T08:47:00+00:00 | false | 2484695040 |
+------------------------------+------------------------------+------------------------------+--------+-----------+--------------+------------+-------+---------------------------+-------+------------+

Set_attribute Command

The set_attribute command is used to set the keep flag, which determines whether the TrueNAS updater can automatically delete this boot environment if there is not enough space to proceed with an update.

Using the Set_attribute Command

Description

set_attribute has one required property, id, one optional property, attributes. Currently, keep is the only available attribute. Use query to find the boot environment id.

set_attribute returns true when successful.

Usage

From the CLI prompt, enter:

system bootenv set_attribute id="TEST" attributes={“keep”:true}

Where TEST is the boot environment id and true is a boolean value.

Press Enter.

Command Example
system bootenv set_attribute id="23.10-BETA.1" attributes={"keep":true}
true

Update Command

The update command allows you to change the name of an existing boot environment.

Using the Update Command

Description

update has two required properties, id and name. Use query to find the boot environment id.

The new boot environment name may include only alphanumeric characters, dashes (-), underscores (_), or periods (.).

update returns a blank line when successful. Use query to confirm.

Usage

From the CLI prompt, enter:

system bootenv update id="TEST" name="RETEST"

Where TEST is the boot environment id to update and RETEST is the new name.

Press Enter.

Command Example
system bootenv update id="TEST" name="RETEST"