Ubuntu输入密码登入黑屏后仍返回到登入界面的解决

进入命令行,方法1:先重启按住shift 进入到Grub界面。选择recovery mode。选择root,两次回车确认。

进入命令行,方法2(推荐):在登录界面按ctrl+alt+F1进入到命令模式。

$cd /home/grant

$ls -a,找到隐藏文件.xsession-errors

$vi .xsession-errors,查看启动失败原因,发现是profile文件中MATLAB环境变量设置错误原因:

ubuntu登入输入密码后黑屏一下仍旧返回到登入界面的解决

/usr/bin/xbrlapi: /usr/local/MATLAB/R2012a/bin/glnx86/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/i386-linux-gnu/libicuuc.so.55)

这段话的意思是libstdc++.so.6缺少CXXABI_1.3.8一个东西,应该是2012版MATLAB版本太老的原因,自带的libstdc++.so.6过时了。stackoverflow上有原因解释:GCC 4.9 introduces a newer C++ ABI version than your system libstdc++ has, so you need to tell the loader to use this newer version of the library by adding that path to LD_LIBRARY_PATH

知道出错原因后,就好办了,在终端输入$locate libstdc++.so.6,在输出列表中找到系统自带的libstdc++.so.6文件所在路径,用vi打开/etc/profile文件,将此路径添加到LD_LIBRARY_PATH环境变量中。(注:如果Ubuntu装在了虚拟机上,是个镜像文件,所以即使root进去了还是没有写权限。输入$mount -o rw,remount /即可。)

输入$source /etc/profile刷新。输入$cat /etc/profile确认

Ctrl+Alt+F7 切换回图形模式,登陆成功。(或者在命令行中输入:shutdown -r now ,马上重启计算机!)

猜你喜欢

转载自www.linuxidc.com/Linux/2016-08/134257.htm