fairyglade / ly

display manager with console UI
Do What The F*ck You Want To Public License
5.33k stars 306 forks source link

Config being ignored #646

Closed ColetteDiskette closed 1 month ago

ColetteDiskette commented 2 months ago

I just upgraded to 1.0.0-2 (was pre 1.0 prior) before a restart and now my config file seems to be ignored. Notably for me, the CMatrix animation doesn't play, I don't have the big clock, and passwords don't clear on failed attempts. I checked my /etc/ly/config.ini and it all still seems to be properly set.

I'm on Arch Linux, and ly is installed via its extra repo.

de-mirage2 commented 2 months ago

I also have this issue, rolling back to v0.6.0 seems to fix on Arch Linux

Scary-Guy commented 2 months ago

I can confirm this as well, though I'm running the ly command directly from /etc/ly restarting may make it work but I feel like it should work this way as well for testing. Ninjedit: I restarted just to make sure and it doesn't work the normal way either.

I had to completely redo the file with the config from config.ini.old (not replacing, just copying over individual settings I wanted. Do not replace!)

Checking the file permissions Root should have all the appropriate permissions (because, root) but also it had execute permission off while the backup had it on. Changing that had no effect.

This is version 1.0, upgraded from 0.6

moabeat-berlin commented 2 months ago

I had the exact same issue. Same parameters here:

In the end, I found out, it was my 'asterisk' setting in the config.ini. I had it set to '#', because I liked it better. Unfortunately this seems to cause an error in the parsing of the config file, not reporting any error anywhere.

Further testing turned out, the ini parser treats every '#' as an indicator for a comment for the remainder of the line. For other parameters than 'asterisk' this seems to be fine. But if 'asterisk' is empty, the whole config file is ignored.

ColetteDiskette commented 2 months ago

EDIT: It's now solved for me. Here's the original comment followed by my new edit addendum.

ORIGINAL MESSAGE: After reading that, I uncommented the asterisk = * line in my config and fully restarted my computer. My config is still being ignored. Here is my config, for reference:

# Animation enabled/disabled
animate = true 

# The active animation
# 0 -> PSX DOOM fire (default)
# 1 -> CMatrix 
animation = 1

# format string for clock in top right corner (see strftime specification)
#clock = %I:%M %p

# enable/disable big clock
bigclock = true

# The character used to mask the password
asterisk = *

# Erase password input on failure
blank_password = true

#The `fg` and `bg` color settings take a digit 0-8 corresponding to:
#define TB_DEFAULT 0x00
#define TB_BLACK   0x01
#define TB_RED     0x02
#define TB_GREEN   0x03
#define TB_YELLOW  0x04
#define TB_BLUE    0x05
#define TB_MAGENTA 0x06
#define TB_CYAN    0x07
#define TB_WHITE   0x08
#
# Setting both to zero makes `bg` black and `fg` white. To set the actual color palette you are encouraged to use another tool 
# such as [mkinitcpio-colors](https://github.com/evanpurkhiser/mkinitcpio-colors). Note that the color palette defined with 
# `mkinitcpio-colors` takes 16 colors (0-15), only values 0-8 are valid for `ly` config and these values do not correspond 
# exactly. For instance, in defining palettes with `mkinitcpio-colors` the order is black, dark red, dark green, brown, dark 
# blue, dark purple, dark cyan, light gray, dark gray, bright red, bright green, yellow, bright blue, bright purple, bright 
# cyan, and white, indexed in that order 0 through 15. For example, the color defined for white (indexed at 15 in the mkinitcpio 
# config) will be used by `ly` for `fg = 8`.

# Background color id
#bg = 0

# Foreground color id
#fg = 9

# Blank main box background
# Setting to false will make it transparent
#blank_box = true

# Remove main box borders
#hide_borders = false

# Main box margins
#margin_box_h = 2
#margin_box_v = 1

# Input boxes length
#input_len = 34

# Max input sizes
#max_desktop_len = 100
#max_login_len = 255
#max_password_len = 255

# Input box active by default on startup
#default_input = 2

# Load the saved desktop and username
#load = true

# Save the current desktop and login as defaults
#save = true

# File in which to save and load the default desktop and login
#save_file = /etc/ly/save

# Remove F1/F2 command hints
#hide_f1_commands = false

# Command executed when pressing F1
#shutdown_cmd = /sbin/shutdown -a now

# Command executed when pressing F2
#restart_cmd = /sbin/shutdown -r now

# Active language
# Available languages are found in /etc/ly/lang/
#lang = en

# tty in use
#tty = 2

# Console path
#console_dev = /dev/console

# Default path
#path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin

# Event timeout in milliseconds
#min_refresh_delta = 5

# Service name (set to ly to use the provided pam config file)
#service_name = ly

# Terminal reset command (tput is faster)
#term_reset_cmd = /usr/bin/tput reset

# Cookie generator
#mcookie_cmd = /usr/bin/mcookie

# Wayland setup command
#wayland_cmd = /etc/ly/wsetup.sh

# Add wayland specifier to session names
#wayland_specifier = false

# Wayland desktop environments
#waylandsessions = /usr/share/wayland-sessions

# xinitrc
#xinitrc = ~/.xinitrc

# Xorg server command
#x_cmd = /usr/bin/X

# Xorg setup command
#x_cmd_setup = /etc/ly/xsetup.sh

# Xorg xauthority edition tool
#xauth_cmd = /usr/bin/xauth

# Xorg desktop environments
#xsessions = /usr/share/xsessions

EDIT: Okay, I solved it on my end. I found the config.ini in this git and realized the one I had was way different. Now my config looks like this and it's just fine:

# The active animation
# none   -> Nothing (default)
# doom   -> PSX DOOM fire
# matrix -> CMatrix
animation = matrix 

# Format string for clock in top right corner (see strftime specification). Example: %c
clock = null

# Enable/disable big clock
bigclock = true 

# The character used to mask the password
asterisk = *

# Erase password input on failure
clear_password = true 

# Enable vi keybindings
vi_mode = false

# The `fg` and `bg` color settings take a digit 0-8 corresponding to:
#define TB_DEFAULT 0x00
#define TB_BLACK   0x01
#define TB_RED     0x02
#define TB_GREEN   0x03
#define TB_YELLOW  0x04
#define TB_BLUE    0x05
#define TB_MAGENTA 0x06
#define TB_CYAN    0x07
#define TB_WHITE   0x08
#
# Setting both to zero makes `bg` black and `fg` white. To set the actual color palette you are encouraged to use another tool 
# such as [mkinitcpio-colors](https://github.com/evanpurkhiser/mkinitcpio-colors). Note that the color palette defined with 
# `mkinitcpio-colors` takes 16 colors (0-15), only values 0-8 are valid for `ly` config and these values do not correspond 
# exactly. For instance, in defining palettes with `mkinitcpio-colors` the order is black, dark red, dark green, brown, dark 
# blue, dark purple, dark cyan, light gray, dark gray, bright red, bright green, yellow, bright blue, bright purple, bright 
# cyan, and white, indexed in that order 0 through 15. For example, the color defined for white (indexed at 15 in the mkinitcpio 
# config) will be used by `ly` for `fg = 8`.

# Background color id
bg = 0

# Foreground color id
fg = 8

# CMatrix animation foreground color id
cmatrix_fg = 3

# Border color
border_fg = 8

# Title to show at the top of the main box
box_title = null

# Initial text to show on the info line (Defaults to hostname)
initial_info_text = null

# Blank main box background
# Setting to false will make it transparent
blank_box = true

# Remove main box borders
hide_borders = false

# Main box margins
margin_box_h = 2
margin_box_v = 1

# Input boxes length
input_len = 34

