Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Okay, so I made a really stupid mistake.

I made a shell script that runs nodemon /path/to/nodejs/file and added it to the boot process via update-rc.d mystartup.sh defaults 99, thinking I could use this to automatically start my Node.js server on boot in case/when I restart my server.

node and nodemon are commands that, when run, change the command context so that I can run Node-related commands. I can then exit out of the process by pressing Ctrl + C.

But when I boot, it's like the machine hasn't registered my I/O devices and I can't type, so I can't quit (or execute any other command). Nodemon just runs.

Is there some other way I can remove this startup command? It's farfetched, but I really screwed it up and I am not sure how to proceed.

share|improve this question
live dvd. edit/remove the file you messed up ;) –  Rinzwind May 10 '14 at 18:33

1 Answer 1

Just use a live CD or USB. Boot from it, choose "Try Ubuntu" and then mount your installed system's drive. For example, if the / drive of your installed system is /dev/sda1, you would want to do

sudo mkdir /mnt/oldroot
sudo mount /dev/sda1 /mnt/oldroot

Once you have done that, you should be able to navigate to the /etc/rcX.d directories and delete the relevant links. These directories (one for each runlevel) conatin links to scripts located in /etc/init.d. So, once you've removed the links, you may as well go and remove the script that you created in the /etc/init.d directory.

Once you've done that, reboot and you should be OK.

share|improve this answer
It's Ubuntu Server, so there's no "Try Ubuntu." What should I do when I get to the main menu? I don't want to install Ubuntu Server, I'm afraid I'd wipe everything. Do I run "Rescue a broken system"? –  M Miller May 10 '14 at 18:42
@MMiller you need to use a live CD. One that lets you boot into a live session. I've never installed the server edition. If that won't let you, just download a desktop ISO or, use a different Linux distribution. There's no need for it to be the same one. For example, you could try Damn Small Linux which is a 50MB image and will also allow you to fix your problem. –  terdon May 10 '14 at 18:46
Thanks. I was having difficulty running DSL (something weird about how my hard drive is configured), but I managed to get into a root command line from Recovery Mode, get access to the disk, and delete the shell file. –  M Miller May 10 '14 at 21:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.