5

I'm currently reading the book How Linux Works and in chapter 5 it talks about Linux parameters. Curious I started to see what were the parameters passed to my installed kernel when it boots up and noticed:

BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64

I have been searching online for an explanation for this parameter but have not been successful. Could anyone point me to the right direction where I could find more information or explain what is this BOOT_IMAGE about? One thing to note is that I'm running a remote Debian server. I know that the serve itself is virtualized, probably with Xen. Does this have to do with Xen and how it boots up instances?

UPDATE: So while investigating I noticed that vmlinuz-3.16.0-4-amd64 is the kernel image. Also looking at man bootparam it reads:

Most of the sorting goes on in linux/init/main.c. First, the kernel checks to see if the argument is any of the special arguments ’root=’, ’nfsroot=’, ’nfsaddrs=’, ’ro’, ’rw’, ’debug’ or ’init’. The meaning of these special arguments is described below.

Anything of the form ’foo=bar’ that is not accepted as a setup function as described above is then interpreted as an environment variable to be set. A (useless?) example would be to use ’TERM=vt100’ as aboot argument.

Any remaining arguments that were not picked up by the kernel and were not interpreted as environment variables are then passed onto process one, which is usually the init program. The most common argument that is passed to the init process is the word ’single’ which instructs init to boot the computer in single user mode, and not launch all the usual daemons. Check the manual page for the version of init installed on your system to see what arguments it accepts.

Running systemctl show-environment will display something like:

[root@localhost ~]# systemctl show-environment 
BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8

So it looks like we are passing as argument the location of the Linux image we are booting from. The only questions left is what process use this environment variable and why?

1

According to http://homepage.smc.edu/morgan_david/cs40/lilo-readme.txt:

LILO always passes the string  BOOT_IMAGE=<name>  to the kernel, where 
<name> is the name by which the kernel is identified (e.g. the label). This 
variable can be used in /etc/rc to select a different behaviour, depending 
on the kernel.

So it was (or remains on some systems) a way to selectively distinct the behavior of boot scripts, depending on label (or kernel file name on other bootloaders). init probably passes this variable down to scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.