6

I changed the file which is in /usr/share/xsessions/gnome.desktop and now I want to change it back to its original state from a GRUB prompt because now my system is not able to login.

3
  • 4
    How are you not able to boot into your RHEL Linux? This file shouldn't render your system unbootable if it's corrupt. Switch to a virtal console with Ctrl+Alt+F1 or similar to login without X and edit the file.
    – user13742
    Commented Jun 6, 2013 at 10:23
  • @htor, i tried this but nothing is coming.
    – subbarao
    Commented Jun 6, 2013 at 10:31
  • The virtual consoles should still be there, just make sure you're holding down CTRL-ALT as you hit F1 htor is right, even if this file were totally messed up, it would only stop you from logging into the desktop.
    – Bratchley
    Commented Jun 6, 2013 at 10:49

2 Answers 2

11

There is no way to edit a file from the Grub prompt. But you don't need to do that.

As htor and Christopher already suggested, you should be able to switch to a text mode console by pressing Ctrl+Alt+F2 and log in there and edit the file.

If for some reason you can't even get a text mode login prompt, boot in single-user mode. In Grub, edit the command line, add 1 at the end of the linux … line, and press Ctrl+X to boot. In seriously hosed situations, init=/bin/sh might work better than 1.

1
  • Edit the command line? What does that mean
    – Silidrone
    Commented Apr 3, 2023 at 8:57
0

To edit the command line, you just have to press the indicate key (for example, in the image, you have to press "e") in the Grub menu with the ubuntu option selected. This will open a screen with some parameters, so you gonna edit the line that starts with "linux" putting init=/bin/sh in the end like Gilles said and press ctrl+x or f10 to boot. In my case, I needed to edit some files to be possible to login then i had to change a parameter of the line from ro to rw. Grub menu image

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .