All of lore.kernel.org
 help / color / mirror / Atom feed
* Issue with Installing openssh Package  #kirkstone #systemd #yocto
@ 2024-04-17 11:56 Nitesh D
  2024-04-17 12:01 ` [yocto] " Alexander Kanavin
  0 siblings, 1 reply; 6+ messages in thread
From: Nitesh D @ 2024-04-17 11:56 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

Hello All,

This is my first time posting in the Yocto forum, so please bear with me (I'm a rookie).

One of my projects requires "openssh" to be installed in the image, but with all services disabled except for keeping sshdgenkeys.service running. I split it into two packages, but for some odd reason, "sshdgenkeys.service" is not getting installed on the image.

Here's my .bbappend file for openssh:

```
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"

SYSTEMD_AUTO_ENABLE:${PN}-sshd = "disable"

PACKAGES =+ "${PN}-sshdgenkeys"
SYSTEMD_PACKAGES = "${PN}-sshdgenkeys"
SYSTEMD_SERVICE:${PN}-sshdgenkeys = "sshdgenkeys.service"
SYSTEMD_AUTO_ENABLE:${PN}-sshdgenkeys = "enable"

SRC_URI:append = " \
file://sshd_config \
"

do_install:append () {
install -d ${D}${sysconfdir}/ssh
install -m 0644 ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/
install -m 0644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
}

FILES:${PN}-sshd = " \
${sbindir}/sshd ${sysconfdir}/init.d/sshd \
${systemd_system_unitdir}/sshd.socket \
${systemd_system_unitdir}/sshd@.service \
"
FILES:${PN}-sshdgenkeys = " \
${systemd_system_unitdir}/sshdgenkeys.service \
"
```
When I flash the image on my device, only the "${PN}-sshd" package is getting installed, and not "${PN}-sshdgenkeys".

I would appreciate a second pair of eyes on what I might be missing here.

Thanking you in advance.

Cheers,
Nitesh

[-- Attachment #2: Type: text/html, Size: 2580 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] Issue with Installing openssh Package #kirkstone #systemd #yocto
  2024-04-17 11:56 Issue with Installing openssh Package #kirkstone #systemd #yocto Nitesh D
@ 2024-04-17 12:01 ` Alexander Kanavin
  2024-04-17 12:21   ` [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone Nitesh D
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2024-04-17 12:01 UTC (permalink / raw)
  To: yocto, ndivecha

openssh recipe (or its appends) does not control what gets installed
into the image, only how openssh gets split into packages. To see what
gets installed you need to find the image recipe and modify that as
appropriate.

Alex

On Wed, 17 Apr 2024 at 13:56, Nitesh D via lists.yoctoproject.org
<ndivecha=granitenet.com@lists.yoctoproject.org> wrote:
>
> Hello All,
>
> This is my first time posting in the Yocto forum, so please bear with me (I'm a rookie).
>
> One of my projects requires "openssh" to be installed in the image, but with all services disabled except for keeping sshdgenkeys.service running. I split it into two packages, but for some odd reason, "sshdgenkeys.service" is not getting installed on the image.
>
> Here's my .bbappend file for openssh:
>
> ```
> FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
>
> SYSTEMD_AUTO_ENABLE:${PN}-sshd = "disable"
>
> PACKAGES =+ "${PN}-sshdgenkeys"
> SYSTEMD_PACKAGES = "${PN}-sshdgenkeys"
> SYSTEMD_SERVICE:${PN}-sshdgenkeys = "sshdgenkeys.service"
> SYSTEMD_AUTO_ENABLE:${PN}-sshdgenkeys = "enable"
>
> SRC_URI:append = " \
> file://sshd_config \
> "
>
> do_install:append () {
>     install -d ${D}${sysconfdir}/ssh
>     install -m 0644 ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/
>     install -m 0644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
> }
>
> FILES:${PN}-sshd = " \
> ${sbindir}/sshd ${sysconfdir}/init.d/sshd \
> ${systemd_system_unitdir}/sshd.socket \
> ${systemd_system_unitdir}/sshd@.service \
> "
> FILES:${PN}-sshdgenkeys = " \
> ${systemd_system_unitdir}/sshdgenkeys.service \
> "
> ```
> When I flash the image on my device, only the "${PN}-sshd" package is getting installed, and not "${PN}-sshdgenkeys".
>
> I would appreciate a second pair of eyes on what I might be missing here.
>
> Thanking you in advance.
>
> Cheers,
> Nitesh
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#62946): https://lists.yoctoproject.org/g/yocto/message/62946
> Mute This Topic: https://lists.yoctoproject.org/mt/105575419/1686489
> Mute #systemd:https://lists.yoctoproject.org/g/yocto/mutehashtag/systemd
> Mute #yocto:https://lists.yoctoproject.org/g/yocto/mutehashtag/yocto
> Mute #kirkstone:https://lists.yoctoproject.org/g/yocto/mutehashtag/kirkstone
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone
  2024-04-17 12:01 ` [yocto] " Alexander Kanavin
@ 2024-04-17 12:21   ` Nitesh D
  2024-04-17 12:25     ` Marko, Peter
  0 siblings, 1 reply; 6+ messages in thread
From: Nitesh D @ 2024-04-17 12:21 UTC (permalink / raw)
  To: Alexander Kanavin, yocto

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Alex,

Thanks for your prompt response.

Shouldn't "PACKAGES =+ "${PN}-sshdgenkeys"" take care of installing it on the image? Meaning my image recipe picks up everything from the packagegroup, which includes "openssh".

Part of the package is getting installed. When I flash the image on my device, only the "${PN}-sshd" package is getting installed, and not "${PN}-sshdgenkeys".

