0

I don't want to start over from scratch.
There are several ways I could change the monitor.service so it would fail or run without booting:

pi@raspberrypi:~ $ sudo systemctl --full edit monitor.service
pi@raspberrypi:~ $ sudo nano /etc/systemd/system/monitor.service
pi@raspberrypi:~ $ systemctl stop monitor.service

edit the app monitor.py so it won't have the option to reboot.
change a value in the file cmdfile.txt so it won't take the reboot path in the app.

But it already reboots before any of the above options are available.

I Have a limited number of options:
Since I don't want to reload the system NOOBS.
1) hold down Shift when the raspberry pi screen comes up.
2) select Edit config
3) click cmdline.txt
4) add " init/bin/bash" to the end of the command line.
5) click OK
6) click Exit
7) it will reboot and stop at the bash.sh prompt # (I have to push enter to get the prompt)

At this time I can
change directories: cd
list files: ls
read files: sudo nano monitor.py
I can not modify them: [ file 'monitor.py' is unwriteable ]
I can not change their permissions: chmod 666 monitor.py
chmod changing permissions of 'monitor.py' Read only file system
I suspect these are images only before being loaded into the system.
https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained
Is there anything in config.txt that I could un-comment or add?

I need a different option than "init/bin/bash" in the command line that runs later in the boot process and allows me to modify files.
Or I need to know how to enable bash.sh to modify files. -- I suspect the files are not loaded yet.
I would like to use " systemctl stop monitor.service"
I would like to stop boot right before monitor.service runs.
exit takes me to a dead end and I can turn the power off.

I suspect I could change the files if I loaded them on Linux file system for Windows.
https://www.paragon-software.com/home/linuxfs-windows/#
I see where I could change it to read/write: mount -o remount,rw /dev/mmcblk0p2 https://raspberrypi.stackexchange.com/questions/61638/how-do-i-start-up-in-safemode
but I am not ready to take that leap and my partitions are different (or I don't understand them) /dev/mmcblk0p7
I keep looking for a magic command that asks me
"Hey Bozo, do you want to run your bad, screwed up monitor.service?"
And I'll chose No.
Or a set of keystrokes that stops autoload right after the raspberry pi screen opens and before idle.
Thank you.

1 Answers1

0

You can repair most such problems on the Pi by rebooting to a root shell.

  1. Append init=/bin/sh at the end of cmdline.txt and reboot.
  2. After booting you will be at the prompt in a root shell.
  3. Your root file system is mounted as readonly now, so remount it as read/write mount -n -o remount,rw /

You can then edit files.

NOTE if you are running NOOBS the appropriate cmdline.txt WILL NOT be in the first partition, but one of the other FAT partitions (depends on what you installed).

Milliways
  • 59,890
  • 31
  • 101
  • 209