Initializing the HOST system

Initializing the HOST system

Warning

You are about modify the HOST system to add a new user, and maybe to format disk partitions. Check again the values specified in the bandit.conf file before proceeding. You can destroy the HOST system and loose your data in case of misconfiguration.

Once the BANDIT is properly configured, to initialize the HOST system execute:

# bandit --system host init

A new user, as defined in bandit.conf file, is added to the HOST system:

--------------------
Setting up BANDIT user in HOST ...
---
changed ownership of '/home/bandit/.bash_profile' from root:root to bandit:phyglos
...
...

If the TARGET is built on disk partitions, the list of available partitions is presented before initializing these TARGET partitions.

Enter init to confirm the formating of the root partition:

--------------------
Preparing TARGET partition...
---
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
/dev/sda      8:0    0   20G  0 disk
|-/dev/sda1   8:1    0   16G  0 part /
`-/dev/sda2   8:2    0    2G  0 part [SWAP]
/dev/sdc      8:32   0  160G  0 disk
|-/dev/sdc1   8:33   0   60G  0 part
`-/dev/sdc2   8:34   0    4G  0 part
/dev/sdd      8:48   0  160G  0 disk
/dev/sr0     11:0    1 1024M  0 rom
Enter 'init' to erase /dev/sdc1 :

Or press Ctrl-C to abort the initialization for any reason.

Tip

See below Cleaning the HOST system to start over.

Then, the list of partitions is presented again, now before initializing the swap partition. Note that the TARGET partition has already been mounted in the BANDIT_HOST_TGT_MNT destination.

Enter init to confirm the preparation of the swap partition:

--------------------
Preparing TARGET swap area...
---
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
/dev/sda      8:0    0   20G  0 disk
|-/dev/sda1   8:1    0   16G  0 part /
`-/dev/sda2   8:2    0    2G  0 part [SWAP]
/dev/sdc      8:32   0  160G  0 disk
|-/dev/sdc1   8:33   0   60G  0 part /opt/phyglos-target
`-/dev/sdc2   8:34   0    4G  0 part
/dev/sdd      8:48   0  160G  0 disk
/dev/sr0     11:0    1 1024M  0 rom
Enter 'init' to erase /dev/sdc2 :

Once the TARGET partitions are initialized and mounted, the HOST system is ready for the new user, just created, to raise the temporary BUILDER system.

Check the initialization

When the initialization of the HOST system is completed, the TARGET partitions can be checked using:

# lsblk

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
 /dev/sda      8:0    0   20G  0 disk
 |-/dev/sda1   8:1    0   16G  0 part /
 `-/dev/sda2   8:2    0    2G  0 part [SWAP]
 /dev/sdc      8:32   0  160G  0 disk
 |-/dev/sdc1   8:33   0   60G  0 part /opt/phyglos-target
 `-/dev/sdc2   8:34   0    4G  0 part [SWAP]
 /dev/sdd      8:48   0  160G  0 disk
 /dev/sr0     11:0    1 1024M  0 rom

and the BUILDER filesystem should provisioned inside the TARGET partition:

# ls -l /opt/phyglos-builder

[...] /opt/phyglos-builder -> /opt/phyglos-target/opt/phyglos-builder

Cleaning the HOST system

If the HOST system needs to be cleaned (e.g. due to previous installation attemps), execute:

# bandit --system host clean

The unpriliveged user is removed from the HOST system and the contents of the BUILDER filesystem are deleted.

Warning

The user defined in the bandit.conf file is removed along with the contents of its home directory.

Warning

Any previous initialization done to the HOST partitions is irreversible. Do not rely on this clean action to revert misconfigured partitioning.