For Debian Stretch:
- Reboot computer and enter the grub menu
- 'e' to edit the entry, usually the first/default entry
- on the line starting with 'linux', at 'ro quiet', substitute 'rw init=/bin/bash', or for read only access and a different shell, use 'ro init=/bin/sh'
- press control-X or F10 to reboot
- direct access to root command line is provided (if forgot to set rw instead of ro, use 'mount -n -o rw,remount /' at the command line)
- after making changes, reboot into normal security mode
With reference to archlinunx.
Alternative is to add 'debug-shell.service' to the boot line, F10 to boot, then use ctrl+alt+f9 to reach the debug session