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

RFC: fix #6686: Debian: enable ssh.service and make it work reliably on armbian-firstrun #6687

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

alexl83
Copy link
Contributor

@alexl83 alexl83 commented Jun 2, 2024

Description

ssh.service activation fails on first boot due to a race condition with armbian-firstrun (missing host keys at ssh.service startup)

By changing armbian-firstrun.service to run After=ssh.service SBC is always reachable reliably via ssh, even on first run, so that it can be configured headlessly by remote login

It also reverts commit IDs: #911c756083164c32051d533ca3f2de488f202130 and #30c47f6f6cebd75f5c28866918fea093b8c82b44 disabling ssh.socket - this fixes SSH Deamon behavious to honour ListenAddress directive when set via sshd_config

Jira reference number [AR-2356]

How Has This Been Tested?

  • Compiled and first-run vanilla armbian Bookworm-Edge
  • Compiled and first-run vanilla Armbian Trixie-Edge
  • Simulated additional first-run(s) via systemd enable armbian-firstrun.service and touch /root/.not_logged_in_yet(Bookworm-Edge && Trixie-Edge)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

@alexl83 alexl83 requested a review from a team as a code owner June 2, 2024 15:45
@github-actions github-actions bot added the size/small PR with less then 50 lines label Jun 2, 2024
@alexl83 alexl83 changed the title RFC: Debian: set ssh.service enabled and make it work reliably on armbian-firstrun RFC: fix #6686: Debian: set ssh.service enabled and make it work reliably on armbian-firstrun Jun 2, 2024
@alexl83 alexl83 changed the title RFC: fix #6686: Debian: set ssh.service enabled and make it work reliably on armbian-firstrun RFC: fix #6686: Debian: enable ssh.service and make it work reliably on armbian-firstrun Jun 2, 2024
@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge 08 Milestone: Third quarter release labels Jun 3, 2024
Copy link
Member

@igorpecovnik igorpecovnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@igorpecovnik igorpecovnik merged commit bb5fd2a into armbian:main Jun 5, 2024
7 checks passed
igorpecovnik pushed a commit that referenced this pull request Jun 9, 2024
…on armbian-firstrun (#6687)

* Revert commits 911c756 and 30c47f6

* tweak armbian-firstrun.service to run after ssh.service (for host keys generation purposes)
@alexl83 alexl83 deleted the fix_ssh_thing branch June 14, 2024 19:38
@EvilOlaf
Copy link
Member

Is this still being worked on?
I noticed ssh fail to start at boot with a vendor Bookworm CLI image built from yesterday on a Radxa Zero 3E.
I'll try to extract more debug info once I found an USB-C to A adapter so I can connect a keyboard to.

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 25, 2024

Is this still being worked on? I noticed ssh fail to start at boot with a vendor Bookworm CLI image built from yesterday on a Radxa Zero 3E. I'll try to extract more debug info once I found an USB-C to A adapter so I can connect a keyboard to.

Is this still being worked on? I noticed ssh fail to start at boot with a vendor Bookworm CLI image built from yesterday on a Radxa Zero 3E. I'll try to extract more debug info once I found an USB-C to A adapter so I can connect a keyboard to.

Hi @EvilOlaf I tested a couple weeks ago a vanilla Bookworm image and couldn't reproduce; let me test again and get back to you :)

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 25, 2024

I'm running a bookworm-vendor image built from trunk a couole hrs ago - orangepi5-plus
ssh starting at each boot, cable connected to eth0 - now going through armbian-firstrun and cannot see any network issue

Tomorrow I'll try the same config on my nanopi-r5c - will report any issue

Should you be able to pull some log data, it could be helpful in pinpointing root cause

@ColorfulRhino
Copy link
Collaborator

This PR: #3774 wants to run armbian-firstrun before ssh.service 🤔 (including some other ssh changes)

Which is better? 😄

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 25, 2024

This PR: #3774 wants to run armbian-firstrun before ssh.service 🤔 (including some other ssh changes)

Which is better? 😄

Can't say, but if it's more complete/compatible we should consider it
It seems to take for granted some network stuff like systemd-resolved, perhaps it might need some tweaking to adapt it to new logic (systemd-network for minimal cli - networkmanager for the rest)
I only have a nanopi and a a bunch of orangepis, so my fix could not be as universal as I think(/want)

@ColorfulRhino
Copy link
Collaborator

ColorfulRhino commented Jun 25, 2024

It seems to take for granted some network stuff like systemd-resolved, perhaps it might need some tweaking to adapt it to new logic (systemd-network for minimal cli - networkmanager for the rest)

No no, disregard everything that is not ssh related 😄 The other stuff in this PR is unrelated.

I have just discovered that linked PR and am trying to see if some of the stuff is beneficial.

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 25, 2024

Can't say to be honest: what I understood experimentally is that a few weeks ago ssh on boot (Trixie) was failing 30%-60% of the times - when armbian-firstrun was started before it - no issue on bookworm

When this issue appeared, trixie ssh init file changed in order to pull nss-user-lookup.target in After statement. literally only difference I could find.
I tested both firstrun specifically set as Before ssh and achieved consistent 100% start failure of ssh, then any issue disappeared (in my case) when ordered firstrun service start After ssh.service

Reproduced same results on bookworm - trixie - and called it a day - pushing this PR - current vs edge kernels made no difference (ubuntu manages sshd with a socket strategy - different than debian)

At the time I only tested on orangepi5-plus, orangepizero3 and orangepizero2w

@ColorfulRhino
Copy link
Collaborator

I haven't run into any issues so far, but I'll test 👍

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 25, 2024

I haven't run into any issues so far, but I'll test 👍

Great, thanks - perhaps the key might be related to some specific boards tweaks

@EvilOlaf
Copy link
Member

Alright. Finally got there.

tl;dr: never mind
Everything works as expected. Was an issue on my part. Apologies for confusion.

@alexl83
Copy link
Contributor Author

alexl83 commented Jun 26, 2024

Alright. Finally got there.

tl;dr: never mind Everything works as expected. Was an issue on my part. Apologies for confusion.

No biggie Werner, it's been better to double check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
08 Milestone: Third quarter release Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines
Development

Successfully merging this pull request may close these issues.

4 participants