Howto remove syslog completely from a yocto image based on systemd - yocto

I want to generate a Yocto image that uses systemd as the unique service to control my system logs. So I just want to use journalctl tool and don't want any reference to syslog at all.
To setup a systemd image I have setup my distro as this (as explained in the Yocto documentation):
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_dev_manager = "systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""
However, the built image adds a rpm package called sysklogd, and the generated image runs some syslog related systemctl services:
- syslogd.service
- syslog.socket
I would like to generate and image with no reference to syslog at all. What should be the proper way to manage this issue?
Thank you in advance! :)

Add
VIRTUAL-RUNTIME_syslog = ""
in a .bb or .bbapend file. This will remove sysklogd package.
Refer file /meta/recipes-extended/packagegroups/packagegroup-core-full-cmdline.bb where it is defined as
VIRTUAL-RUNTIME_syslog ?= "sysklogd"

Finally I fixed my issue. First of all I removed "busybox" from my custom image following the information explained in this link:
Removing busybox completely from a Yocto generated image
After removing busybox, defining this variable (as suggested on previous answers) worked as expected:
VIRTUAL-RUNTIME_syslog = ""
Now the generated image doesn't contain any reference to syslog nor sysklogd. Thank you so much for all your support!! :-)

Related

How do I mask serail-getty#ttyAMA0 service in yocto

I am trying to mask the serial-getty#ttyAMA0 service from within a Recipe.
How Can I achieve this?
I tried creating a initscripts bbappend file with this addition as shown below
pkg_postinst_${PN}{
systemctl mask serial-getty#ttyAMA0.service
}
But this gives me an error. Could not invoke Dnf
I have run out of Ideas
Correct solution is to control SERIAL_CONSOLES variable in local.conf. systemd-serialgetty parses it and creates corresponding systemd service files. Simple
SERIAL_CONSOLES = ""
can do the trick for you.

varnish / docker-compose custom port and cache size

I'm trying to figure out how to pass custom port and cache size and vcl file in docker-compose.yml to varnish (I'm using the official varnish image https://hub.docker.com/_/varnish )
I Tried using environment variables by adding the following lines into my docker-compose.yml but it seems that they are not taken into consideration
environment:
- VARNISH_CONFIG="/etc/varnish/custom.vcl"
- CACHE_SIZE=512m
- VARNISH_PORT=8080
Any clue on how to pass these params to a varnish container ?
In case some one needs to achieve the same config, I ended up by creating a new image based on the official one and adding these params to the CMD instruction :
EXPOSE **8080**
CMD ["varnishd", "-F", "-f", "**/etc/varnish/custom.vcl**", "-s", "**malloc,2G**"]
The official Varnish Docker image is quite basic at this point. As you concluded in your second post, you can use our the image as the basis, and then customize the behavior in your own Dockerfile.
However, for Varnish Software, it's an iterative process, so we'll gradually add features to the image. In the end, you'll be able to configure most parameters through environment variables in your docker-compose.yml file.
We're working on it, thanks for your patience.

Zookeeper ignores JVMFLAGS?

Hi I setup my zookeeper cluster and it seems to be running fine. But I'm trying to setup the heap size and it doesn't seem to be respected. I created the java.env with export JVMFLAGS="-Xms3000m -Xmx3000m" file inside conf/...
When I ps -aux | grep java I can see -Xmx1000m -Xms3000m -Xmx3000m. But when I check with free -m I only see 200M used and 3.3G free.
I noticed that the default value is set regardless. Does this affects it?
Shouldn't Xms fill up the used RAM?
The file zkEnv.sh contains the following line:
export SERVER_JVMFLAGS="-Xmx${ZK_SERVER_HEAP}m $SERVER_JVMFLAGS"
and the "-Xmx${ZK_SERVER_HEAP}m" caused the trouble.
This is what finally worked for me.
In the conf/java.env
export SERVER_JVMFLAGS="-Xms6144m -Xmx6144m -XX:+AlwaysPreTouch"
If you are using /usr/bin/zookeeper-server-start from the confluent-kafka-* package, you might need to set KAFKA_HEAP_OPTS inside your systemd unit file.
Environment="KAFKA_HEAP_OPTS=-Xmx1024M -Xms1024M"

