如何配置 systemd 以在 GDM/GUI 之前强制安装所有本地驱动器(无网络设备)?

如何配置 systemd 以在 GDM/GUI 之前强制安装所有本地驱动器(无网络设备)?

我正在尝试确定与 UbuntuMATE 20.04 环境的磁盘安装和图形显示管理器相关的单元优先级/先决条件排序。

尝试解决无法访问非根分区的问题,通过指定“/home/user”目录作为用户桌面上显示内容的信息源,导致系统“自动恢复”,当“/home/user/桌面”是一个符号链接指向不同的分区“/DB001_F2/home/user.Desktop”。

迄今为止 ...

# systemctl get-default
graphical.target
#

# systemctl list-dependencies graphical.target
...(snip)...
●   │ │ ├─local-fs.target
●   │ │ │ ├─-.mount
●   │ │ │ ├─DB001_F2.mount
●   │ │ │ ├─DB001_F3.mount
●   │ │ │ ├─DB001_F4.mount
...(snip)...
#

我需要知道如何调整配置文件本地 fs.target(*.conf文件或*.想要目录条目???),或者如果我需要创建一个自定义文件,但我不知道所需的内容。

我的环境是Ubuntu伴侣20.04
桌面:MATE 1.24.0
发行版:Ubuntu 20.04.2 LTS (Focal Fossa)
内核:5.4.0-67-generic x86_64

PS 完整精简的 systemd 目标树如下:

graphical.target
● ├─accounts-daemon.service
● ├─apport.service
● ├─cpufrequtils.service
● ├─e2scrub_reap.service
● ├─grub-common.service
● ├─hddtemp.service
● ├─lightdm.service
● ├─loadcpufreq.service
● ├─systemd-update-utmp-runlevel.service
● ├─udisks2.service
● └─multi-user.target
●   ├─...(snip)...
●   └─basic.target
●     ├─...(snip)...
●     └─sysinit.target
●       ├─...(snip)...
●       └─local-fs.target
●         ├─-.mount
●         ├─DB001_F2.mount      <<< Need to ensure this is fully mounted and accessible
●         ├─...(snip)...
●         ├─systemd-fsck-root.service
●         └─systemd-remount-fs.service

(3 月 27 日添加)目前桌面外观如下:

在此输入图像描述

它正在显示“的内容${家}“目录就好像它是”${HOME}/桌面”。

(3 月 28 日添加)这 ”.xsession-错误“文件是我能想到的唯一能提示正在发生的事情的东西。最后,它说“$HOME”格式错误。以下是从开始到遇到错误的相关部分:

# more .xsession-errors

dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting DISPLAY=:0
dbus-update-activation-environment: setting XAUTHORITY=/home/ericthered/.Xauthority
dbus-update-activation-environment: setting GTK_MODULES=appmenu-gtk-module:gail:atk-bridge:canberra-gtk-module
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting SHELL=/bin/bash
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
dbus-update-activation-environment: setting XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
dbus-update-activation-environment: setting LANGUAGE=en_CA:en
dbus-update-activation-environment: setting DESKTOP_SESSION=mate
dbus-update-activation-environment: setting GTK_MODULES=appmenu-gtk-module:gail:atk-bridge:canberra-gtk-module
dbus-update-activation-environment: setting PWD=/home/ericthered
dbus-update-activation-environment: setting XDG_SESSION_DESKTOP=mate
dbus-update-activation-environment: setting LOGNAME=ericthered
dbus-update-activation-environment: setting QT_QPA_PLATFORMTHEME=gtk2
dbus-update-activation-environment: setting XDG_SESSION_TYPE=x11
dbus-update-activation-environment: setting GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
dbus-update-activation-environment: setting XAUTHORITY=/home/ericthered/.Xauthority
dbus-update-activation-environment: setting XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/ericthered
dbus-update-activation-environment: setting GDM_LANG=en_CA
dbus-update-activation-environment: setting HOME=/home/ericthered
dbus-update-activation-environment: setting IM_CONFIG_PHASE=1
dbus-update-activation-environment: setting LANG=en_CA.UTF-8
dbus-update-activation-environment: setting XDG_CURRENT_DESKTOP=MATE
dbus-update-activation-environment: setting XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
dbus-update-activation-environment: setting XDG_SESSION_CLASS=user
dbus-update-activation-environment: setting GTK_OVERLAY_SCROLLING=0
dbus-update-activation-environment: setting USER=ericthered
dbus-update-activation-environment: setting DISPLAY=:0
dbus-update-activation-environment: setting SHLVL=1
dbus-update-activation-environment: setting UBUNTU_MENUPROXY=1
dbus-update-activation-environment: setting XDG_RUNTIME_DIR=/run/user/1000
dbus-update-activation-environment: setting COMPIZ_CONFIG_PROFILE=mate
dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/share/mate:/usr/local/share:/usr/share:/var/lib/snapd/desktop
dbus-update-activation-environment: setting PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
dbus-update-activation-environment: setting GDMSESSION=mate
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting _=/usr/bin/dbus-update-activation-environment
mate-session[1437]: WARNING: Unable to find provider '' of required component 'dock'
Window manager warning: Log level 128: unsetenv() is not thread-safe and should not be used after threads are created
Window manager warning: Log level 128: Name com.canonical.AppMenu.Registrar does not exist on the session bus

