I edited root ~/.bashrc today, and suddenly the system became lagged so I tried to reboot it. and the screen showed that enter image description here I cannot login in at all. the system version is redhat 6.5 and there is a particular important file in it. how to recovery the system or at least backup my file?

I tried to hard reboot. and after I editing bashrc I executed

chmod u+x ~/.bashrc
source ~/.bashrc

and I cannot login single user mode too

  • Did you try hard reboot? Jul 7, 2016 at 15:27
  • 1
    How is the issue of not being able to log in related to your edit to the shell init script? Any change in root's shell init script would not affect the system without you logging into it (it's only used for interactive shells). There's probably something else going on, but there is no info, so it's hard to tell...
    – Kusalananda
    Jul 7, 2016 at 15:29
  • 2
    most likely an infinite loop, or a shell calling itself recursively. follow procedure used to recover root password, but just delete ~root/.bashrc if you think it is the culprit.
    – Archemar
    Jul 7, 2016 at 15:32
  • what info else I need to give?
    – michael
    Jul 8, 2016 at 2:34

2 Answers 2


See if you have any swap space setup

free -m

if swap just shows 0 then setup some up. Example below

sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=2048
sudo chown root:root /mnt/swapfile
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
sudo swapon

Edit fstab to enable swapfile on reboots startups

sudo nano /etc/fstab

Add this to the bottom of the fstab file

/mnt/swapfile swap        swap  defaults        0   0


free -m

Should show swap space now and see if that helps out.


To answer your first question more information on what's going on (what's using all the memory) is required. I don't know why the .bashrc is causing a problem, but you can delete it or change it.

If needed, as a debugging step perhaps you could try adding a large swap file to delay the out of memory situation long enough to see what process is causing the problem and kill/fix it if it's unrelated to your .bashrc changes.

To access your filesystem for recovery or to backup your data you can use a boot disk and mount your hard drive(s) with it. This will bypass whatever is wrong with your installation.


Alternatively, instead of single user mode or rescue CDs you can try appending "init=/bin/bash" to the linux line in grub by editing the first menu entry when the grub menu first appears on boot. This will prevent anything from loading and go straight to bash after the kernel loads rather than starting runlevel 1.

Once you get a command prompt, you'll likely want to remount your filesystem(s) read-write with a command such as:

mount -oremount,rw /

Once you have access to your files, you can copy over the network or to external storage or fix your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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