You are here: Home Documents Switching image and Aboot

Switching image and Aboot

Change boot image, Modify image, rescue operation by Aboot

(verified 2010 Aug. / EOS 4.4.0 / DCS-7120T-4S 03.01)

Boot image

The boot image file of Arista is located in the flash storage of the box. You can see it by DIR command of CLI. The image file name is EOS-4.4.0.swi or something like that.

localhost#dir flash:
Directory of flash:/

-rwx 161174379 Jan 26 08:20 EOS-4.3.0.swi
-rwx 188621783 Aug 12 11:29 EOS-4.4.0.swi
-rwx 25 Aug 24 17:17 boot-config
-rwx 16 Jul 22 01:23 boot-extensions
drwx 4096 Aug 24 19:56 persist
-rwx 1510 Aug 17 18:29 startup-config

1864572928 bytes total (1137016832 bytes free)

The flash memory is also mounted on /mnt/flash/ directory, so you can see the same result by ls command on bash.

Changing the boot image

There are some reasons to boot from the different EOS image, not only for the version up. EOS has BOOT SYSTEM command to do it on configure mode of CLI. BOOT command does not boot and it just set the boot image file name for the next boot up.

localhost(config)#boot system flash:EOS-?
flash:EOS-4.3.0.swi flash:EOS-4.4.0.swi

localhost(config)#boot system flash:EOS-4.4.0.swi


You can see the name of the boot image file for the next boot by SHOW BOOT-CONFIG command.

localhost#show boot-config 
Software image: flash:/EOS-4.4.0.swi
Console speed: (not set)
Aboot password (encrypted): (not set)

It shows /mnt/flash/boot-config file. So BOOT SYSTEM command just overwrites this file.


Arista Networks EOS shell

[admin@localhost ~]$ cat /mnt/flash/boot-config
[admin@localhost ~]$


Modify the boot image and repack it

The image file had been packed as SWI format. So it is able to expand it, modify it then repack it again to make a your own image file for the customized EOS.


( I tried it but not succeed before.... Let me try it again! I believe there is no reason to block it. )


If it is possible to make your modification without any conflict with the existing part of the system, additional package installation based  Extension is good way to do it. But there are some conflicts, it needs to modify the boot image itself.

But please do by your own risk anyway. These modification may have unexpected effect to the original system and it is very difficult to identify the origin of the error in these situation. So if you customize your system, you may not able to get the ordinary (or full) technical support from Arista or resellers, I think.

small retouching by rc.eos

If your requirement is very small changes, such as just replace a few of files or some. How about rc.eos file script to make it? Here is the brief instruction.

The path of EOS startup

EOS setup will be done by following path.

  1. It boots on standard Linux method,
  2. and it expands Extensions then installs them
  3. The runlevel raises to 5 and startup scripts under /etc/rc.d/init.d will be started
  4. /etc/rc.d/rc5.d/S07EosStage1 ( it is the link to /etc/rc.d/init.d/EosStage1 ) is also invoked
  5. it executes "/usr/bin/EosInit --stage 1" command
  6. /usr/bin/EosInit script will launch /mnt/flash/rc.eos script if it exists
  7. S51EosStage2 script under /etc/rc5.d directory is also invoked ( it is the link to /etc/rc.d/init.d/EosStage2 )
  8. And it executes "/usr/bin/EosInit --stage 2" command

So then, you can add small shell scripts to /mnt/flash/rc.eos file and it is able to make change or add system files very easy.

example of rc.eos

