rapido-linux / rapido

Quickly test Linux kernel changes
GNU Lesser General Public License v2.1
22 stars 22 forks source link

autorun/init: start vm_autorun.env via bash --rcfile #239

Closed ddiss closed 6 months ago

ddiss commented 6 months ago

Hanne's analysis: vm_autorun.env is copied into the rapido root fs as /etc/profile, and as such will be executed every time a login shell is invoked (ie via 'su -' or 'sh -l'). As this script also serves as system initialisation we need to make sure to run the initialisation only once, and only export the environment variables for later invocations.

To avoid multiple invocations, we can use bash's explicit --rcfile parameter when starting the initial shell, and install vm_autorun.env in a path where it won't get invoked automatically (/rapido.rc).

To use bash with --rcfile, we also need to drop the explicit --login/-l parameter, which changes bash behaviour slightly:

I think we shouldn't see any side-effects for rapido workloads.

Reported-by: Hannes Reinecke hare@suse.de

ddiss commented 6 months ago

I've been running with this change for a little while and haven't noticed any issues, so will go ahead and merge.