LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 06-22-2023, 09:02 PM   #1
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 496

Rep: Reputation: 182Reputation: 182
Race condition sshd and networking KUbuntu 22.04 LTS


Appears that either a race condition going on or sshd (ssh server)is getting started before networking is enabled. I assigned sshd in the config to bind to a specific IP addr (manual server IP) as I have two network cards and only want one to get sshd traffic. But when I boot, sshd crashes with no IP found. Yet if I login and then from the command line restart sshd it works fine, so I know I setup config correctly.

For now I just removed that IP binding in the config file, to allow it to work through a reboot and all is well. I run headless and hate to hook up a monitor and keyboard to restart. Also I unplug the other cable from the card that connects to the internet, so ssh is not a security hole from the internet except for a short period of time when I plug in and get a distro update.

Anyway, just a informational post and if someone may have an idea what I could do about it.

Last edited by rclark; 06-23-2023 at 11:37 AM.
 
Old 06-23-2023, 05:10 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
I guess you need to start the whole thing after the network is up. So you need to configure sshd.service to wait for network-online.target. https://www.freedesktop.org/wiki/Sof...NetworkTarget/
 
Old 06-23-2023, 01:38 PM   #3
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 496

Original Poster
Rep: Reputation: 182Reputation: 182
Thanks for the link. You'd think that would be the 'default' for the sshd service as you should always wait for the network to be initialized first before setting up your service... Or visa versa, the proper way, the network hardware setup should be one of the first things to get initialized immediately after boot before anything else starts running (just like memory, disks, video card if present). Seems logical to me.

Also I wonder why one has to even install sshd in the first place as Linux is multi-user by default and one should be able to reach the machine by ssh from any other machine in the network. Ie. ssh/sshd should be available from the first time you install the OS.

Last edited by rclark; 06-24-2023 at 01:05 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible race condition between HID-USB and i8042 Brad.Scalio@noaa.gov Linux - Kernel 2 02-11-2009 04:25 AM
Starting sshd: /etc/init.d/sshd: line 113: /usr/sbin/sshd: Permission denied sumanc Linux - Server 5 03-28-2008 04:59 AM
race condition in close socket?? jwstric2 Programming 3 03-18-2005 05:01 PM
Kernel race condition exploit solution jlangelier Slackware 12 01-14-2005 10:15 AM
P-thread+race condition+mutex+Peterson's algorithm bangla_linux Programming 3 10-29-2003 03:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 12:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration