Enable SSH & Systemctl application in the Passive partition

Hi,

I have successfully completed full system update .
But in the active partition ssh is enabled,but before update it is not unable in Partition B.
Also there are some systemctl app running which should be present in both the Partition.
After the Successful system update it also start on boot up.
Any reference or suggestion how to achieve this.

Thanks & Regards
Arun

1 Like

Hi Arun,

Not totally clear on what you wish to achieve, but running systemctl enable just creates symlinks from service units to particular locations on the file system. One option could be as part of the update to mount partition B and create the required symlinks as you see fit. But it really depends on your requirements.

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

Hi Dellgreen,

Thanks For the Reply ,Actually my device is at other location and i am taking SSH ,after system update SSH is disabled so i have manually go to device location and again enable SSh .
i just want that that SSH will be enable in Partion A and after Update in Partion B also.
Thanks
Arun

Is this a yocto based operating system?

Hi
Its a Raspbian buster lite with integrated mender.

Thanks
Arun

ok so it sounds like you are creating the image manually and then using mender-convert tools to integrate mender?

I am using the image which is available in mender website for getting started.
https://docs.mender.io/hosted/get-started/preparation/prepare-a-raspberry-pi-device

Ah i see, i assume you have you tried the methods outlined in the following link to permanently enable ssh in the pi?

https://www.raspberrypi.org/documentation/remote-access/ssh/README.md

Yes i have done the same steps mentioned in the link but it only works for active Partition.

Thanks
Arun

I think this is a symptom that the raspberry pi example your link points to seems to be for demonstration purposes (albeit Iā€™m not familiar with this way of doing mender updates). Normally you use some kind of build process/pipeline/tools that creates the rootfs how you want it and then gets converted/created to the final mender A/B partition layout with the exact same contents in A/B. (i.e yocto, golden image->mender-convert, mkosi->mender-convert), plus mender-artifact created at the same time.

You could add a custom systemd service to your pi image, that runs a script to check the inactive partition and mounts and creates the missing ssh systemd symlink if its absent. Then follow the mender artifact instructions to create a new update from your running pi, upload and deploy.

Hi @arun

As @dellgreen says this image is really for testing and demo purposes. You should consider developing your own custom Golden Master image of Raspbian with SSH and other services you want enabled. Then if you use mender-convert on that image you should have what you need.

That said, specifically for the ssh service, you can use the RaspberryPi OS support for headless configuration to force ssh to be enabled. See section 3 here.

However, due to the reworking of the partitions that has happened with the Mender-enabled images, instead of creating the 0-byte file named ssh in the boot partition you need to ensure that that file exists in the /boot directory of the rootfs image in the Mender artifact. You can use mender-artifact cp to modify the artifact and add that particular file.

Drew

Hi @drewmoseley,
Thanks for quick response. so as suggested i am trying to put image in the mender convert but still not clear with RaspberryPi OS support for headless configuration to force ssh to be enabled in the mender convert and also some other required bash files.
Thanks
Arun

There are two methods that will work. The first is the link I posted above but that is limited to just enabling serial, ssh and wifi.

The best method is to simply deploy the RaspberryPi OS image, before using mender-convert, enabling ssh with raspi-config and setting up any other files you may need. Then use dd to take an image of the updated SDCard and use that as input to mender-convert. This is the standard mechanism of using a Golden Master image with Mender.

Some related links that may help clarify:

Drew