# autoyast SSH at first boot ( before stage 2 )

**URL:** <https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046>\
**Category:** SLES Install-Boot\
**Created:** [November 25, 2016, 4:34pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046 "2016-11-25T16:34:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iqtcub](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@iqtcub](https://forums.suse.com/u/iqtcub)\
**Post date:** [November 25, 2016, 4:34pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/1 "2016-11-25T16:34:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [November 25, 2016, 5:09pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/2 "2016-11-25T17:09:24Z")

</div>

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

```auto
/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](https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html)

---

<div class="post-metadata">

**Author:** ![iqtcub](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@iqtcub](https://forums.suse.com/u/iqtcub)\
**Post date:** [November 28, 2016, 1:54pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/3 "2016-11-28T13:54:18Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [November 28, 2016, 3:07pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/4 "2016-11-28T15:07:33Z")

</div>

> [@](#):
>
> On Mon 28 Nov 2016 12:04:02 PM CST, iqtcub wrote:
> 
> 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:
> 
> ## Code:
> 
> cat /etc/YaST2/ProductFeatures | grep ssh  
> enable\_sshd = “yes”  
> firewall\_enable\_ssh = “yes”
> 
> * * *
> 
> ## But the SSH service was not running. Executing Code:
> 
> ## 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;

```auto
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](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!

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [November 29, 2016, 6:31am UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/5 "2016-11-29T06:31:34Z")

</div>

> [@](#):
>
> On Mon 28 Nov 2016 01:07:33 PM CST, malcolmlewis wrote:
> 
> > [@](#):
> >
> > On Mon 28 Nov 2016 12:04:02 PM CST, iqtcub wrote:
> > 
> > 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:
> > 
> > ## Code:
> > 
> > cat /etc/YaST2/ProductFeatures | grep ssh  
> > enable\_sshd = “yes”  
> > firewall\_enable\_ssh = “yes”
> > 
> > * * *
> > 
> > ## But the SSH service was not running. Executing Code:
> > 
> > ## 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](https://www.freedesktop.org/software/systemd/man/systemd.preset.html)

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

```auto
/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!

---

<div class="post-metadata">

**Author:** ![iqtcub](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@iqtcub](https://forums.suse.com/u/iqtcub)\
**Post date:** [November 30, 2016, 12:56pm UTC](https://forums.suse.com/t/autoyast-ssh-at-first-boot-before-stage-2/29046/6 "2016-11-30T12:56:39Z")

</div>

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:

> [@](#):
>
> systemctl status sshd  
> sshd.service - OpenSSH Daemon  
> Loaded: loaded ( /usr/lib/systemd/system/sshd.service; disabled)  
> Active: inactive (dead)

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)

> [@](#):
>
> #!/bin/bash  
> chroot /mnt /bin/bash -c " systemctl enable sshd.service; systemctl start sshd.service"

In our autoinst.xml file:

> [@](#):
>

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