现象:

  • 不管是输入命令 init 3 或者 init5 ,重启后都是直接进入图形界面
  • vim /etc/inittab 查看,内容如下:
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target

解决方案:

  • 英文注释写的很清楚,大致就是用systemctl set-default   和 systemctl get-default 取代数字级别
  • # 查看当前运行级别
    systemctl get-default
    
    # 设置当前运行级别为3 (开机为命令行模式)
    systemctl set-default multi-user.target
    
    # 设置当前运行级别为5 (开机为图形界面)
    systemctl set-default graphical.target

     

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