[-- Attachment #2: Type: text/html, Size: 526 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone
  2024-04-17 12:21   ` [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone Nitesh D
@ 2024-04-17 12:25     ` Marko, Peter
  2024-04-17 14:01       ` Nitesh D
  0 siblings, 1 reply; 6+ messages in thread
From: Marko, Peter @ 2024-04-17 12:25 UTC (permalink / raw)
  To: yocto, ndivecha, Alexander Kanavin

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]


From: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org> On Behalf Of Nitesh D via lists.yoctoproject.org
Sent: Wednesday, April 17, 2024 14:21
To: Alexander Kanavin <alex.kanavin@gmail.com>; yocto@lists.yoctoproject.org
Subject: Re: [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone

> Alex,
>
> Thanks for your prompt response.
>
> Shouldn't "PACKAGES =+ "${PN}-sshdgenkeys"" take care of installing it on the image? Meaning my image recipe picks up everything from the packagegroup, which includes "openssh".

“PACKAGES +=” only splits the files into additional package. New packages are not installed by default.
You need to install it via IMAGE_INSTALL (in image) or RDEPENDS/RRECOMMENDS (in recipe for package which is being installed already).

>
> Part of the package is getting installed. When I flash the image on my device, only the "${PN}-sshd" package is getting installed, and not "${PN}-sshdgenkeys".

[-- Attachment #2: Type: text/html, Size: 3149 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone
  2024-04-17 12:25     ` Marko, Peter
@ 2024-04-17 14:01       ` Nitesh D
  2024-04-17 15:03         ` Nitesh D
  0 siblings, 1 reply; 6+ messages in thread
From: Nitesh D @ 2024-04-17 14:01 UTC (permalink / raw)
  To: Peter Marko, yocto

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

Peter,

Ah ha! that jogged my memory... Even though openssh is in the IMAGE_INSTALL group I still need to add "openssh-sshdgenkeys" since I'm splitting the openssh package.

After adding "openssh-sshdgenkeys" into my image recipe service was installed as expected but it is not getting enabled, even though I explicitly specified to enable. Maybe I'm misunderstanding here...

SYSTEMD_AUTO_ENABLE:${PN}-sshdgenkeys = "enable"

For testing purposes, I started it manually:

root@localhost:~# systemctl status sshdgenkeys.service
* sshdgenkeys.service - OpenSSH Key Generation
Loaded: loaded (/lib/systemd/system/sshdgenkeys.service; static)
Active: inactive (dead)
root@localhost:~# systemctl start sshdgenkeys.service
root@localhost:~# systemctl status sshdgenkeys.service
* sshdgenkeys.service - OpenSSH Key Generation
Loaded: loaded (/lib/systemd/system/sshdgenkeys.service; static)
Active: active (exited) since Wed 2024-04-17 13:47:27 UTC; 2s ago
Process: 640 ExecStart=/usr/libexec/openssh/sshd_check_keys (code=exited, status=0/SUCCESS)
Main PID: 640 (code=exited, status=0/SUCCESS)

Apr 17 13:47:24 localhost systemd[1]: Starting OpenSSH Key Generation...
Apr 17 13:47:26 localhost sshd_check_keys[646]: unknown option -- G
Apr 17 13:47:26 localhost sshd_check_keys[646]: OpenSSH_8.9p1, OpenSSL 3.0.8 7 Feb 2023
Apr 17 13:47:26 localhost sshd_check_keys[646]: usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
Apr 17 13:47:26 localhost sshd_check_keys[646]:             [-E log_file] [-f config_file] [-g login_grace_time]
Apr 17 13:47:26 localhost sshd_check_keys[646]:             [-h host_key_file] [-o option] [-p port] [-u len]
Apr 17 13:47:27 localhost systemd[1]: Finished OpenSSH Key Generation.
root@localhost:~#

The output shows that the service is loaded but inactive. When I start it manually, it becomes active, but I encounter a strange error: "unknown option -- G." It seems like the version of sshd_check_keys script being used is newer and expects "sshd -G," whereas my .bbappend file is for version 8.9p1.

I'm not sure why this discrepancy is occurring. Any thoughts?

Cheers,
Nitesh

[-- Attachment #2: Type: text/html, Size: 2744 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone
  2024-04-17 14:01       ` Nitesh D
@ 2024-04-17 15:03         ` Nitesh D
  0 siblings, 0 replies; 6+ messages in thread
From: Nitesh D @ 2024-04-17 15:03 UTC (permalink / raw)
  To: Nitesh D, yocto

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Peter,

So I did little clean up and fixed the error: "unknown option -- G.", so that is taken care.

Now the only issue is getting this service "sshdgenkeys.service" enabled by default.

Just to recap, I have "openssh-sshd" disable by default and "openssh-sshdgenkeys" enable:

SYSTEMD_AUTO_ENABLE:${PN}-sshd = "disable"
SYSTEMD_AUTO_ENABLE:${PN}-sshdgenkeys = "enable"

But it looks like it is getting override and disable.

Thoughts?

[-- Attachment #2: Type: text/html, Size: 584 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-17 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 11:56 Issue with Installing openssh Package #kirkstone #systemd #yocto Nitesh D
2024-04-17 12:01 ` [yocto] " Alexander Kanavin
2024-04-17 12:21   ` [yocto] Issue with Installing openssh Package #systemd #yocto #kirkstone Nitesh D
2024-04-17 12:25     ` Marko, Peter
2024-04-17 14:01       ` Nitesh D
2024-04-17 15:03         ` Nitesh D

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.