boot - A layman's guide to understand stages of ubuntu startup/booting - Ask Ubuntu


it arose situation when wanted run script on every time system starts.

i noticed there number of places such init.d, rc.local, bash_profile, ~/config/autostart, ~/local/share/applications , ton of other places run @ everytime system starts. quite understandable. show obscure picture of system start-up.

may know if can point me standard resource on how briefly , understand

  1. various stages involved in booting ubuntu system ,
  2. (leaving out less interesting junk) of user's actual interest customizations in general?

kindly consider did google , found awful resources incomprehensible details. grateful, if can explain in layman terms or, @ least point me place not big-fat reference manual not readable layman.

let me upfront nitpickers, these answers not useful:

while might share similarity, of them have failed obtain useful beginners. e.g. last obtain 1 chart-producing solution.

grub loads kernel, kernel starts init process (typically /sbin/init). it's happens after typically of interest. in various stages of ubuntu's history, there have been 3 init systems:

  1. sysv init, dark ages
  2. upstart, ubuntu 9.10 - 14.10
  3. systemd, ubuntu 15.04

init systems, in general, start various services supposed run, in addition other duties. what init system do?

/etc/init.d shell scripts of interest of old sysv init system reside. if can, avoid it. exists only backward compatibility reasons.

/etc/rc.local script sysv init era, still works because of backwards compatibility. it's short-lived commands run @ system startup as root. it's executed once during startup. long-lived tasks, use upstart (/etc/init) or systemd (/etc/systemd/system) services instead. both upstart , systemd allow starting programs conditionally, way different.

once login gui, desktop environments start applications listed in ~/.config/autostart. it's place commands should run after login gui, starting mail client. they're executed each time login, each time logout , re-login, executed (unlike /etc/rc.local).

~/.config/upstart ~/.config/autostart, handled per-session upstart process started when login gui. it's more flexible ~/.config/autostart, executes commands @ login. useful till ubuntu 16.10, per-session process systemd (from 15.04 16.04, main init systemd, per-session inits upstart). see, example, answer here: how run script on unity login/logout?


now can make more sense of options in how run scripts on start up?


~/.bash_profile, ~/.profile, ~/.bashrc, etc. not starting commands @ startup. these read command-line shells, when start terminal, or login ttys. so, .bashrc running command each time open terminal, , .profile when login tty. (see this answer.) these files used in setting environment variables, canonical place environment variables /etc/environment system-wide variables , ~/.pam_environment user-specific variables. see this answer.

~/.local/share/applications irrelevant discussion.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User