mate-session[1437]: WARNING: Could not launch application 'indicator-datetime.desktop': Unable to start application: Failed to execute child process “
/usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service” (No such file or directory)
cannot create user data directory: /home/ericthered/snap/ubuntu-mate-welcome/611: Not a directory

(caja:1733): Gtk-WARNING **: 15:31:10.074: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register clien
t

(process:1962): indicator-sound-WARNING **: 15:31:10.146: volume-control-pulse.vala:744: Unable to connect to dbus server at 'unix:path=/run/user/1000
/pulse/dbus-socket': Could not connect: No such file or directory
blueman-applet 15.31.12 WARNING  PluginManager:147 __load_plugin: Not loading DhcpClient because its conflict has higher priority
blueman-applet 15.31.12 WARNING  PluginManager:147 __load_plugin: Not loading PPPSupport because its conflict has higher priority

(mate-settings-daemon:1701): Gtk-WARNING **: 15:31:12.508: gtk_widget_size_allocate(): attempt to allocate widget with width -1 and height 28

** (mate-screensaver:1754): WARNING **: 15:31:13.992: Screensaver already running in this session
INFO:root:The HUD is disabled via org.mate.hud in gsettings.
RuntimeError: object at 0x7fedf7823440 of type RenameMenu is not initialized
RuntimeError: object at 0x7fedf7d31d00 of type FolderColorMenu is not initialized
blueman-applet 15.31.17 WARNING  DiscvManager:109 update_menuitems: warning: Adapter is None
JavaScript error: resource:///modules/AddrBookCard.jsm, line 197: NS_ERROR_NOT_AVAILABLE: PreferDisplayName: undefined - not a boolean
Window manager warning: Log level 16: Visible region is null
Window manager warning: Log level 16: Visible region is null
Window manager warning: Log level 16: Visible region is null
Traceback (most recent call last):
  File "/usr/share/caja-python/extensions/dejadup.py", line 156, in get_file_items
    include_paths = self.dejadup.get_dejadup_paths('include-list')
  File "/usr/share/caja-python/extensions/dejadup.py", line 70, in get_dejadup_paths
    paths = ast.literal_eval([stdout][0]) # Convert shell dump to list
  File "/usr/lib/python3.8/ast.py", line 99, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python3.8/ast.py", line 98, in _convert
    return _convert_signed_num(node)
  File "/usr/lib/python3.8/ast.py", line 75, in _convert_signed_num
    return _convert_num(node)
  File "/usr/lib/python3.8/ast.py", line 66, in _convert_num
    _raise_malformed_node(node)
  File "/usr/lib/python3.8/ast.py", line 63, in _raise_malformed_node
    raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: b"['$HOME']\n"
...(snip)...   (multiple repeats of the "Traceback" report)

我不知道如何将其转化为纠正措施。

另外,有什么方法可以指定“多用户目标“在尝试其他目标之前必须先达到第一个目标”图形目标”,或者是否存在我不知道的依赖关系,这使得它成为不可能的先决条件?

答案1

克里斯蒂安·罗德里格斯 (Cristian Rodriguez) 的评论,使用

systemctl edit lightdm.service

加上

[Unit]
RequiresMountsFor=/DB001_F2

作为自定义本地先决条件lightdm服务单位可能提供解决方案防止重蹈覆辙遇到的问题。为此,谢谢克里斯蒂安。

额外的步骤要让 GUI 环境指向各种组件的正确位置,包括正确显示 ${HOME}/Desktop,请按照以下位置的指南进行操作:https://forums.linuxmint.com/viewtopic.php?t=222560 这给出了编辑文件的方向“${HOME}/.config/user-dirs.dirs" 通过替换字符串

XDG_DESKTOP_DIR="$HOME/"

经过

XDG_DESKTOP_DIR="$HOME/Desktop" .

进行更正后,关闭所有其他应用程序后,我运行了命令

systemctl restart lightdm.service

这本质上与注销然后登录执行相同的操作。

之后,会话管理器使用正确的位置按预期显示 ${HOME}/Desktop 内容。

答案2

lightdm.service 需要 RequiresMountsFor=/DB001_F2

相关内容