更换 PATH 后陷入无限登录循环

更换 PATH 后陷入无限登录循环

我将 PATH 替换sudo gedit /etc/environment为常用的 Linux 路径/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games。当前/etc/environment只有:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

也跑了export PATH=$PATH:/usr/local/java/jdk1.8.0_111

重启系统后,我陷入了无限登录循环。请帮忙。

我正在显示的输出tail ~/.xsession-errors,,,,ls /sbin/inittype -a initinitwhich init

tail ~/.xsession-errors返回

Script for ibus started at run_im. 
Script for auto started at run_im. 
Script for default started at run_im. 
/etc/x11/Xsession.d/99*11-common _start: line 5: exec: init: not found

ls /sbin/init返回/sbin/int

type -a init返回-bash: type: init: not found

init返回

Command 'init' is available in '/sbin/init'
 The command could not be loaded because '/sbin' is not included in the PATH  environment variable. 
 This is most likely caused by the lack of administrative privileges associated with your account. 
 init: command not found

which initShell 保持安静并返回闪烁的光标。

我已经尝试过的解决方案是:

1)我输入chown hvs:hvs .Xauthority按下回车键后,shell 安静下来,返回到闪烁的光标。转到登录屏幕,仍然卡住。

2)我进入了sudo dpkg-reconfigure lightdm,然后我得到了这个菜单来选择默认显示管理器:gdm 或 lightdm。选择 lightdm 后,它会返回到闪烁的光标。我重新启动了,唯一的区别是 Ubuntu 从 GDM 切换到 lightdm。也没用。

3)我也尝试重置我的Unity 配置

4)我重新安装 Ubuntu 桌面。它没有起作用,所以我安装 Gnome 桌面. 也不起作用。

5)~/.profile在 GNU nano 中编辑默认脚本:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
   # include .bashrc if it exists
   if [ -f "$HOME/.bashrc" ]; then
      . "$HOME/.bashrc"
   fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

6)创建新用户帐户。沒有用。

还没试过GRUB 菜单和救援模式来挂载文件系统,rw mode然后编辑该文件

还有人有其他解决方案吗?

答案1

您应该编辑 /etc/environment 以遵循 PATH=$PATH:/usr/local/java/jdk1.8.0_111 no export。只需使用 ctrl alt f1 转到登录命令。使用 /usr/bin/sudo nano /etc/environment 并编辑它。然后重新启动,您应该能够登录

相关内容