AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 435324
Accepted
goteguru
goteguru
Asked: 2018-04-04 08:28:13 +0800 CST2018-04-04 08:28:13 +0800 CST 2018-04-04 08:28:13 +0800 CST

没有default.target,systemd如何启动?

  • 772

systemd 文档和各种在线资源都声明 systemd 应该(默认情况下)启动名为“default.target”的“特殊”目标。可以通过 systemctl set-default 更改此设置,这基本上是从 default.target 到所需目标的符号链接。

但是在我的系统中没有这样的文件。没有/etc/systemd/system/default.target,没有/usr/lib/systemd/system/default.target(实际上这个文件在整个系统中是不存在的)。系统仍在启动。我的问题是怎么可能?

(当然我可以自己做一个符号链接,我只是想知道如何在没有 default.target 的情况下定义一个默认值)

附加信息:

# systemctl get-default
graphical.target

所以我的默认目标是graphics.target。但它在哪里(以及如何)定义?

# find /usr/lib -iname "default.target" # no results
# find /etc -iname "default.target" # no results
# lsb_release -a
LSB Version:    n/a
Distributor ID: Gentoo
Description:    Gentoo Base System release 2.4.1
Release:    2.4.1
Codename:   n/a

# systemctl list-units --type=target
UNIT                  LOAD   ACTIVE SUB    DESCRIPTION                  
basic.target          loaded active active Basic System                 
getty.target          loaded active active Login Prompts                
graphical.target      loaded active active Graphical Interface          
local-fs-pre.target   loaded active active Local File Systems (Pre)     
local-fs.target       loaded active active Local File Systems           
machines.target       loaded active active Containers                   
multi-user.target     loaded active active Multi-User System            
network-online.target loaded active active Network is Online            
network.target        loaded active active Network                      
nss-lookup.target     loaded active active Host and Network Name Lookups
paths.target          loaded active active Paths                        
remote-fs.target      loaded active active Remote File Systems          
slices.target         loaded active active Slices                       
sockets.target        loaded active active Sockets                      
sound.target          loaded active active Sound Card                   
swap.target           loaded active active Swap                         
sysinit.target        loaded active active System Initialization        
timers.target         loaded active active Timers                       

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

18 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
linux boot
  • 1 1 个回答
  • 4195 Views

1 个回答

  • Voted
  1. Best Answer
    ErikF
    2018-04-04T08:59:08+08:002018-04-04T08:59:08+08:00

    Gentoo将 systemd 文件的位置更改/lib/systemd为 2017 年 7 月。在我的系统上,我可以在以下位置看到默认符号链接/lib/systemd/system:

    $ ls -l /lib/systemd/system/default.target
    lrwxrwxrwx 1 root root 16 Apr  2 15:48 /lib/systemd/system/default.target -> graphical.target
    

    如果您添加符号链接/etc/systemd/system(就像这样systemctl set-default做),它将覆盖分发的默认设置。

    • 4

相关问题

  • 有没有办法让 ls 只显示某些目录的隐藏文件?

  • 使用键盘快捷键启动/停止 systemd 服务 [关闭]

  • 需要一些系统调用

  • astyle 不会更改源文件格式

  • 通过标签将根文件系统传递给linux内核

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    ssh 无法协商:“找不到匹配的密码”,正在拒绝 cbc

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    如何卸载内核模块“nvidia-drm”?

    • 13 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Wong Jia Hau ssh-add 返回:“连接代理时出错:没有这样的文件或目录” 2018-08-24 23:28:13 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST
  • Martin Hope
    Bagas Sanjaya 为什么 Linux 使用 LF 作为换行符? 2017-12-20 05:48:21 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve