/sbin/init overrides HOME and TERM env vars

Stefan Seyfried stefan.seyfried at googlemail.com
Sat Mar 12 12:00:15 UTC 2022


On 12.03.22 11:19, jkm wrote:
> Dear Stefan
> 
>> Looking at the kernel code in init/main.c, it does look like HOME=/ 
>> TERM=linux is hard coded in the kernel with no way to override this 
>> from the command line.
> 
> I guess you are wrong.
> HOME and TERM env vars can be overriden with boot params.

Ok, then I was reading the kernel code wrong ;-)

> Anyway, if HOME=/ is hardcoded in the kernel then what is the reason for 
> setting it in init command for the second time?
> 
>      putenv((char *) "HOME=/");

I guessed it was some (old) compatibility stuff, reaching back to 
kernels 0.99.x when HOME and TERM might not have been set by the kernel 
already ;-)

>> Did you check if you can actually set this to something else?
> 
> Yes, I did.

Then I'll shut up now :-)
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman


More information about the busybox mailing list