autoyast SSH at first boot ( before stage 2 )

Hi all!

We are testing autoyast feature to ‘clone’ one of our servers with a SLES12 sp1 that has SSH as a service and it si automatically started when booting the system. We created the autoinst.xml from executing yast2 clone_system from the original server and then configured our TFTP server to use this file to install other servers. At this point, we manage to finish the stage 1 of the automated installation by autoyast rebooting the system to continue the configuration with the stage 2.

The main problem we are currently facing is that the system booted does not have the SSH service enabled nor running, so we can’t continue the installation/configuration of the system remotely by executing yast.ssh. We would like to know if this can’t be changed (nor SSH service possible after stage 1) or if it may be because of an error in our autoinst.xml

This is what we have in autoinst.xml related to services-manager:

multi-user 10gb btrfsmaintenance-refresh cron dm-event getty@tty1 glusterfs-client haveged irqbalance iscsi kdump postfix purge-kernels rollback rsyslog smartd [B]sshd[/B] sssd systemd-readahead-collect systemd-readahead-replay wicked wickedd-auto4 wickedd-dhcp4 wickedd-dhcp6 wickedd-nanny YaST2-Firstboot YaST2-Second-Stage

Does some of you manage to get the SSH service enabled after the first installation with autoyast? If we connect locally to the installed machine we can check that the open-ssh packages are installed, but checking the service with systemctl status sshd returns it is disabled.

Hi
What about in /etc/YaST2/ control.xml and ProductFeatures files and the sshd settings?

/etc/YaST2/ProductFeatures:	enable_sshd = "yes"
/etc/YaST2/control.xml:        <enable_sshd config:type="boolean">true</enable_sshd>

Is the firewall disabled?

Refs: https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html

Hi malcolmlewis!

After the installation, the firewall is disabled, so we think it shouldn’t affect the SSH service. Anyway we have modified the control.xml of the installation image in order to have:
<enable_sshd config:type=“boolean”>true</enable_sshd>

After a new installation we have this configuration in ProductFeatures:

cat /etc/YaST2/ProductFeatures | grep ssh
	enable_sshd = "yes"
	firewall_enable_ssh = "yes"

But the SSH service was not running. Executing yast service-manager showed that the SSH service was enabled but inactive (dead). Is there any other place where we could force SSH service to be started automatically after stage 1 of the autoyast installation? A post script does not help, as it is executed at the end of the stage 2.

Hi
So it must be the systemd preset and need to override the vendor preset;

systemctl status sshd
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)

https://www.freedesktop.org/software/systemd/man/systemd.preset.html


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.34-33-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Hi
Here is the file containing SLE defaults from package
systemd-presets-branding-SLE;

/usr/lib/systemd/system-preset/90-default-SLE.preset


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.34-33-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Hi,

As you pointed, the file 90-default-SLE.preset does not contain “enable sshd.service” and apparently Suse seems to have all services disabled except for those in this file.

We then created a chroot-script for autoyast (it is executed after the installation and before the first boot) and modified this file to add an extra line with “enable sshd.service” at the end of it. The script was executed correctly but the ssh service was still disabled at first boot:

It seems that modifying this file before the first boot is not enough, so we’ve tried something different now that we know how chroot-scripts work. We force a chroot after the first installation and before the first boot to manually enable and start the sshd service with the systemctl command. This has worked!!

We copy here our files, just in case someone else needed this too.

Our chroot-script (enablessh.sh)

In our autoinst.xml file:

Thanks malcolmlewis! We can now start an automatic installation of all our servers completly remote. :slight_smile: