[SOLVED] I put an 'exit' in my /etc/bashrc and now can't open a terminal or modify!
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I put an 'exit' in my /etc/bashrc and now can't open a terminal or modify!
Hi,
This was a very bad move, but I put an exit in my /etc/bashrc file and now I can not open a new terminal or modify the file. I can't su and their are no users in the sudoers file. Please let me know if you have any ideas. TIA
Idea #1: Try using your `run command` dialog box (should be something like this in your menus somewhere) and starting your terminal manually, giving the command with /bin/bash and the --norc and/or --noprofile option to tell it to ignore the broken file(s).
Something like below in your run dialog:
Code:
gnome-terminal -c /bin/bash --norc --noprofile
You didn't tell us what OS you're running; I'm guessing Ubuntu or RHEL, but depending what OS it is, you'll want to specify whatever terminal program you normally use.
Idea #2: Ubuntu has Dash shell installed. You could reboot and edit your kernel boot line to include init=/bin/dash which should boot you to a minimal environment shell prompt, from where you could repair the file.
NOTE: There might be an easier idea(s) but this is what comes to mind.
Last edited by GrapefruiTgirl; 08-19-2010 at 09:13 AM.
OK, I don't know what RHEL has for a terminal program, but surely it has `xterm`; it might be lacking gnome-terminal though.
Oh, and believe I have made a mistake above; it should be -e to execute a command with for example xterm, not -c (-c is for bash). So your run dialog would look something like:
Code:
xterm -e /bin/bash --norc --noprofile
Note: the -e option gives me an error even though syntax is correct according to the manpage, but if I leave it out, it works fine:
Code:
xterm /bin/bash --norc --noprofile
Sorry about that mistake above - and good luck!
Last edited by GrapefruiTgirl; 08-19-2010 at 09:27 AM.
If you know your error, you should also be able to re-edit the file that is causing your misery using a linux live-cd, one that will give you "root"(read/write) privileges. PCLinuxOS with KDE is a suggestion, but there are others with Gnome if that is more familiar to you.
You may have to boot into "guest" and change the log-in to "root" thereafter, as is the case with PCLinuxOS.
Last edited by thorkelljarl; 08-19-2010 at 09:24 AM.
OK, I don't know what RHEL has for a terminal program, but surely it has `xterm`; it might be lacking gnome-terminal though.
Oh, and believe I have made a mistake above; it should be -e to execute a command with for example xterm, not -c (-c is for bash). So your run dialog would look something like:
Code:
xterm -e /bin/bash --norc --noprofile
Note: the -e option gives me an error even though syntax is correct according to the manpage, but if I leave it out, it works fine:
Code:
xterm /bin/bash --norc --noprofile
Sorry about that mistake above - and good luck!
Thanks for the help! That allowed me to pop a new terminal..the only problem is that when I su to edit the /etc/bashrc file I exit back to the non-root prompt. This is a tricky problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.