Text-mode runlevel without altering init scripts
If you want occasional access to a text-mode or other custom runlevel without altering the stock ubuntu /etc/event.d scripts or grub menu.lst file, here is a simple way to add it as another recovery menu choice.
As root, copy this file to /usr/share/recovery-mode/options and make it executable. I named the file "textmode" but you can use any name you like./usr/share/recovery-mode/options/textmode
#!/bin/sh if [ "$1" = "test" ]; then echo "Runlevel 3: Text mode" exit 0 fi /sbin/telinit 3
To copy and set permissions from the command line, you can use the commands:
sudo cp textmode /usr/share/recovery-mode/options
sudo chmod +x /usr/share/recovery-mode/options/textmode
Now when you select "Recovery Mode" from your grub boot menu, the recovery menu will present this choice along with the others. You still need to configure runlevel 3 for a text login and/or any other custom settings you want; in a default installation there is no difference between runlevels 2 through 5. The main change is to not run /etc/init.d/gdm. You can rename the link in /etc/rc3.d like so:
sudo mv S30gdm K01gdm
There are other services that need not run in text mode, and probably some you don't need at all on your system. Take a look at modifying runlevels for more info.
Note: Some older versions of ubuntu do not use a recovery menu. Instead, like most other distributions, they simply boot to a root shell when recovery mode is selected at boot. In that case, use the command
telinit 3to change to runlevel 3