Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
08-19-2010, 09:03 AM
|
#1
|
LQ Newbie
Registered: Jun 2004
Location: Atlanta,GA
Distribution: RHEL5.0
Posts: 19
Rep:
|
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
T.
|
|
|
08-19-2010, 09:11 AM
|
#2
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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.
|
|
1 members found this post helpful.
|
08-19-2010, 09:14 AM
|
#3
|
LQ Newbie
Registered: Jun 2004
Location: Atlanta,GA
Distribution: RHEL5.0
Posts: 19
Original Poster
Rep:
|
Thank you - I will go try this now. Sorry it's a RHEL5.0 box.
|
|
|
08-19-2010, 09:21 AM
|
#4
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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.
|
|
1 members found this post helpful.
|
08-19-2010, 09:22 AM
|
#5
|
Senior Member
Registered: Jun 2008
Posts: 1,821
|
Or, if you can boot into it...
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.
|
|
1 members found this post helpful.
|
08-19-2010, 09:41 AM
|
#6
|
LQ Newbie
Registered: Jun 2004
Location: Atlanta,GA
Distribution: RHEL5.0
Posts: 19
Original Poster
Rep:
|
Quote:
Originally Posted by GrapefruiTgirl
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.
|
|
|
08-19-2010, 09:45 AM
|
#7
|
Member
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Rep: 
|
login as root from the gdm
|
|
|
08-19-2010, 09:46 AM
|
#8
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Hmm. I wonder, what if you `su` and directly give su a command to either `mv` the offending file immediately to a backup? For example:
Code:
su -c mv /etc/bashrc /etc/bashrc.bak
Or, specify your bash shell with the options given earlier:
Code:
su -s /bin/bash --norc --noprofile
for the same effect as earlier.
|
|
1 members found this post helpful.
|
08-19-2010, 09:53 AM
|
#9
|
LQ Newbie
Registered: Jun 2004
Location: Atlanta,GA
Distribution: RHEL5.0
Posts: 19
Original Poster
Rep:
|
Quote:
Originally Posted by GrapefruiTgirl
Hmm. I wonder, what if you `su` and directly give su a command to either `mv` the offending file immediately to a backup? For example:
Code:
su -c mv /etc/bashrc /etc/bashrc.bak
Or, specify your bash shell with the options given earlier:
Code:
su -s /bin/bash --norc --noprofile
for the same effect as earlier.
|
You solved it - can't say thanks enough! This worked:
su -c "mv /etc/bashrc /etc/bashrc.bak"
I then went in with vi and edited out the mistake.
I thought I would have to boot from a live disk as noted in a reply above. THANK YOU!
|
|
|
08-19-2010, 09:56 AM
|
#10
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Cool, you're welcome - I'm glad it worked! I see you're posting from the RHEL box now
Cheers 
|
|
|
All times are GMT -5. The time now is 10:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|