Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] How to set target system PATH?
@ 2025-01-23 17:00 Grant Edwards
  2025-01-23 17:18 ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Edwards @ 2025-01-23 17:00 UTC (permalink / raw)
  To: buildroot

I've set the desired PATH in the config file:

  BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/apps/bin"

But that only seems to affect login shells, and not daemons started
from /etc/init.d.

How do I set the _system_ PATH rather than just the login shell PATH.

--
Grant


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] How to set target system PATH?
  2025-01-23 17:00 [Buildroot] How to set target system PATH? Grant Edwards
@ 2025-01-23 17:18 ` Arnout Vandecappelle via buildroot
  2025-01-23 17:30   ` Baruch Siach via buildroot
  2025-01-23 17:32   ` Grant Edwards
  0 siblings, 2 replies; 5+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2025-01-23 17:18 UTC (permalink / raw)
  To: Grant Edwards, buildroot



On 23/01/2025 18:00, Grant Edwards wrote:
> I've set the desired PATH in the config file:
> 
>    BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/apps/bin"
> 
> But that only seems to affect login shells, and not daemons started
> from /etc/init.d.
> 
> How do I set the _system_ PATH rather than just the login shell PATH.

  Good question! That depends on the init system (because that one is 
responsible to set the path). I looked in the source, and it looks like both 
systemd and busybox init hardcode it without any configuration option...

  So unless you convince the maintainers of your favourite init system to 
change, you won't be able to customize the system path.

  Regards,
  Arnout

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] How to set target system PATH?
  2025-01-23 17:18 ` Arnout Vandecappelle via buildroot
@ 2025-01-23 17:30   ` Baruch Siach via buildroot
  2025-01-23 17:48     ` Grant Edwards
  2025-01-23 17:32   ` Grant Edwards
  1 sibling, 1 reply; 5+ messages in thread
From: Baruch Siach via buildroot @ 2025-01-23 17:30 UTC (permalink / raw)
  To: Arnout Vandecappelle via buildroot; +Cc: Grant Edwards, buildroot

Hi Arnout, Grant,

On Thu, Jan 23 2025, Arnout Vandecappelle via buildroot wrote:
> On 23/01/2025 18:00, Grant Edwards wrote:
>> I've set the desired PATH in the config file:
>>    BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/apps/bin"
>> But that only seems to affect login shells, and not daemons started
>> from /etc/init.d.
>> How do I set the _system_ PATH rather than just the login shell PATH.
>
>  Good question! That depends on the init system (because that one is
>  responsible to set the path). I looked in the source, and it looks like both
>  systemd and busybox init hardcode it without any configuration option...

Busybox code indicates that you can extend the default PATH by setting
the BB_ADDITIONAL_PATH macro in CFLAGS.

SysV init appears to hard code the PATH.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] How to set target system PATH?
  2025-01-23 17:18 ` Arnout Vandecappelle via buildroot
  2025-01-23 17:30   ` Baruch Siach via buildroot
@ 2025-01-23 17:32   ` Grant Edwards
  1 sibling, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2025-01-23 17:32 UTC (permalink / raw)
  To: buildroot; +Cc: buildroot

On 2025-01-23, Arnout Vandecappelle via buildroot <buildroot@buildroot.org> wrote:
>
>
> On 23/01/2025 18:00, Grant Edwards wrote:
>> I've set the desired PATH in the config file:
>> 
>>    BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/apps/bin"
>> 
>> But that only seems to affect login shells, and not daemons started
>> from /etc/init.d.
>> 
>> How do I set the _system_ PATH rather than just the login shell PATH.
>
>   Good question! That depends on the init system (because that one is 
> responsible to set the path). I looked in the source, and it looks like both 
> systemd and busybox init hardcode it without any configuration option...
>
>   So unless you convince the maintainers of your favourite init system to 
> change, you won't be able to customize the system path.

Yea, I've been looking at the busybox init docs, and it doesn't look
like there's any way to add/change the environment variables.  It sure
would have been nice if that could be done in /etc/inittab.

I dug through the local archives, and it turns out I addressed this
problem once 13 years ago. I used a postbbuild script and sed commands
to insert a couple lines into etc/init.d/rcS to set/export PATH and
LD_LIBRARY_PATH.

IIRC, I wasn't very happy with that at the time, but I guess I'll have
to do it again.

--
Grant


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] How to set target system PATH?
  2025-01-23 17:30   ` Baruch Siach via buildroot
@ 2025-01-23 17:48     ` Grant Edwards
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2025-01-23 17:48 UTC (permalink / raw)
  To: buildroot; +Cc: buildroot

On 2025-01-23, Baruch Siach via buildroot <buildroot@buildroot.org> wrote:
> Hi Arnout, Grant,
>
> On Thu, Jan 23 2025, Arnout Vandecappelle via buildroot wrote:
>> On 23/01/2025 18:00, Grant Edwards wrote:
>>> I've set the desired PATH in the config file:
>>>    BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/apps/bin"
>>> But that only seems to affect login shells, and not daemons started
>>> from /etc/init.d.
>>> How do I set the _system_ PATH rather than just the login shell PATH.
>>
>>  Good question! That depends on the init system (because that one is
>>  responsible to set the path). I looked in the source, and it looks like both
>>  systemd and busybox init hardcode it without any configuration option...
>
> Busybox code indicates that you can extend the default PATH by setting
> the BB_ADDITIONAL_PATH macro in CFLAGS.
>
> SysV init appears to hard code the PATH.

Great! I'm using busybox init, so I'll try setting CONFIG_EXTRA_CFLAGS
in the busybox config. I'd really like to avoid having to munge rc.S
with a post-build script.


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-23 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 17:00 [Buildroot] How to set target system PATH? Grant Edwards
2025-01-23 17:18 ` Arnout Vandecappelle via buildroot
2025-01-23 17:30   ` Baruch Siach via buildroot
2025-01-23 17:48     ` Grant Edwards
2025-01-23 17:32   ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox