Skip to content

[RFC]add automatic support to armbian-firstlogin#6194

Merged
igorpecovnik merged 4 commits intoarmbian:mainfrom
amazingfate:auto-firstlogin
Mar 3, 2024
Merged

[RFC]add automatic support to armbian-firstlogin#6194
igorpecovnik merged 4 commits intoarmbian:mainfrom
amazingfate:auto-firstlogin

Conversation

@amazingfate
Copy link
Contributor

@amazingfate amazingfate commented Jan 23, 2024

Description

Add preset variables so that image can do first login automaticly without user interaction.
I store variables like username/password in /root/.not_logged_in_yet so that it will get deleted after firstlogin.
We can enable setting of these variables by extension preset-firstrun in board config:

enable_extension "preset-firstrun"

Network preconfig from armbian-firstrun-config are also moved here.
Edit extensions/preset-firstrun.sh to set detail variables.

AR-2297

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Build command ./compile.sh BOARD=fl700n BRANCH=edge DEB_COMPRESS=xz KERNEL_GIT=shallow BUILD_DESKTOP=yes BUILD_MINIMAL=no KERNEL_CONFIGURE=no RELEASE=bookworm DESKTOP_ENVIRONMENT=xfce DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base DESKTOP_APPGROUPS_SELECTED=''
  • Boot image with or without ethernet network, board boots into xfce desktop environment without user interaction
  • Haven't tested on board with wireless. I haven't implement automatic Connect via wireless? [Y/n]. I will do it later. Tested on orangepi 3b with wireless. ./compile.sh BOARD=orangepi3b BRANCH=edge DEB_COMPRESS=xz KERNEL_GIT=shallow BUILD_DESKTOP=yes BUILD_MINIMAL=no KERNEL_CONFIGURE=no RELEASE=bookworm DESKTOP_ENVIRONMENT=xfce DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base DESKTOP_APPGROUPS_SELECTED=''

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@amazingfate amazingfate requested a review from a team as a code owner January 23, 2024 16:24
@github-actions github-actions bot added the size/medium PR with more then 50 and less then 250 lines label Jan 23, 2024
@amazingfate amazingfate marked this pull request as draft January 23, 2024 16:24
@lanefu
Copy link
Member

lanefu commented Jan 23, 2024

Not quite the same but many of those configuration values can be set through other config vars as well.

https://github.com/lanefu/armbian-userpatches-example-indiedroid-nova/blob/a42f7b71d111e52d797a892f3807fefd6acd3ab3/config-opinionated.conf#L9-L25

I believe root password can be set via declare -g ROOTPWD=

Barbaric example of removing firstrun

Example of pre-installing ssh key

@amazingfate
Copy link
Contributor Author

Not quite the same but many of those configuration values can be set through other config vars as well.

https://github.com/lanefu/armbian-userpatches-example-indiedroid-nova/blob/a42f7b71d111e52d797a892f3807fefd6acd3ab3/config-opinionated.conf#L9-L25

I believe root password can be set via declare -g ROOTPWD=

These configs are set at build time, I think armbian-fisrtlogin will still do the user/password creation process.

Barbaric example of removing firstrun

This just disable the firstrun service. I want to run firstrun service with preconfig so people don't have to connect a keyboard to do some manual operations. I like the process of firstrun service, so my code are integreted in its script.

@amazingfate
Copy link
Contributor Author

Add variable PRESET_CONNECT_WIRELESS to skip connecting wireless.

In manual root password creation process, script will kill other logged in sessions after root password is typed. But this kill action will exit the automatic script. So in automatic process, if PRESET_ROOT_PASSWORD is set, script will exit if it is not running in tty1. So automatic firstlogin script will only run in tty1.

@amazingfate amazingfate marked this pull request as ready for review January 25, 2024 07:56
@igorpecovnik
Copy link
Member

If this is being reworked ... one additional idea.

/boot/armbian_first_run.txt.template and all this mechanism hasn't been touched for past 8 years. It was more or less merged by mistake and left there to rot.

However 1st run predefined wireless / network connect seems to be useful and I would say we extend this PR to include this functionality and remove:
packages/bsp/common/usr/lib/armbian/armbian-firstrun-config
packages/bsp/common/lib/systemd/system/armbian-firstrun-config.service
packages/bsp/armbian_first_run.txt.template

What do you think?

@amazingfate
Copy link
Contributor Author

I haven't tried the old armbian-firstrun-config service to preconfig ethernet/wireless networks. I guess it will run before the firstlogin script. I will test the old service to see if it works.
PRESET_CONNECT_WIRELESS in this PR only works when there is a wireless device and the board is not connected to internet. So if the old armbian-firstrun-config service works before the service in this PR, we can keep it.

@igorpecovnik
Copy link
Member

service works before the service in this PR, we can keep it.

It feels we have some redundancy.

I want to get rid of it and have wireless setup also a part of your config. Does it makes sense?

@amazingfate
Copy link
Contributor Author

Let me try it.

@amazingfate amazingfate marked this pull request as draft January 25, 2024 15:26
@igorpecovnik
Copy link
Member

If you have time to complete and test this within a week, we can merge it into 02 ...

@amazingfate
Copy link
Contributor Author

I come back to my hometown with no board to test and will be back to my boards at 18th, Feb. But I can do some coding these days and test it when I can reach my boards.

@igorpecovnik igorpecovnik added the 05 Milestone: Second quarter release label Feb 10, 2024
@igorpecovnik
Copy link
Member

Thanks. No problem, we will merge this after release then.

@github-actions github-actions bot added size/large PR with 250 lines or more Framework Framework components and removed size/medium PR with more then 50 and less then 250 lines labels Feb 21, 2024
@amazingfate
Copy link
Contributor Author

FR_* network configs are moved from armbian-firstrun-config and armbian-firstrun-config related files are deleted.
Add an extension preset_firstrun to do these preconfig. Just add one line enable_extension "preset-firstrun" to apply it.

@amazingfate amazingfate marked this pull request as ready for review February 21, 2024 12:55
@igorpecovnik igorpecovnik added Breaking change Can potentially break core functionality Needs review Seeking for review Needs Documentation New feature needs documentation entry labels Feb 25, 2024
@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Mar 3, 2024
@amazingfate
Copy link
Contributor Author

Thanks Igor, I didn't have time to change and test.

@igorpecovnik
Copy link
Member

Thanks Igor, I didn't have time to change and test.

I know ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Breaking change Can potentially break core functionality Framework Framework components Needs Documentation New feature needs documentation entry Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

3 participants