# Max input sizes
max_desktop_len = 100
max_login_len = 255
max_password_len = 255

# Input box active by default on startup
# Available inputs: session, login, password
default_input = login

# Load the saved desktop and username
load = true

# Save the current desktop and login as defaults
save = true

# Deprecated - Will be removed in a future version
# New save files are now loaded from the same directory as the config
# Currently used to migrate old save files to the new version
# File in which to save and load the default desktop and login
save_file = /etc/ly/save

# Remove power management command hints
hide_key_hints = false

# Specifies the key used for shutdown (F1-F12)
shutdown_key = F1

# Specifies the key used for restart (F1-F12)
restart_key = F2

# Specifies the key used for sleep (F1-F12)
sleep_key = F3

# Command executed when pressing shutdown_key
shutdown_cmd = /sbin/shutdown -a now

# Command executed when pressing restart_key
restart_cmd = /sbin/shutdown -r now

# Command executed when pressing sleep key (can be null)
sleep_cmd = null

# Active language
# Available languages are found in /etc/ly/lang/
lang = en

# TTY in use
tty = 2

# Console path
console_dev = /dev/console

# Default path. If null, ly doesn't set a path.
path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin

# Event timeout in milliseconds
min_refresh_delta = 5

# Set numlock on/off at startup
numlock = false

# Service name (set to ly to use the provided pam config file)
service_name = ly

# Terminal reset command (tput is faster)
term_reset_cmd = /usr/bin/tput reset

# Terminal restore cursor command
term_restore_cursor_cmd = /usr/bin/tput cnorm

# Cookie generator
mcookie_cmd = /usr/bin/mcookie

# Wayland setup command
wayland_cmd = /etc/ly/wsetup.sh

# Wayland desktop environments
waylandsessions = /usr/share/wayland-sessions

# xinitrc (hidden if null)
xinitrc = ~/.xinitrc

# Xorg server command
x_cmd = /usr/bin/X

# Xorg setup command
x_cmd_setup = /etc/ly/xsetup.sh

# Xorg xauthority edition tool
xauth_cmd = /usr/bin/xauth

# Xorg desktop environments
xsessions = /usr/share/xsessions

# Brightness control
brightness_down_key = F5
brightness_up_key = F6
brightness_change = 10

I feel silly now, but I'm glad to know it's working for me either way.

AnErrupTion commented 2 months ago

Hey! Sorry I didn't have the time to investigate this, but it looks like you guys have been faster than me on this 😅

Further testing turned out, the ini parser treats every '#' as an indicator for a comment for the remainder of the line. For other parameters than 'asterisk' this seems to be fine. But if 'asterisk' is empty, the whole config file is ignored.

This is most likely a bug with https://github.com/ziglibs/ini, the underlying ini parser used by https://github.com/Kawaii-Ash/zigini, the ini library used by Ly. I'll try to reproduce the aforementioned bugs and file issues for them ASAP.

I found the config.ini in this git and realized the one I had was way different. Now my config looks like this and it's just fine

The reason this happens is because the config field mapper is incomplete and doesn't map all fields (like animation) from the old configuration file. I honestly have no idea how this flew over our heads completely, but it did. Also, the migrator only attempts to migrate the saved username & session file, but not the actual configuration file, resulting in the mess that occured here. Again, we completely forgot about this, and I'm actually surprised it worked this well until now. 👀

moabeat-berlin commented 2 months ago

I think it would have been much easier to find the issue, if error messages would have been popping up. I saw in some instances, it overwrites the info_line. Not in the case when there is an issue with the config file. Also, if there are multiple errors, they are also overwriting each other in the info_line.

I came up with #661 that would display all of them in the lower left corner, one per line. What do you think?

AnErrupTion commented 1 month ago

This issue is now fixed. To use an asterisk with the character #, you can simply escape it like this:

asterisk = \#

The config migrator is also more powerful and it handles all changed fields from v0.6.0 easily.