0

I know this is a very unusual question but i had to create a bash script for a school project and I created a systemd service which calls a script on startup. Script contained (i think, cant check cause perma wall command) :

#!/bin/bash
until/while (ls /dev/pts/ | wc -l != 0) ## not sure if i added the != 0
do
   wall -n "this is a broadcast"
done

Is there a way to disable this script/wall command?

os is centOS stream 9 minimal installation (no gui) running in VirtualBox on MacOS

jmelger
  • 21
  • 2
  • mount the virtualbox disk image on your host pc and remove or edit the systemd unit file. – mashuptwice Feb 25 '22 at 22:25
  • @mashuptwice is this (including installing necessary commands to mount .vdi) possible without sudo? It's a school iMac. – jmelger Feb 25 '22 at 22:43
  • The reason why I've added this as a comment in contrast to an answer is that I don't work with MacOS and therefore can't give you any qualified answers to MacOS. In case it doesn't work, you could spin up another linux VM and mount the image in there. – mashuptwice Feb 25 '22 at 22:48
  • Thank you so much, will check it out tomorrow! – jmelger Feb 25 '22 at 22:58
  • @GamingTurtle Since this is a VM, you could also try booting into rescue.target (https://www.freedesktop.org/software/systemd/man/systemd.special.html#rescue.target). You should then be able to troubleshoot from inside the VM, and not do anything on the host. – Haxiel Feb 26 '22 at 03:27
  • @Haxiel I tried entering rescue mode from grub boot menu but it was also affected by the service. – jmelger Feb 26 '22 at 10:21
  • If you know how to blindly log in *and* know how you named the service (eg: myservice), you can just do this without looking at the screen: blindly log as root on console, and blindly type systemctl disable --now myservice – A.B Feb 26 '22 at 10:24
  • @mashuptwice mounting requires sudo although this would be a solution in this case it won't work. – jmelger Feb 26 '22 at 10:35
  • @A.B wall command for some reason seems to affect both stdin and stdout, whenever I try to enter a command it will get mixed with the broadcast. – jmelger Feb 26 '22 at 10:36
  • can't reproduce this here, but if you say so maybe. – A.B Feb 26 '22 at 11:27

1 Answers1

2

Fixed by adding the Virtual Disk Image as SATA device to a second linux VM, mounting it and commenting out the script.

Thanks everyone.

jmelger
  • 21
  • 2