aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/init.d/boot
Commit message (Collapse)AuthorAgeFilesLines
* base-files: call "sync" after initial setupRafał Miłecki2022-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenWrt uses a lot of (b)ash scripts for initial setup. This isn't the best solution as they almost never consider syncing files / data. Still this is what we have and we need to try living with it. Without proper syncing OpenWrt can easily get into an inconsistent state on power cut. It's because: 1. Actual (flash) inode and data writes are not synchronized 2. Data writeback can take up to 30 seconds (dirty_expire_centisecs) 3. ubifs adds extra 5 seconds (dirty_writeback_centisecs) "delay" Some possible cases (examples) for new files: 1. Power cut during 5 seconds after write() can result in all data loss 2. Power cut happening between 5 and 35 seconds after write() can result in empty file (inode flushed after 5 seconds, data flush queued) Above affects e.g. uci-defaults. After executing some migration script it may get deleted (whited out) without generated data getting actually written. Power cut will result in missing data and deleted file. There are three ways of dealing with that: 1. Rewriting all user-space init to proper C with syncs 2. Trying bash hacks (like creating tmp files & moving them) 3. Adding sync and hoping for no power cut during critical section This change introduces the last solution that is the simplest. It reduces time during which things may go wrong from ~35 seconds to probably less than a second. Of course it applies only to IO operations performed before /etc/init.d/boot . It's probably the stage when the most new files get created. All later changes are usually done using smarter C apps (e.g. busybox or uci) that creates tmp files and uses rename() that is expected to be atomic. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> (cherry picked from commit 9851d4b6ce6e89d164a04803817625a9041b060a)
* base-files: chmod 1777 /var/lockDeomid Ryabkov2021-11-051-2/+3
| | | | | | | | | | | | | | Per FHS 3.0, /var/lock is the location for lock files [1]. However its current permissions (755) are too restrictive for use by unprivileged processes. Debian and Ubuntu set them to 1777, and now so do we. [1] <https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#varlockLockFiles> Signed-off-by: Deomid Ryabkov <rojer@rojer.me> [fixed typo in commit message, had to remove "rojer" due to git hooks] Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (cherry picked from commit 430f69194388ad6a7826a51e0e2b2dd478e27f0f)
* base-files: mount pstore if presentBrian Norris2021-01-291-0/+1
| | | | | | | | Pstore (persistent store) can be used to stash debug information (kernel console, panics, ftrace) across reboots or crashes. If the filesystem is present, mount it. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: drop default setup for vconfigAdrian Schmutzler2020-09-161-1/+0
| | | | | | | | | | | | | | | | | vconfig has been disabled by default since 2015 [1] and there are no remaining uses in entire OpenWrt trunk. However, we still set up a specific name_type for it during boot. While this setup is properly implemented to be only triggered when vconfig is present, it still seems anachronistic and unnecessary to set up a standard for a tool that is not used anymore. Therefore, this removes the set_name_type initialization and leaves it for those people actually using the tool to configure it as needed. [1] 899a23227e55 ("busybox: improve applets & deprecate ifconfig, route") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: mount bpffs at bootTony Ambardar2020-07-311-0/+1
| | | | | | | | | | Explicitly mount the BPF filesystem if available. This is used for pinning eBPF programs and maps, making them accessible to other eBPF programs or from userspace with the help of libbpf or bpftool. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> [daniel@makrotopia.org: bumped PKG_RELEASE] Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* brcm47xx: rename target to bcm47xxAdrian Schmutzler2020-02-141-1/+1
| | | | | | | | | | This change makes the names of Broadcom targets consistent by using the common notation based on SoC/CPU ID (which is used internally anyway), bcmXXXX instead of brcmXXXX. This is even used for target TITLE in make menuconfig already, only the short target name used brcm so far. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: move /tmp/resolv.conf.auto to /tmp/resolv.conf.d/Daniel Golle2020-01-071-2/+3
| | | | | | Having it in a directory it more friendly for mount-bind. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: change boot & umount STOP indexesJoseph Tingiris2019-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch is in a series to allow additional STOP indexes after umount, so that other block devices may stop cleanly. boot is now STOP=90 umount is now STOP=90 After this patch series, the resulting STOP indexes in the 80s & 90s will be: STOP=85 odhcpd.init STOP=89 conntrackd.init STOP=89 log.init STOP=89 rssileds.init STOP=90 boot STOP=90 kdump.init STOP=90 network STOP=90 sysfixtime STOP=90 umount STOP=98 mdadm.init (note: will be addressed in a separate patch) Signed-off-by: Joseph Tingiris <joseph.tingiris@gmail.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [PKG_RELEASE is now 200]
* base-files, mac80211, broadcom-wl: wifi detection and configurationChristian Lamparter2016-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the wifi detection script is executed as part of the (early) boot process. Pluggable wifi USB devices, which are inserted at a later time are not automatically detected and therefore they don't show up in LuCI. A user has to deal with wifi detection manually, or restart the router. However, the current "sleep 1" window - which the boot process waits for wifi devices to "settle down" - is too short to detect wifi devices for some routers anyway. For example, this can happen with USB WLAN devices on the WNDR4700. This is because the usb controller needs to load its firmware from UBI and initialize, before it can operate. The issue can be seen on a BT HomeHub 5A as well as soon as the caldata are on an ubi volume. This is because the ath9k card has to be initialized by owl-loader first. Which has to wait for the firmware extraction script to retrieve the pci initialization values inside the caldata. This patch moves the wifi configuration to hotplug scripts. For mac80211, the wifi configuration will now automatically run any time a "ieee80211" device is added. Likewise broadcom-wl's script checks for new "net" devices which have the "wl$NUMBER" moniker. Issues with spawning multiple interface configuration - in case the detection script is run concurrently - have been resolved by using a named section for the initial configuration. Concurrent configuration scripts will now simply overwrite the same existing configuration. A workaround which preserves the "sleep 1" window for just the first boot has been added. This allows the existing brcm47xx boot and mvebu uci-default scripts to correctly setup the initial mac addresses and regulatory domain. And finally, the patch renames the "wifi detect" into "wifi config". As the script no longer produces any output that has to be redirected or appended to the configuration file. Thanks to Martin Blumenstingl for helping with the implementation and testing of the patch. Acked-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Mathias Kresin <dev@kresin.me> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files, mac80211, broadcom-wl: use uci to populate wireless configChristian Lamparter2016-11-031-5/+1
| | | | | | | | | | | | | | | | | | | | Previously, wifi detect simply dumped its generated wireless configuration to STDOUT. A second step was needed to append the configuration to /etc/config/wireless (or create it, if it didn't exist). With this patch, The wifi detection script will now use uci to update the wireless configuration directly. This patch also makes the initially created wifi-iface a named section ('default_radio$X' for mac80211 and 'default_wl$X' for broadcom). With this change, uci will not print the cfgHASH to STDOUT (which would now corrupt the wireless configuration). It will also prevent adding duplicated wifi interface configurations, if the wifi configuration is run concurrently. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: let config_generate call board_detectJonas Gorski2016-08-131-1/+1
| | | | | | | Instead of board_detect generating the config as a side effect, let config_generate call board_detect as needed. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: remove dead codeDaniel Golle2016-08-041-6/+0
| | | | | | | | | /etc/init.d/boot tried to create /dev/root based on the kernel's cmdline which won't work on any recent targets. Remove that code now that fstools can detect the mounted rootfs based on /proc/self/mountinfo and /dev/root was long gone anyway. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-file: remove /tmp/.jail (now useless)John Crispin2015-12-111-1/+0
| | | | | | Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> SVN-Revision: 47855
* base-files: create /var/tmp on bootJohn Crispin2015-10-191-0/+1
| | | | | | | | | | | FHS mandates presence of /var/tmp on compliant systems. The lack of /var/tmp was discovered when using MIT Kerberos libraries which default to that location for storing credentials cache. Signed-off-by: Paul Fertser <fercerpav@gmail.com> SVN-Revision: 47219
* base-files: fix /tmp/.jail permissionsJohn Crispin2015-07-241-1/+0
| | | | | | | | | | | We need a+x rights on the path to the root of the jails so we can use users other than root (like nobody) This partly fixes jailed dnsmasq Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> SVN-Revision: 46466
* base-files: create jail folder on bootJohn Crispin2015-03-261-0/+2
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45008
* base-files: add a hardware detection layerJohn Crispin2014-08-181-0/+1
| | | | | | | | | | this allows targets to use the new uci-default helper which will generate a file called /etc/board.json. a tool called /bin/config_generate can then be used to generate the default uci settings. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42185
* base-files: Remove stale calls to start() in initscripts.John Crispin2014-07-261-2/+0
| | | | | | | | based on http://patchwork.openwrt.org/patch/5969/ Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 41840
* /lib/functions.sh: move rarely used mtd and macaddr related functions to ↵Felix Fietkau2014-04-071-0/+2
| | | | | | | | /lib/functions/system.sh Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40411
* base-files: move uci_apply_defaults() to /etc/init.d/bootFelix Fietkau2014-04-071-1/+12
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40408
* base-files: split /etc/init.d/boot into 2 filesJohn Crispin2014-02-181-32/+1
| | | | | | | | this allows us to bind a procd trigger to system.@system[-1] Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 39615
* base-files: fix mount-utils incompatibilityJohn Crispin2013-12-271-1/+1
| | | | | | Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> SVN-Revision: 39169
* base-files: Make /etc/init.d/boot restartableJohn Crispin2013-11-071-3/+7
| | | | | | | | | Only reload hostname and timezone config on /etc/init.d/boot restart. Module loading and basic boot setup is only done during boot. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> SVN-Revision: 38670
* procd: add a small script that handles config reloads until configd is readyJohn Crispin2013-07-111-0/+4
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37248
* base-files: add 2 missing variable definesJohn Crispin2013-07-081-1/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37204
* base-files: module loading is now handled by ubox/kmodloaderJohn Crispin2013-06-211-5/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37003
* base-files: remove unnecessary early sysctl-hackSteven Barth2013-06-111-7/+0
| | | | SVN-Revision: 36920
* boot: make use of kmodloader if it is availableJohn Crispin2013-04-251-1/+5
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36428
* make basefiles aware of procdJohn Crispin2013-03-131-32/+0
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36003
* base-files: Fix IPv6 early sysctls again * Kernel IPv6 /proc interface ↵Steven Barth2013-02-011-2/+6
| | | | | | inconsistency caused races SVN-Revision: 35417
* base-files: Fix race-conditions with IPv6 sysctlsSteven Barth2013-01-291-0/+3
| | | | SVN-Revision: 35368
* Do not overload mount-call - trying to reduce confusionMirko Vogt2012-12-191-1/+1
| | | | | | | | | | | The behaviour of calling 'mount' differed depending on whether it called the busybox-mount, the mount of util-linux, the mount defined in /lib/functions.sh and /lib/functions/boot.sh /etc/preinit even included /lib/functions.sh and /lib/functions/boot.sh, both re-defining 'mount'. SVN-Revision: 34792
* /etc/functions.sh => /lib/functions.shJo-Philipp Wich2012-06-051-1/+1
| | | | SVN-Revision: 32062
* base-files: wait for wifi modules to settleJonas Gorski2012-05-061-0/+3
| | | | | | | | | | On slower devices wifi drivers might take too long for detecting devices, resulting in the wifi detect call not seeing them. This was observed on a bcm6348 with bcm4318 wifi. Adding a one second pause was enough for b43 to expose the device. SVN-Revision: 31639
* base-files: remove old coldplugging hacks that are no longer necessary since ↵Felix Fietkau2012-03-131-10/+0
| | | | | | the new main hotplug2 instance calls udevtrigger as well SVN-Revision: 30916
* base-files: the initial hotplug2 instance sometimes misses a few relevant ↵Felix Fietkau2012-01-221-0/+1
| | | | | | events, e.g. during module load. rerun udevtrigger for the final hotplug2 instance to fix this SVN-Revision: 29862
* base-files: do not pass --set-worker /lib/hotplug2/worker_fork.so to ↵Jo-Philipp Wich2012-01-191-1/+0
| | | | | | hotplug2 anymore, its statically linked - patch by Viktar Palstsiuk <viktar.palstsiuk@promwad.com> SVN-Revision: 29806
* base-files: now that we have date -k, adjust the kernel timezone after ↵Jo-Philipp Wich2011-11-171-1/+4
| | | | | | setting up TZ and localtime SVN-Revision: 29204
* package/base-files: use new service wrapperNicolas Thill2011-11-071-12/+13
| | | | SVN-Revision: 28835
* base-files: load modules early, run wifi detect afterwards and only then ↵Felix Fietkau2011-11-031-6/+12
| | | | | | | | process uci defaults this allows uci-defaults scripts to override wifi settings SVN-Revision: 28733
* base-files: use "zonename" system option to symlink /etc/localtime via ↵Jo-Philipp Wich2011-09-261-0/+3
| | | | | | /tmp/localtime to /usr/share/zoneinfo for glibc and eglibc SVN-Revision: 28306
* base-files: pass conloglevel to syslogd (#9463, #9647)Jo-Philipp Wich2011-07-031-2/+6
| | | | SVN-Revision: 27400
* base-files: retrigger usb coldplug after module loading, solves ↵Jo-Philipp Wich2011-05-081-0/+5
| | | | | | usb_modeswitch on boot and possibly others (#9352) SVN-Revision: 26848
* base-files: Use -h instead of deprecated -L for symlink checkVasilis Tsiligiannis2011-04-051-1/+1
| | | | SVN-Revision: 26485
* base-files: fix minor problem in init.d/bootVasilis Tsiligiannis2011-04-051-1/+1
| | | | | | | | | The script tests for the existance of /dev/root with test -e which fails if /dev/root is a dangling symlink making the call to ln fail. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> SVN-Revision: 26483
* stop syslogd before rebooting, otherwise umount might not work properly when ↵Felix Fietkau2010-01-301-0/+6
| | | | | | logging to a file (thx, puchu) SVN-Revision: 19428
* do not start multiple subshells for applying /etc/uci-defaults. use sh -x ↵Felix Fietkau2009-12-091-4/+3
| | | | | | for hush compatibility SVN-Revision: 18717
* mount debugfs by defaultFelix Fietkau2009-11-231-0/+1
| | | | SVN-Revision: 18502
* extend logging functionsTravis Kemen2009-09-041-7/+17
| | | | SVN-Revision: 17514
* base-files: port init.d/boot to new config_getFelix Fietkau2009-08-071-9/+10
| | | | | | | | ... and localize some variables. Signed-off-by: Malte S. Stretz <mss@apache.org> SVN-Revision: 17157