hmmm, rough guess: I'd assume the mountpoint might not be yet available when you start the script. And you should be able to tell grub to init=/bin/sh or something like this. Maybe you need to put something more due to systemd start
Single user mode is not accessible during the boot process, you can access single user mode if you are logged into Linux by typing "init 1"
in my reply surely grub -> uboot. Aren't there boot options for uboot as well similar to what you'd have with grub?
That would be a very handy thing to have. Most Unix devices going back to early Sun workstations had boot into single user mode. It comes in handy if there's a regular startup problem so you can edit startup config files in root and bring things back up.
In my case I was stuck in a startup loop and couldn't get to Unix prompt. Ended up having to re-flash the whole thing and had to go back to zero.
Thanks mhahn. Grub commands don't seem to match uboot. I tried lots of variations including 'single' as well as 'run bootcmd single' and various forms of -s, s, single, 1, and -1). None of them worked. Based on response from JPMonteiro there doesn't appear to be a way to go single-user. Ended up reflashing and starting all over.
Really wish they'd add that in. It's going to be a big barrier in the way of adding startup services to systemd.
There's something called rescue mode, which is AFAICS pretty much "single", you can boot into by doing the below:
1) At the very stage of the board's boot process, at the "Hit any key to stop autoboot" prompt, hit any key
2) Type "setenv bootargs_target rescue" and hit Enter
3) Type "boot" and hit Enter
The system will boot into so called "rescue.target" mode which I haven't investigated much, but it looks very much like a single user mode. The command acts only for the current boot, if you reset the board, it will try to boot into standard multiuser mode again.
I'm not sure if it's going to help you with this specific problem of mount not coming up on time, but you can defintiely try and see Please report back here, I'm sure your findings will be interesting for others.
Below is the serial console log of an example boot into this mode with the things you need to type in bold green:
PSH KERNEL VERSION: b0182727
SCU IPC: 0x800000d0 0xfffce92c
PSH miaHOB version: TNG.B0.VVBD.0000000c
microkernel built 23:15:13 Apr 24 2014
******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size) = 0x00080000
*** Ready to receive application ***
U-Boot 2014.04 (Oct 05 2014 - 16:32:58)
DRAM: 980.6 MiB
MMC: tangier_sdhci: 0
Hit any key to stop autoboot: 0
boot > setenv bootargs_target rescue
boot > boot
Partitioning already done...
Flashing already done...
GADGET DRIVER: usb_dnl_dfu
5129792 bytes read in 127 ms (38.5 MiB/s)
Valid Boot Flag
Setup Size = 0x00003c00
Magic signature found
Using boot protocol version 2.0c
Linux kernel version 3.10.17-poky-edison+ (ed@bl-ub1204) #1 SMP PREEMPT Sun Oct 5 15:36:14 CEST 2014
Building boot_params at 0x00090000
Loading bzImage at address 00100000 (5114432 bytes)
Magic signature found
Kernel command line: "root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=rescue.target hardware_id=00 g_multi.iSerialNumber=bb11d34bb98d8306630653ab88ac5d79"
Starting kernel ...
<boot sequence cut>
Starting Rescue Shell...
[ OK ] Started Rescue Shell.
[ OK ] Reached target Rescue Mode.
Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.
Type "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.
Give root password for system maintenance
(or type Control-D for normal startup):
for a permanent change you could directly modify systemd.
By default the "default.target" maps to multi-user. You may change it to whatever seems fine for you. This could be e.g. the "rescue.target" mentioned by AlexT_Intel or the "basic.target" or something you define yourself.
# ls -la /etc/systemd/system/default.target
lrwxrwxrwx 1 root root 37 Oct 9 14:22 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target