Here is a simple example to copy file to add  hello command. (For more detail information about and about the "mount -o rw" command, see Adding a commadnd.

bash-3.2# cat /mnt/flash/rc.eos 
mount -o rw,remount /
cp /mnt/flash/ /usr/lib/python2.5/site-packages/CliPlugin/
mount -o ro,remount /
echo "rc.eos was executed."
After the next boot, you can see the new log message on /var/log/EosInit file.
bash-3.2# pwd
bash-3.2# cat EosInit
rc.eos was executed.
Starting stage 1 EOS initialization
Starting stage 2 EOS initialization
( At present, it is not clear the reason why the line of "rc.eos was executed" is exists before "Starting stage1 ...". Let us check more... )

/persist directory

There is /persist directory and it is useful for rc.eos script. Under /persist directory, there are 2 subdirectories are exist (local and sys). These directories require root permission (or eosadmin group permission) to write. If you write something under the directory, it keeps over to the next boot and it is ready to use before rc.eos will start.

In Arista, ordinary directories such as /usr are mounted as read only mode but /persist is mounted as read write mode. And more, ordinary directories will be vanished in every boot up because these are all memory based file system. But /persist keeps the contents and recover them at the next boot.

You can see the mount info of /persist directory by mount command, see the last line. It is also tmpfs. We explain how Arista keep the contents later.

bash-3.2# mount
tmpfs on /persist type tmpfs (rw,size=411116k)

In initial state, under /persist/local directory is empty and /persist/sys directory holds SSH files.

bash-3.2# pwd
bash-3.2# ls -l
total 0
drwxrwxrwx 2 root root 40 Jan 8 2010 local
drwxrwxrwx 2 root root 160 Jan 8 2010 sys
bash-3.2# ls -l local
total 0
bash-3.2# ls -l sys
total 24
-rw------- 1 root root 672 Jan 8 2010 ssh_host_dsa_key
-rw-r--r-- 1 root root 590 Jan 8 2010
-rw------- 1 root root 963 Jan 8 2010 ssh_host_key
-rw-r--r-- 1 root root 627 Jan 8 2010
-rw------- 1 root root 1675 Jan 8 2010 ssh_host_rsa_key
-rw-r--r-- 1 root root 382 Jan 8 2010

sys directory may be used by the system so it is better to use local directory for user needs. According to /usr/local custom, it may help to make subdirectories for each product.

For instance, above file should be located under /persist/local/Hello directory and change rc.eos line as follows;

cp /persist/local/Hello/ /usr/lib/python2.5/site-packages/CliPlugin/

It looks better.

/persist gimmick

All contents under /persist directory will be saved in /mnt/flash/persist directory. There are 2 files (not 2 directories) under /mnt/flash/persist directory, names are local and sys. These are cpio file and /persist directory will be made by recovering from these files. While system is running, inotifyrun daemon (Python program) reflects the update from /persist to /mnt/flash/persist. (see "ps -efw | grep inotifyrun" )

bash-3.2# pwd
bash-3.2# ls -l /mnt/flash/persist/
total 20
-rwxrwx--- 1 root eosadmin 5120 Aug 24 19:56 local
-rwxrwx--- 1 root eosadmin 10240 Aug 24 19:56 sys

When you make a file under /persist/local (by touch command for example), you can see the time stamp of /mnt/flash/persist/local file will be updated automatically.

bash-3.2# touch local/test1
bash-3.2# date
Tue Aug 25 18:37:01 UTC 2009
bash-3.2# ls -l /mnt/flash/persist/
total 20
-rwxrwx--- 1 root eosadmin 5120 Aug 25 18:36 local
-rwxrwx--- 1 root eosadmin 10240 Aug 24 19:56 sys

For example, you can see the files inside /mnt/flash/persist/sys file by cpio command as follows;

bash-3.2# cpio -itv < /mnt/flash/persist/sys 
drwxrwxrwx 2 root root 0 Jan 8 2010 .
-rw-r--r-- 1 root root 590 Jan 8 2010 ./
-rw------- 1 root root 672 Jan 8 2010 ./ssh_host_dsa_key
-rw-r--r-- 1 root root 382 Jan 8 2010 ./
-rw------- 1 root root 1675 Jan 8 2010 ./ssh_host_rsa_key
-rw-r--r-- 1 root root 627 Jan 8 2010 ./
-rw------- 1 root root 963 Jan 8 2010 ./ssh_host_key
12 blocks

When you install the software, /persist directory is good to use for the storage area to keep the configuration files and some.



Arista has Aboot boot loader. Aboot is a small Linux system and it includes several system commands for maintenance work.

Even you makes your system disable accidentally (by your experimental modification), you can recover the system by using Aboot as a rescue tool.

Aboot prompt

When you boot the box, you can see the Aboot messages on the serial console.

(serial port settings are 9600bps, 8bit, no-parity as default)

Aboot 1.9.7-196993.EOS430Beta

Press Control-C now to enter Aboot shell

When you see above message, press Control-C to show Aboot prompt as follows;

^CWelcome to Aboot.

In this situation, the flash storage is already mounted on /mnt/flash/ and it is fully writable. vi editor is ready and ifconfig, udhcpc (dhcp client) and some other commands are also available.

But when the timing of Aboot, all switch ports are not activated. ifconfig shows only management port 1 and 2, and it means you can use only these 2 ports for your rescue work. Thanks Arista not to throw away ordinary NICs from the board. It was right decision.

You can use recover, fullrecover commands and more. Please refer Arista document.

Case study : Changing boot image (recovery from the fatal damage)

Here is an actual example to change the boot image because our customized boot image had fatal error unexpectedly. We need to reset the boot image to the old standard one.

We rebooted the system and called Aboot prompt. (see above)

Then we checked /mnt/flash directory and edited boot-config file to reset the name of image file to original (and bootable) image. (EOS-4.3.1.swi is modified image and EOS-4.3.0.swi is the original one.)

Aboot# cd /mnt/flash
Aboot# ls -l EOS-*.swi
-rwxrwx--- 1 0 88 161174379 Jan 26 2009 EOS-4.3.0.swi
-rwxrwx--- 1 0 88 188621783 Aug 12 11:29 EOS-4.3.1.swi
Aboot# cat boot-config
Aboot# vi boot-config

After that, we exited vi and exited Aboot too, so we could see the system was booting from the old EOS-4.3.0.swi image as we have specified.

Aboot# exit 
Restarting system.

Aboot 1.9.7-196993.EOS430Beta

Press Control-C now to enter Aboot shell
Booting flash:/EOS-4.3.0.swi
Starting new kernel
Switching to Welcome to Arista Networks EOS 4.3.0

Just information, in ordinary case, system restarting will be done by reload command from CLI. From bash, reboot command works.

Filed under: