aboutsummaryrefslogtreecommitdiff
path: root/package/base-files/files/lib/preinit/30_failsafe_wait
Commit message (Collapse)AuthorAge
* failsafe: run on all consoles listed in /proc/cmdlineMark Mentovai2022-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On x86, when both CONFIG_GRUB_CONSOLE and CONFIG_GRUB_SERIAL are set (as they are by default), the kernel command line will have two console= entries, such as console=tty0 console=ttyS0,115200n8 Failsafe was only running a shell on the first defined console, the VGA console. This is a problem for devices like apu2, where there is only a serial console and it appears on ttyS0. Moreover, the console prompt to enter failsafe during boot was delivered to, and its input read from, the last console= on the kernel command line. So while the failsafe shell was on the first defined console, only the last defined console could be used to enter failsafe during boot. In contrast, the x86 bootloader (GRUB) operates on both the serial console and the VGA console by virtue of "terminal_{input,output} console serial". GRUB also provided an alternate means to enter failsafe from either console. The presence of two console= kernel command line parameters causes kernel messages to be delivered to both. Under normal operation (not failsafe), procd runs login in accordance with inittab, which on x86 specifies ttyS0, hvc0, and tty1, allowing login through any of serial, hypervisor, or VGA console. Thus, serial access was consistently available on x86 devices with serial consoles under normal operation, except for shell access in failsafe mode (without editing the kernel command line). By presenting the failsafe prompt, reading failsafe prompt input, and running failsafe shells on all consoles listed in /proc/cmdline, failsafe mode will work correctly on devices with a serial console (like apu2), and the same image without any need for reconfiguration can be shared by devices with the more traditional (for x86) VGA console. This improvement should benefit any system with multiple console= arguments, including x86 and bcm27xx (Raspberry Pi). Signed-off-by: Mark Mentovai <mark at moxienet.com>
* treewide: drop shebang from non-executable lib filesAdrian Schmutzler2021-01-29
| | | | | | | | | | | | This drops the shebang from another bunch of files in various /lib folders, as these are sourced and the shebang is useless. Fix execute bit in one case, too. This should cover almost all trivial cases now, i.e. where /lib is actually used for library files. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: replace backticks by $(...)Adrian Schmutzler2020-07-11
| | | | | | | | | This replaces deprecated backticks by more versatile $(...) syntax. This does not touch lib/upgrade/nand.sh, as there replacement is not trivial. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: send informational UDP message each second waitingPaul Fertser2019-12-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The preinit network initialisation and failsafe informational message are inherently racy as the interface takes some time to become functional after "ip link set $pi_ifname up" command. Consider this timing: [ 12.002713] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready [ 12.008819] IPv6: ADDRCONF(NETDEV_UP): eth1.1: link is not ready [ 12.118877] random: procd: uninitialized urandom read (4 bytes read) [ 13.068614] eth1: link up (1000Mbps/Full duplex) [ 13.073309] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready [ 13.080445] IPv6: ADDRCONF(NETDEV_CHANGE): eth1.1: link becomes ready Since the UDP message was sent prior to link becoming ready, it was never seen on the wire. The default failsafe timeout is set to 2 seconds, so with this patch there are two attempts to send the message, one spent in vain, and the other visible in tcpdump on an attached host. Of course, in cases when the interface is brought up faster it leads to two messages, however it should be harmless. This patch (almost) doesn't affect normal boot time while still allowing to enter failsafe reliably with a single button press, matching the official "generic failsafe" documentation. Signed-off-by: Paul Fertser <fercerpav@gmail.com>
* base-files: fix several bashismsMichael Heimpold2018-12-05
| | | | | | | For equality test a simple = is sufficient, the == is usually disregarded as bashism. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
* base-files: Allow to disable failsafe modeJohn Crispin2016-04-19
| | | | Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
* base-files: fix whitespacesLuka Perkov2013-12-09
| | | | | | Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 39006
* base-files: allow users to delect debug level during bootJohn Crispin2013-11-25
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38909
* base-files: be verbose when entering failsafe due to a button being pressedJohn Crispin2013-07-25
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37535
* procd: make the preinit rules wildcard all buttons for failsafeJohn Crispin2013-06-10
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36896
* base-files: fix failsafe via button pressJohn Crispin2013-06-10
| | | | | | | | entering failsafe by pressing a button during boot was broken for procd as init Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36891
* preinit: move cmdline failsafe= handling ot the generic codeJohn Crispin2013-04-25
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36430
* make basefiles aware of procdJohn Crispin2013-03-13
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36003
* base-files: make press key message more explicit in preinitJo-Philipp Wich2010-03-23
| | | | SVN-Revision: 20392
* base-files: fix enter failsafe messageFelix Fietkau2010-03-01
| | | | SVN-Revision: 19937
* preinit: Remove Ctrl-C prompt...impossible on /dev/console (patch by cshore)Felix Fietkau2010-01-28
| | | | SVN-Revision: 19367
* add preinit modularization work by Daniel Dickinson (cshore)Felix Fietkau2010-01-25
SVN-Revision: 19331