Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dietpi-config resets chosen user for autostart login #3242

Closed
zedrdave opened this issue Nov 27, 2019 · 3 comments
Closed

dietpi-config resets chosen user for autostart login #3242

zedrdave opened this issue Nov 27, 2019 · 3 comments
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Milestone

Comments

@zedrdave
Copy link

Creating a bug report/issue

Required Information

Additional Information (if applicable)

When choosing an autostart option with auto-login (eg Desktop with auto-login), there is an option to choose a non-root user (thanks to the feature brought by this PR: #2926).

Things work as expected when rebooting, but the setting seems to be reset (to the same autostart option, but with root instead of the preferred user) when dietpi-config is run again.

Steps to reproduce

  1. open dietpi-config
  2. browse menu to 9 - autostart options
  3. select an auto-login option (eg 2: desktop with autologin)
  4. on next screen pick a user other than root (eg 1000: dietpi)
  5. apply, exit and reboot
  6. [dietpi autologs the correct user: dietpi]
  7. open dietpi-config/dietpi-software and change other unrelated settings/install other software
  8. reboot

Expected behaviour

dietpi should keep autologging the chosen user (dietpi)

Actual behaviour

Choice of autolog user gets reset and dietpi starts with chosen autostart (eg desktop) but under user root instead of dietpi

@MichaIng
Copy link
Owner

@zedrdave
Many thanks for your report. I'll have a look into the code, but actually the related setting should be touched by the dietpi-autostart script only, nothing else 🤔.

@zedrdave
Copy link
Author

Yes, I did a quick scan of the code and couldn't figure out how that happened.
The bug definitely happens (had to switch back user at least 4-5 times in the course of tweaking my install), but it is possible that it requires some specific installs/config to take place. I will try and get a perfectly reduced case.

@MichaIng
Copy link
Owner

MichaIng commented Nov 30, 2019

@zedrdave
Found it. Indeed we did not store the chosen user to dietpi.txt, only apply it to the getty drop-in config. When any other script calls dietpi-autostart <int>, the drop-in config is removed and recreated based on dietpi.txt entry, non-interactively.
DietPi-Software calls this at the end of all installs: https://github.com/MichaIng/DietPi/blob/master/dietpi/dietpi-software#L14562-L14565
Actually there is not much reason to do that, especially since it is called interactively already when choosing any software title that has an autostart option: https://github.com/MichaIng/DietPi/blob/master/dietpi/dietpi-software#L15294

DietPi-Config btw never calls the script non-interactively, hence it should not reset the choice, but regardless updating the dietpi.txt entry simply makes sense 😉.

Fix is: eb72356
This is the line that you can manually add to your /DietPi/dietpi/dietpi-autostart script, everything else is minor coding:

G_CONFIG_INJECT 'AUTO_SETUP_AUTOSTART_LOGIN_USER=' "AUTO_SETUP_AUTOSTART_LOGIN_USER=$user" /DietPi/dietpi.txt

Changelog: 8a53deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants