0

I have been using Ubuntu for 2 months and it work fine. Yesterday I tried to make my Texlive Manager (tlmgr) running by inserting a PATH in /etc/profile.d.

Today when I wanted to login as usual, I cannot login.

I tried the Ctrl-Alt-F1 and login through tty1. Yes, I could login. The shell is there. However, when I wanted to open the /etc/profile.d to delete whatever I inserted, I could not open the file. I tried gedit command but the error is like this:

gedit is available in /usr/bin/gedit
gedit : command not found.

Can anyone help me. There are so many questions regarding this matter but I do not know which answer is relevant with my problem. Thank you.

Warren Hill
  • 22,112
  • 28
  • 68
  • 88

3 Answers3

0

In tty1 you cannot to edit a file with gedit. Use vi for example:

sudo vi /etc/profile.d/[file]

where [file] is the name of the file that you edited (it cannot be /etc/profile.d because this is a directory).

And I think that you should reset your PATH to default (because of gedit : command not found.):

export PATH='/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'

Other thing that you can do is when you are in tty1 to run this:

sudo chown -R $USER:$USER /home/$USER/

You can replace $USER with your actual username.

Try logging in again.

Radu Rădeanu
  • 169,590
  • Thank you. I cannot run the vi command either. Even ls command too. But I didn't try to do the export PATH....Let me try first. – wahidah hashim May 09 '13 at 13:04
  • @wahidahhashim Reset your PATH and after it will work. – Radu Rădeanu May 09 '13 at 13:07
  • Follow the above command is it? OK..I'll do it now..TQ – wahidah hashim May 09 '13 at 13:08
  • OK...I can open my nano :) but..I couldn't find the file that I want to open. Yesterday, I would like to make my tlmgr working. So, I followed an instruction to insert PATH=/usr/local/texlive/2011/bin/x86_64_linux:$PATH but now I couldn't remember where I inserted it. – wahidah hashim May 09 '13 at 13:33
  • @wahidahhashim Most probably could be .profile file (/home/$USER/.profile ) – Radu Rădeanu May 09 '13 at 13:55
  • I found it in /etc/environment. Deleted the added PATH=/usr/local/texlive/2011/bin/x86_64_linux:$PATH. However, it seems that's not the problem because I still could not login as usual through GUI. After entered password, the screen became black just a second and have to login again. What to do now? Tq. – wahidah hashim May 09 '13 at 14:53
  • Hi @wahidah-hashim, take a look at my edited answer. – Alaa Ali May 09 '13 at 15:14
  • @wahidahhashim I just edited my answer, try with this – Radu Rădeanu May 09 '13 at 15:14
  • Sorry, which answer Mr.Radu? I thought on trying the command sudo rm ./.Xauthority that you suggested in other link. – wahidah hashim May 09 '13 at 15:21
  • @wahidahhashim Try this command sudo chown -R $USER:$USER /home/$USER/ and after sudo reboot – Radu Rădeanu May 09 '13 at 15:30
  • Hi! Sorry to say, it's not working. I tried sudo rm ./.Xauthority and also sudo chown -R $USER:$USER /home/$USER/. I also tried to sudo apt-get install --reinstall ubuntu desktop. The result still the same. I could not login through GUI. After insert password and enter, the screen blank black for a second and login interface appeared again. Any other solution? – wahidah hashim May 10 '13 at 02:13
  • I also tried a suggestion from a link: ctrl-alt-f2 then sudo chown user:user .Xauthority NOT WORKING too....:( Could it be because of different Ubuntu version? – wahidah hashim May 10 '13 at 02:45
  • Final step I think...I followed the link...$ecryptfs-mount-private and also $sudo apt-get install gnome-session fallback. I got error on the gnome-session. I also tried from other link....sudo pstree, sudo apt-get install gdm, sudo dpkg-reconfigure lightdm.....ALL NOT WORKING...I am thinking to stop using Ubuntu...looking for Cygwin instead...Thank you for your cooperation. – wahidah hashim May 10 '13 at 11:30
  • Uninstall and re-install Ubuntu...is it the last choice I have? – wahidah hashim May 10 '13 at 12:01
0

First of all profile.d is a directory, and you can't edit a directory. The file that you edited is inside that directory.

So try this. When you do Ctrl+Alt+F1, and log in, do:

nano

When the editor opens, do Ctrl+R, and type the path like this:

/etc/profile.d/file_name
Mitch
  • 107,631
  • I think that you have forgotten to included the output:) – Mitch May 09 '13 at 12:59
  • Thank you. After login, the output is -bash: groups: command not found Command 'uname' is available in '/bin/uname' The command could not be located because '/bin' is not included in the PATH environment variable......etc....and finally appeared wahidahusm@wahidah:~$ When I type nano, the output is: Command 'nano' is available in the following place /bin/nano and /usr/bin/nano The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable. Why is this happened? – wahidah hashim May 09 '13 at 13:01
  • It happened because its not in your path statement. You can use full path as so: /usr/bin/nano, and you should be OK. – Mitch May 09 '13 at 13:09
0

Okay, first, login through tty1 (Ctrl+Alt+F1), then type this at the prompt:

sudo /usr/bin/vi ~/.bashrc

When it opens up, press i. Press enter to insert a line, then press up to go to the empty line. In this empty line you just inserted, type in the following:

export PATH='/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/texlive/2011/bin/x86_64_linux'

After you type it, press Esc, then press Shift+Z+Z (capital Z twice). This should close and save the file, and bring you back to the tty prompt.

Restart your machine.

Alaa Ali
  • 31,535
  • Hi! Tq. I found the file and edited already but it seems not affecting the login through GUI. Now I found an answer from other link, I would like to try the sudo rm ./.Xauthority Is it possible? – wahidah hashim May 09 '13 at 15:17
  • Yeah, I guess you could go ahead. I found two other questions that have the same answer, which is to sudo rm ~/.Xauthority (the two questions are http://askubuntu.com/q/129246/52726 and http://askubuntu.com/q/130153/52726). – Alaa Ali May 09 '13 at 15:36
  • Hi AlaaAli. I tried the above recommendation. Unfortunately..failed to login as usual...Thank you for your support. – wahidah hashim May 10 '13 at 11:58