Solution to system logon Failure Caused by incorrect environment variables in Ubuntu

Source: Internet
Author: User
Your session lasts for less than 10 seconds. If you have not logged out, this means that the Ubuntu installation may fail or your disk space is exhausted. You can try to log on in a secure mode to check whether the problem can be solved. View Details (~ /. Xsession-errors file)/etc/mcm/Xsession: Beginningsessionsetup... /Etc/profile: 26: id: notfound [: 26: Illegalnu

Your session lasts for less than 10 seconds. If you have not logged out, this means that the Ubuntu installation may fail or your disk space is exhausted. You can try to log on in a secure mode to check whether the problem can be solved.

View Details (~ /. Xsession-errors file)
/Etc/TPD/Xsession: Beginning session setup...
/Etc/profile: 26: id: not found
[: 26: Illegal number:
/Etc/TPD/Xsession: 179: grep: not found
/Etc/TPD/Xsession: 192: ls: not found
/Etc/TPD/Xsession: Executing/usr/bin/gnome-session failed, will try exec: 205: x-terminal-emulator: not found

The same error is reported when you log on with another session. If you enter the Secure Mode Terminal, ls su cannot be used.
Command 'LS' is available in '/bin/ls'
The command cocould not be located because '/bin' is not supported ded int the PATH environment variable
Bash: ls: Command not found
After searching for the environment variable for half a day on the Internet, the system cannot be restarted.
Because environment variables are set in/etc/environment
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Export PATH =/home/yan/share/usr/local/arm/3.4.1/bin: $ PATH
LANGUAGE = "zh_CN: zh: en_US: en"
LANG = "zh_CN.UTF-8"
Failed to log on to the system due to an error.
Delete the red line to log on.

The following files can be used to set environment variables in Ubuntu:

/Etc/profile: The first file used by the operating system to customize the user environment during login. This file sets environment information for each user in the system. When the user logs on for the first time, the file is executed.

/Etc/environment: the second file used by the operating system during logon. Before the System reads your own profile, it sets the environment variable of the environment File.

~ /. Profile: The third file used for logon is. profile file. Each user can use this file to input shell information dedicated to their own use. When a user logs on, this file is only executed once! By default, it sets some environment variables to execute the user's. bashrc file.

/Etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read.

~ /. Bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log on and every time you open a new shell.

There are three methods to set environment variables:
I. Temporary settings
Export PATH =/home/yan/share/usr/local/arm/3.4.1/bin: $ PATH

Ii. Global settings of the current user
Open ~ /. Bashrc, add row:
Export PATH =/home/yan/share/usr/local/arm/3.4.1/bin: $ PATH

Make effective

Source. bashrc
3. Global settings for all users
$ Vim/etc/profile
Add:
Export PATH =/home/yan/share/usr/local/arm/3.4.1/bin: $ PATH
Make effective
Source profile

Test echo $ PATH

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.