Disable a standard systemd service in Yocto build

I need to start my own systemd service, let's call it custom.service. I know how to write a recipe for it to be added and enabled on boot:
SYSTEMD_SERVICE_${PN} = "custom.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
However, it conflicts with one of the default systemd services - systemd-timesyncd.service.
Is there a nice preferred way to disable that default systemd service in my bitbake file even though the systemd_XX.bb actually enables it?
I can create a systemd_%.bbappend file to modify the systemd settings, but I can't locate the place where one service can be disabled leaving all others enabled.
The working solution I found is to remove the timesyncd altogether using
PACKAGECONFIG_remove = "timesyncd"
But I wonder if this is a appropriate way and if there is a way to just disable it, but leave in the system.
How about adding a .bbappend recipe for the conflicting service you want disabled. In it, you would add:
SYSTEMD_AUTO_ENABLE_${PN} = "disable"
If the system runs fine with the other package removed, then removing the package is a preferred solution. Fewer packages means a simpler system.
Usually you would set SYSTEMD_AUTO_ENABLE_${PN} = "disable" and that would let the service be part of image but disabled on boot. However for systemd which provides a lot of default service units this may not be a solution you might want to deploy. You could surgically delete the symlink in etc which will ensure that service is not started automatically on boot but the .service file is still part of image. So add following to systemd_%.bbappend file in your layer
do_install_append() {
rm -rf ${D}${sysconfdir}/systemd/system/sysinit.target.wants/systemd-timesyncd.service
}
There are other ways to disable this e.g. using systemd presets as described here
Use the systemd.preset — Service enablement presets and in particular following steps.
Create a .bbappend file meta-xxx/recipes-core/systemd/systemd_%.bbappend with this content:
do_configure_append() {
#disabling autostart of systemd-timesyncd
sed -i -e "s/enable systemd-timesyncd.service/disable systemd-timesyncd.service/g" ${S}/presets/90-systemd.preset
}
In my yocto-based Linux distribution (yocto zeus release) above steps are enough to disable the service which remains installed.
In the output distribution previous steps modify the file /lib/systemd/system-preset/90-systemd.preset.
After the modification, in that file, appear the row: disable systemd-timesyncd.service and this row substitutes the raw: enable systemd-timesyncd.service
At this link there are some information about the topic: systemd.preset — Service enablement presets.
Other useful.
I was not able to use SYSTEMD_AUTO_ENABLE_${PN} = "disable" in this context.
For other recipes (for example dnsmasq_2.82.bb) the previous assignment works correctly and I have used it to enable (or disable) a service in the yocto distribution.
I think the "official" way to do this is to have something like this somewhere in your project:
PACKAGECONFIG_append_pn-systemd = "--disable-timesyncd"
This does basically the same you already suggested. To simply not enable the service you have to do it manually since you can modify the auto enable only per recipe.

Unable to use automatic PR service

I've been trying to use bitbake PR service. I've followed the instructions in https://wiki.yoctoproject.org/wiki/PR_Service and added these lines to my local.conf file:
PRSERV_HOST = "localhost:0"
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"
I expected that PR values of my recipies will be incrementing automatically after each change, but they are still the same
Setting PRSERV_HOST is all you need, and it works for me. It turns PR=r1 into r1.1, r1.2, r1.3 on each build. If that isn't working, what version of oe-core are you using?
In addition to the versioning server being enabled you also need to make sure your .bb's are using the auto rev:
PV = "1.0.0.0+git${SRCPV}"
and they pulling from some source
SRC_URI = "git:/my_repo/program.git"