[!CAUTION]
This article is based on my own environment and notes.
I cannot take responsibility for any problems caused by following this article.
Please make a backup and make sure you can recover from a TTY before changing your display manager.
注意:
- 以下の記事を参考にされ、問題が生じた場合、責任は負えません。
- 基本的には私の忘備録です。
- 使用環境は Manjaro Linuxです。
- 本文を英語で記載してますが、中学生レベルですので、容易に理解できると思います。
- link先に了解なく引用している部分がありますので、問題があればご連絡ください。
前置き
この長期休暇中に、HyprlandをNvidiaのGPUを搭載したManjaro Linixにinstallしました。
GPUを利用しているため、大変苦労しました。
Hyprland+GPUの課題
- GUIを利用したDisplay Manager(lightDMなど)は上手く機能せず、loginできない。またはloginしても問題が発生する。
- 設定が複雑。
- Hyprlandは開発が活発で、設定が頻繁に変わる。
特にDisplay Managerが難問です。
Display Managerへの対策
GUIのDisplay Managerをやめて、CUIからloginするか、
どうしても必要ならtuigreet (TUI の greeter)にするのが、確実です。
今回はtuigreetを利用した場合を説明します。万一、tuigreetが駄目な場合、CUI-login(例えば、Ctrl + Alt + F3)後に、Hyprlalndを起動するのが確実です。
私はこれに気づかず、SDDMなどを検討して、半日ほど無駄にしました。
お気をつけください。
HyprlandとDisplay Managerについては、別途どこか説明する予定。
次のような強者もいるようですが、危険な気がします(苦笑)。
個人的には、自動ログインにgreetdを使って、ログイン画面はHyprlockにしてるよ。
My Environment
OS : Manjaro Linux
GPU : NVIDIA RTX 3060
Kernel : linux66
NVIDIA : 595.71.05
Hyprland : 0.54.3
Login : greetd + tuigreet
Terminal : kitty, xfce4-terminal, etc
Bar : waybar
Background
During a long holiday, I installed Hyprland on a Manjaro Linux machine with an NVIDIA GPU.
It worked in the end, but the setup was more difficult than I expected.
The hardest part was the Display manager.
In my environment, GUI Display managers such as SDDM and LightDM caused problems:
- black screen after login
- failed login
- unstable Hyprland session
- display-related issues after starting Hyprland
So I decided to stop using a GUI Display manager, and use greetd + tuigreet instead.
If tuigreet still does not work, the safest fallback is to log in from a normal TTY and start Hyprland manually ; start-hyprland
This article explains the greetd + tuigreet setup.
1. Install Hyprland and related packages
1-1. Enable NVIDIA DRM modeset
This is important for Hyprland on NVIDIA.
meaning of Enable NVIDIA DRM modeset
For Wayland compositors such as Hyprland, NVIDIA DRM kernel mode setting is important.
Here, DRM means "Direct Rendering Manager" in the Linux kernel. It allows the Linux kernel and Wayland compositor to manage display outputs, resolution, refresh rate, rendering buffers, and monitor configuration through the NVIDIA driver.
Wayland compositors(Hyprland etc) manage display output more directly than X11.
Therefore, if NVIDIA DRM modeset is disabled, Hyprland may fail to start correctly,
show a black screen, detect monitors incorrectly, or have issues with multi-monitor setups.
Check the current setting:
cat /sys/module/nvidia_drm/parameters/modeset
If the output is:
Y
you can continue to the next step.
If the output is:
N
enable NVIDIA DRM modeset:
echo 'options nvidia_drm modeset=1' | sudo tee /etc/modprobe.d/nvidia.conf
sudo mkinitcpio -P
sudo update-grub
sudo reboot
After rebooting, check again:
cat /sys/module/nvidia_drm/parameters/modeset
1-2. Install packages
sudo pacman -S \
hyprland \
hyprutils \
hyprlang \
aquamarine \
xdg-desktop-portal-hyprland \
xorg-xwayland \
egl-wayland \
qt5-wayland \
qt6-wayland \
waybar \
kitty
qt5-wayland may not be necessary in all environments, but I installed it for compatibility.
If you want to show a background image, install swaybg:
sudo pacman -S swaybg
2. Use "greetd + greetd-tuigreet" instead of a GUI Display manager
In my environment, greetd + tuigreet works for Hyprnald, but SDDM and LightDM can not work.
- greetd is a lightweight and flexible Display manager.
- greetd-tuigreet is a CUI-greeter, not using GUI.
It works well with Wayland compositors because it does not assume a specific desktop environment.
2-1. Install "greetd and tuigreet"
sudo pacman -S greetd greetd-tuigreet
2-2. Confirm the Hyprland start command
Recent Hyprland packages provide start-hyprland.
Confirm that the command exists on your system.
command -v start-hyprland
/usr/bin/start-hyprland
If you want to check the available options:
start-hyprland -- -h
2-3. Configure greetd
Edit the greetd configuration:
sudo vim /etc/greetd/config.toml
Example:
[terminal]
vt = 2
[default_session]
command = "tuigreet --time --remember --remember-session --sessions /usr/share/wayland-sessions:/usr/share/xsessions --cmd start-hyprland"
user = "greeter"
2-4. Confirm the greeter user
getent passwd greeter
If nothing is shown, create the user:
sudo useradd -r -M -s /usr/bin/nologin greeter
2-5. Stop SDDM / LightDM
Disable GUI Display managers before enabling greetd.
sudo systemctl disable sddm
sudo systemctl disable lightdm
sudo systemctl stop sddm 2>/dev/null
sudo systemctl stop lightdm 2>/dev/null
2-6. Enable greetd
sudo systemctl enable greetd
sudo reboot
2-7. Confirm the greetd services
systemctl status greetd --no-pager -l
systemctl is-enabled sddm lightdm greetd 2>/dev/null
sddm disabled
lightdm disabled
greetd enabled
2-8. Recovery method if login fails
Before rebooting, make sure you know how to recover.
If greetd or Hyprland does not start correctly, back to GUI Display manager.
1. Press `Ctrl + Alt + F3` or another function key to open a TTY.
2. Log in from the console.
3. Disable greetd.
4. Re-enable your previous Display manager if necessary.
Example:
sudo systemctl disable --now greetd
# If you want to return to LightDM
sudo systemctl enable --now lightdm
# Or, if you want to return to SDDM
sudo systemctl enable --now sddm
3. Create a Hyprland session file for tuigreet
This may not be necessary, Hyprland PKG gives this file.
Create a Wayland session file:
sudo vim /usr/share/wayland-sessions/hyprland-start.desktop
[Desktop Entry]
Name=Hyprland start-hyprland
Comment=Hyprland via start-hyprland
Exec=/usr/bin/start-hyprland
Type=Application
DesktopNames=Hyprland
After this, you should be able to select this session from tuigreet. (use F3 key)
4. Configure Hyprland for NVIDIA
4-1. Confirm the NVIDIA GPU device
ls -l /dev/dri/by-path/
Example:
pci-0000:01:00.0-card -> ../card1
pci-0000:01:00.0-render -> ../renderD128
In this example, the NVIDIA card is /dev/dri/card1.
Add this to ~/.config/hypr/hyprland.conf:
env = AQ_DRM_DEVICES,/dev/dri/card1
[!NOTE]
The card number may be different on your machine.
Do not copy/dev/dri/card1blindly. Check your own environment first.
4-2. Monitor setting
Check your monitor name:
hyprctl monitors
Example:
HDMI-A-1
1920x1080@60
Fixed monitor setting:
monitor = HDMI-A-1,1920x1080@60,0x0,1
Or use automatic selection:
monitor = ,preferred,auto,1
4-3. Keyboard setting
I use a US 101 keyboard.
If you use jp keyboard, kb_layout = jp.
input {
kb_layout = us ## blank is enable.
kb_options = ctrl:nocaps
follow_mouse = 1
}
ctrl:nocaps makes the Caps Lock key work as Ctrl.
5. Minimal sample hyprland.conf
vim ~/.config/hypr/hyprland.conf
Example:
# ----- NVIDIA / Wayland ----------------------
env = AQ_DRM_DEVICES,/dev/dri/card1
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = ELECTRON_OZONE_PLATFORM_HINT,auto
# ----- Disable blur --------------------------
decoration {
blur {
enabled = false
}
}
# ----- Monitor -------------------------------
# Fixed monitor example:
# monitor = HDMI-A-1,1920x1080@60,0x0,1
# Automatic selection:
monitor = ,preferred,auto,1
# ----- Keyboard and mouse --------------------
input {
kb_layout = us
kb_options = ctrl:nocaps
follow_mouse = 1
}
# ----- IME / Mozc / fcitx5 -------------------
env = INPUT_METHOD,fcitx
env = GTK_IM_MODULE,fcitx
env = QT_IM_MODULE,fcitx
env = XMODIFIERS,@im=fcitx
env = SDL_IM_MODULE,fcitx
exec-once = fcitx5 -r -d
# ----- Key bindings --------------------------
bind = SUPER, Return, exec, kitty
bind = SUPER, Q, killactive
bind = SUPER, M, exit
bind = CTRL_ALT, Delete, exit
# Start terminal automatically
exec-once = kitty
6. Show background images with swaybg
6-1. Use a single image
Add this to ~/.config/hypr/hyprland.conf:
exec-once = swaybg --output '*' --mode fill --image ~/.config/hypr/wallpapers/wallpaper.jpg
6-2. Change the wallpaper every 15 minutes
Create a script directory:
mkdir -p ~/.config/hypr/scripts
Create the script:
vim ~/.config/hypr/scripts/change_wallpaper_15min.sh
#!/usr/bin/env bash
WALL_DIR="$HOME/.config/hypr/wallpapers"
INTERVAL=900
while true; do
img="$(find "$WALL_DIR" -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | shuf -n 1)"
if [ -n "$img" ]; then
pkill swaybg 2>/dev/null
swaybg --output '*' --mode fill --image "$img" &
fi
sleep "$INTERVAL"
done
Make it executable:
chmod +x ~/.config/hypr/scripts/change_wallpaper_15min.sh
Add it to hyprland.conf:
exec-once = ~/.config/hypr/scripts/change_wallpaper_15min.sh
7. Summary
For my Manjaro + NVIDIA + Hyprland environment, the most important points were:
- Enable NVIDIA DRM modeset.
- Avoid GUI Display managers if they cause problems.
- Use
greetd + tuigreetfor a simple and stable login flow. - Use the
start-hyprlandcommand provided by the Hyprland package. - Check your own
/dev/dri/cardXbefore settingAQ_DRM_DEVICES. - Prepare a TTY recovery method before rebooting.
Hyprland changes quickly, and NVIDIA-related behavior may also change depending on the driver version.
So please check the official Hyprland Wiki and Arch Wiki when you install or update your system.
References
-
Hyprland Wiki - NVIDIA
https://wiki.hypr.land/Nvidia/ -
Hyprland Arch wiki
https://wiki.archlinux.jp/index.php/NVIDIA -
ArchWiki JP - greetd
https://wiki.archlinux.jp/index.php/Greetd -
tuigreet - git
https://github.com/apognu/tuigreet -
【tuigreet】テキストベースのディスプレイマネージャがかなり快適だった
https://watasuke.net/blog/article/fastest-dm-tuigreet/ -
Manjaro / NVIDIA / Hyprland installation note ; some exmple
https://zenn.dev/wggsh/scraps/f99e4786594fde -
ArchLinuxにHyprlandを入れる.
https://qiita.com/McbeEringi/items/23a2f254728f655f9f29 -
dotfiles example :多量のRAMを使用するようなので、参考程度にしましょう。
https://github.com/mylinuxforwork/dotfiles