[yocto] Fwd: With my layer, Systemd not invoking my application at startup
Hi All, I have created a layer (my first layer) and have build it with WindRiver media which uses Systemd for the startup services. As per my application need, I have to create a new user on the final image and change the owner permissions of certain files to the new user. Since I could not get it done on the build machine, I have written the post install script such that it gets executed on the target board during the 1st boot cycle and from within the post install script I am creating the new user and changing the file ownership. And this works. But the only problem I have now is that, even though I register my service with Systemd at pre-install (or postinstall) section (using the systemctl enable command) my service is not getting launched by Systemd during the 1st boot. On subsequent reboots, it invokes my service at boot up. As part of debugging I just modified my postinstall script, such that it gets executed on the board (i.e without the exit 1) and not executed on the 1st boot. After that I see that systemd invokes my service at boot up. So I wonder if Systemd ignores the services for which post-install is not invoked at build machine ? Now I am confused on how to solve this problem. Only 2 approaches comes to my mind : 1) Run the postinstall on the board only (not on 1st boot) - But with this (i.e running the postinstall section on board) I don't see the new user creation happening and as a result it fails to change the file ownership. 2) Somehow force systemd to invoke my service at startup (even with postinstall running during 1st boot) - But I don't know what I have to do to achieve this. Here is the brief of my recipe file : --- +++ DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" do_install() { #if systemd configured install -m 0755 -d ${D}/lib/systemd/system cp ${WORKDIR}/${MA_BIN_DIR}/my_ser.service ${D}/lib/systemd/system/ } pkg_preinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable my_ser.service# Have tried executing it only on postinstall, but it does not help. fi } pkg_postinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable ma.service fi if [ x"$D" = "x" ] ; then # Create group and user groupadd test_grp useradd -r -s /sbin/nologin -g test_grp test_usr chown test_usr:test_grp /etc/test_folder/* if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then if [ "$1" == 1 ] || [ "$1" = 2 ] ; then # only install and upgrade scenario, not to exeute on 1st boot systemctl daemon-reload systemctl start my_ser.service fi else exit 1 fi } My service unit file (used by systemd) : [Unit] Description=McAfee Agent (masvc) [Service] Type=forking ExecStartPre=-/bin/mkdir -p /var/tmp/test_config ExecStartPre=-/bin/chmod 777 /var/tmp/test_config ExecStartPre=-/bin/chmod o+t /var/tmp/test_config ExecStart=/opt/test_app start ExecStop=/opt/test_app stop Type=forking TimeoutStartSec=20 SendSIGKILL=no [Install] WantedBy=multi-user.target I am new to the yacto project and the layer approach. So kindly guide me on how to resolve this issue. Also if this is not the right group to get help on this issue, please suggest about the relevant group. Thanks Vipin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Fwd: With my layer, Systemd not invoking my application at startup
Thanks a lot Saul for your valuable inputs on my problem. I have tried inheriting from the useradd.bbclass and the USER add works with both approach i.e by inheriting from useradd.bb class or manually calling useradd. But my main problem 'wherein the systemd does not invoke my service during first boot ' is not getting resolved. I have to run the pkg_posinst on the board, for the following two reasons : I have to change the file ownership to the newly created user. If I try to do this on board, it fails - I have to run some configuration scripts,which is required for my service to startup. But this configuration script needs to be run only once per installation, and so I don't want to put is in the systemd unitfile. Here is the brief of my recipe file( sorry, but I can not share the whole recipe file) -- DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" do_install() { #if systemd configured install -m 0755 -d ${D}/lib/systemd/system cp ${WORKDIR}/${MA_BIN_DIR}/my_ser.service ${D}/lib/systemd/system/ } pkg_preinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable my_ser.service# Have tried executing it only on postinstall, but it does not help. fi } pkg_postinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable ma.service fi if [ x"$D" = "x" ] ; then # Create group and user groupadd test_grp useradd -r -s /sbin/nologin -g test_grp test_usr chown test_usr:test_grp /etc/test_folder/* if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then if [ "$1" == 1 ] || [ "$1" = 2 ] ; then # only install and upgrade scenario, not to exeute on 1st boot systemctl daemon-reload systemctl start my_ser.service fi else exit 1 fi } And here is the Unit file for my service : --- [Unit] Description=test service [Service] Type=forking ExecStartPre=-/bin/mkdir -p /var/tmp/test_config_file ExecStartPre=-/bin/chmod 777 /var/tmp/test_config_file ExecStartPre=-/bin/chmod o+t /var/tmp/test_config_file ExecStart=/opt/test_app start ExecStop=/opt/test_app stop Type=forking TimeoutStartSec=20 SendSIGKILL=no [Install] WantedBy=multi-user.target Thanks Vipin On Wed, Jul 1, 2015 at 10:14 PM, Saul Wold wrote: > On 06/30/2015 08:35 PM, Vipin Nair wrote: > >> Hi All, >> >> I have created a layer (my first layer) and have build it with WindRiver >> media which uses Systemd for the startup services. >> >> As per my application need, I have to create a new user on the final image >> and change the owner permissions of certain files to the new user. >> Since I could not get it done on the build machine, I have written the >> post >> install script such that it gets executed on the target board during the >> 1st boot cycle >> and from within the post install script I am creating the new user and >> changing the file ownership. And this works. >> >> But the only problem I have now is that, even though I register my service >> with Systemd at pre-install (or postinstall) section (using the systemctl >> enable command) >> my service is not getting launched by Systemd during the 1st boot. On >> subsequent reboots, it invokes my service at boot up. >> >> As part of debugging I just modified my postinstall script, such that it >> gets executed on the board (i.e without the exit 1) and not executed on >> the 1st boot. After that I see that >> systemd invokes my service at boot up. So I wonder if Systemd ignores the >> services for which post-install is not invoked at build machine ? >> >> Now I am confused on how to solve this problem. >> >> Only 2 approaches comes to my mind : >> 1) Run the postinstall on the board only (not on 1st boot) - But with >> this >> (i.e running the postinstall section on board) I don't see the new user >> creation happening and as a result it fails to change the file ownership. >> >> 2) Somehow force systemd to invoke my service at startup (even with >> postinstall running during 1st boot) - But I don't know what I have to do >> to achieve this. >> >> Here is the brief of my recipe file : >> --- >> >> DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', >> 'systemd-systemctl-native', '', d)}" >> >> >> do_install() { >> >> >> #if systemd configured >> install -m 0755 -d ${D}/lib/systemd/system >> cp ${WORKDIR}/${MA_BIN_DIR}/my_ser.service ${D}/lib/systemd/system/ >> >> >> } >> >> pkg_preinst_${PN}() { >> >> >> >> if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then >> systemctl --root=$D enable my_ser.service# Have tried executing it >> only >> on postinst
[yocto] Unset a variable
I'd like to make a distro config file, derived from conf/distro/poky.conf. But in my case, DISTRO_CODENAME is not really something that can contain a meaningful value, so I'd like to unset it. How can I unset the variable? (This affects the format of VERSION in /etc/os-release. I guess alternatively I could modify it in a os-release.bbappend) -- Craig McQueen -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [PATCH] views.py: Fix current up to date percentage
From: Mariano Lopez There was an issue where the current up to date was always using the latest upstream version to get the percentage. This uses the upstream version in the period displayed. Signed-off-by: Mariano Lopez --- rrs/models.py | 5 + rrs/views.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rrs/models.py b/rrs/models.py index f0d4ed3..d0e88b9 100644 --- a/rrs/models.py +++ b/rrs/models.py @@ -272,6 +272,11 @@ class RecipeUpstream(models.Model): date = models.DateTimeField(db_index=True) @staticmethod +def get_all_recipes(history): +qry = RecipeUpstream.objects.filter(history = history) +return qry + +@staticmethod def get_recipes_not_updated(history): qry = RecipeUpstream.objects.filter(history = history, status = 'N', no_update_reason = '').order_by('pn') diff --git a/rrs/views.py b/rrs/views.py index 4a1e9bb..dbdf9cd 100644 --- a/rrs/views.py +++ b/rrs/views.py @@ -42,8 +42,8 @@ def _get_milestone_statistics(milestone, maintainer_name=None): ) if maintainer_name is None: -milestone_statistics['all'] = Recipe.objects.all().count() - +milestone_statistics['all'] = \ +RecipeUpstream.get_all_recipes(recipe_upstream_history).count() milestone_statistics['up_to_date'] = \ RecipeUpstream.get_recipes_up_to_date(recipe_upstream_history).count() milestone_statistics['not_updated'] = \ -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [PATCH] views.py: Fix version in current milestone
From: Mariano Lopez Fixed the version displayed in current milestone. Before the data was obtained from recipe upgrad table and this allows to fetch the data from the recipe table. Signed-off-by: Mariano Lopez --- rrs/models.py | 7 +++ rrs/views.py | 16 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/rrs/models.py b/rrs/models.py index 320670c..f0d4ed3 100644 --- a/rrs/models.py +++ b/rrs/models.py @@ -430,6 +430,13 @@ class Raw(): return stats @staticmethod +def get_re_all(): +cur = connection.cursor() +cur.execute("""SELECT id, pn, pv, summary +FROM layerindex_recipe""") +return Raw.dictfetchall(cur) + +@staticmethod def get_reupg_by_date(date): cur = connection.cursor() cur.execute("""SELECT re.id, re.pn, re.summary, te.version, rownum FROM ( diff --git a/rrs/views.py b/rrs/views.py index e2aa1ce..4a1e9bb 100644 --- a/rrs/views.py +++ b/rrs/views.py @@ -119,10 +119,18 @@ def _get_recipe_list(milestone): maintainers_dict_all = {} current_date = date.today() -recipes = Raw.get_reupg_by_date( -milestone.end_date) -for recipe in recipes: -recipes_ids.append(recipe['id']) +# If the is the curent milestone take the data recipes table +# otherwise take it from recipe upgrade +if current_date >= milestone.start_date and \ +current_date <= milestone.end_date: +recipes = Raw.get_re_all() +else: +recipes = Raw.get_reupg_by_date(milestone.end_date) + +for i,re in enumerate(recipes): +if re.has_key('pv'): +recipes[i]['version'] = re['pv'] +recipes_ids.append(re['id']) if recipe_upstream_history: recipe_upstream_all = Raw.get_reup_by_recipes_and_date( -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Retrieve list of all software/applications/packages installed on Yocto
On Wed, Jul 1, 2015 at 7:55 AM, Stanciu, Alin wrote: > Thank you Brian, this is very useful. > > > > I don’t have either opkg or dpkg installed so I’m using rpm. It’s useful in > the sense I can get comprehensive information on all packages installed, as > well as all files for each package: > > > > · rpm –qa (all packages) > > · rpm -qi (detailed package information) > > · rpm -ql ( package files) > > > > This is almost too useful…in the sense that I need a more high-level > description/listing off the packages installed (or even a more succinct > listing, if you will). Think of it as a Linux (or in this case Yocto) > equivalent of Control Panel -> Programs and Features in Windows. > > > > Are you aware of an easy way to do this? > On a running system? The way I usually research things is to use sites like: http://recipes.yoctoproject.org/rrs/recipes/1.9/M2/ http://layers.openembedded.org/layerindex/branch/master/layers/ If you are running X with a window manager of some type then yea, you can install any number of GUI front ends to the package manager and do a similiar thing as your windows example. My embedded boxes aren't running X, they are just console based systems that run a web server. If you run Toaster (used to be HOB) you can have a nice GUI on your development host that will unwind all the metatdata of all possible packages and display some of the same info and look at dependencies, sizes etc. It will allow you to do "what if" cases like "If I want bluez, what other packages get pulled in an how much bigger will my flash image be". On a running system if you need more info about packages and you don't have a GUI front end ... I would think you would have to use the package manager cmd line to see what's installed and if you need more info on that package then use the name of it and visit some of the sites like I listed above. That's all I can think of at the moment. I'm sure there are a lot of folks smarter than me that hopefully will chime in with better tricks. Regards, Brian -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Fwd: With my layer, Systemd not invoking my application at startup
On 06/30/2015 08:35 PM, Vipin Nair wrote: Hi All, I have created a layer (my first layer) and have build it with WindRiver media which uses Systemd for the startup services. As per my application need, I have to create a new user on the final image and change the owner permissions of certain files to the new user. Since I could not get it done on the build machine, I have written the post install script such that it gets executed on the target board during the 1st boot cycle and from within the post install script I am creating the new user and changing the file ownership. And this works. But the only problem I have now is that, even though I register my service with Systemd at pre-install (or postinstall) section (using the systemctl enable command) my service is not getting launched by Systemd during the 1st boot. On subsequent reboots, it invokes my service at boot up. As part of debugging I just modified my postinstall script, such that it gets executed on the board (i.e without the exit 1) and not executed on the 1st boot. After that I see that systemd invokes my service at boot up. So I wonder if Systemd ignores the services for which post-install is not invoked at build machine ? Now I am confused on how to solve this problem. Only 2 approaches comes to my mind : 1) Run the postinstall on the board only (not on 1st boot) - But with this (i.e running the postinstall section on board) I don't see the new user creation happening and as a result it fails to change the file ownership. 2) Somehow force systemd to invoke my service at startup (even with postinstall running during 1st boot) - But I don't know what I have to do to achieve this. Here is the brief of my recipe file : --- DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" do_install() { #if systemd configured install -m 0755 -d ${D}/lib/systemd/system cp ${WORKDIR}/${MA_BIN_DIR}/my_ser.service ${D}/lib/systemd/system/ } pkg_preinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable my_ser.service# Have tried executing it only on postinstall, but it does not help. fi } pkg_postinst_${PN}() { if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then systemctl --root=$D enable ma.service fi if [ x"$D" = "x" ] ; then # Create group and user groupadd test_grp useradd -r -s /sbin/nologin -g test_grp test_usr It appears you did not try to use the useradd bbclass here. chown test_usr:test_grp /etc/test_folder/* if [ "$IS_SYSTEMD_CONFIGURED" = "yes" ] ; then if [ "$1" == 1 ] || [ "$1" = 2 ] ; then # only install and upgrade scenario, not to exeute on 1st boot systemctl daemon-reload systemctl start my_ser.service fi else exit 1 fi } I am new to the yacto project and the layer approach. So kindly guide me on how to resolve this issue. If you can send your full bb file, are you using the systemd bbclass as I suggested in a past email? Sau! Also if this is not the right group to get help on this issue, please suggest about the relevant group. Thanks Vipin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Retrieve list of all software/applications/packages installed on Yocto
On 07/01/2015 06:41 AM, Brian Hutchinson wrote: On Jul 1, 2015 7:34 AM, "Stanciu, Alin" wrote: Hello, I would simply like to know how to obtain a list of all software packages/products (basically all applications) running in my Yocto build. Can this be done via a recipe? How can I find out whether my build has a recipe? What are other ways are there to get the listing? Thanks Spirent Communications e-mail confidentiality. This e-mail contains confidential and / or privileged information belonging to Spirent Communications plc, its affiliates and / or subsidiaries. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution and / or the taking of any action based upon reliance on the contents of this transmission is strictly forbidden. If you have received this message in error please notify the sender by return e-mail and delete it from your system. Spirent Communications plc Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Tel No. +44 (0) 1293 767676 Fax No. +44 (0) 1293 767677 Registered in England Number 470893 Registered at Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Or if within the US, Spirent Communications, 27349 Agoura Road, Calabasas, CA, 91301, USA. Tel No. 1-818-676- 2300 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto When you build your image ... a manifest file will contain the list of packages (with versions) contained in that image. If you have a running system, you can generate kind of the same list (depending on which package manager is being used - if any) by running a command like opkg list-installed. In case one needs a more detail on the image, you can enable *buildhistory* class. More info on http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#maintaining-build-output-quality and specifically this http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#understanding-what-the-build-history-contains Regards, Brian -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] SAMA5D3 header files for C application development
Sam, > From: yocto-boun...@yoctoproject.org [mailto:yocto-boun...@yoctoproject.org] > On Behalf Of SAS NONE > Sent: Wednesday, July 01, 2015 12:36 AM > To: yocto@yoctoproject.org > Subject: [yocto] SAMA5D3 header files for C application development > > Hi, > > I'm using SAMA5D3-xplained board and built a Linux kernel 3.18 distro for it > using the Poky Yocto build directory. I've also created the sdk and > installed it in /opt/poky-atmel/1.7.2. Ran hello world example in eclipse > however I'm trying to find the C header files for the peripherals so I can > develop applications using the SPI bus or the i2c bus. Any help in locating > these header files or how to go about developing and cross compiling the C > code in eclipse? I've already looked at the Yocto adt manual for eclipse > which is very minimum. > > Any help is greatly appreciated. I'm assuming based on your questions that you are new to the device tree setup for ARM in the Linux kernel and how to make use of it on the kernel side and the userspace side. If so, I'd suggest you go to http://www.at91.com/linux4sam/bin/view/Linux4SAM/LinuxKernel and read the documentation linked in the "Changes introduced by Device Tree Support section". Then Atmel has documentation specific to their SPI and I2C with the Linux kernel documentation. Look under Documentation/devicetree/bindings/spi/spi_atmel.txt and Documentation/devicetree/bindings/i2c/i2c-at91.txt in your kernel source. In summary, if you are lucky enough that the device you want to communicate with has device tree support, then you would add that device to your device tree files and follow their documentation on how to communicate with it from userspace. For example, I am using the AD5446 DAC on my hardware, and Analog Devices has excellent documentation of their DAC Linux kernel driver here: http://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5446. For this device I open up a file and write a value for the desired output voltage, and then the driver takes care of communicating to the AD5446. Otherwise I think you can use the generic spidev interface for reading and writing data on the SPI port (and I think there is something similar for I2C?). Since you have questions that are specific to your hardware, I think you may be able to get better answers on Atmel's AT91 forums or checking for information on Linux kernel driver support for your specific I2C and SPI devices. If you are having problems building an application with the Eclipse ADT and getting to run on your hardware, then let us know some specific details with the problems you are seeing. Regards, Bryan > > Thanks, > > Sam -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Retrieve list of all software/applications/packages installed on Yocto
On Jul 1, 2015 7:34 AM, "Stanciu, Alin" wrote: > > Hello, > > > > I would simply like to know how to obtain a list of all software packages/products (basically all applications) running in my Yocto build. > > > > Can this be done via a recipe? How can I find out whether my build has a recipe? What are other ways are there to get the listing? > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Spirent Communications e-mail confidentiality. > > This e-mail contains confidential and / or privileged information belonging to Spirent Communications plc, its affiliates and / or subsidiaries. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution and / or the taking of any action based upon reliance on the contents of this transmission is strictly forbidden. If you have received this message in error please notify the sender by return e-mail and delete it from your system. > > Spirent Communications plc > Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. > Tel No. +44 (0) 1293 767676 > Fax No. +44 (0) 1293 767677 > > Registered in England Number 470893 > Registered at Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. > > Or if within the US, > > Spirent Communications, > 27349 Agoura Road, Calabasas, CA, 91301, USA. > Tel No. 1-818-676- 2300 > > -- > ___ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto > When you build your image ... a manifest file will contain the list of packages (with versions) contained in that image. If you have a running system, you can generate kind of the same list (depending on which package manager is being used - if any) by running a command like opkg list-installed. Regards, Brian -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] Retrieve list of all software/applications/packages installed on Yocto
Hello, I would simply like to know how to obtain a list of all software packages/products (basically all applications) running in my Yocto build. Can this be done via a recipe? How can I find out whether my build has a recipe? What are other ways are there to get the listing? Thanks Spirent Communications e-mail confidentiality. This e-mail contains confidential and / or privileged information belonging to Spirent Communications plc, its affiliates and / or subsidiaries. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution and / or the taking of any action based upon reliance on the contents of this transmission is strictly forbidden. If you have received this message in error please notify the sender by return e-mail and delete it from your system. Spirent Communications plc Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Tel No. +44 (0) 1293 767676 Fax No. +44 (0) 1293 767677 Registered in England Number 470893 Registered at Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Or if within the US, Spirent Communications, 27349 Agoura Road, Calabasas, CA, 91301, USA. Tel No. 1-818-676- 2300 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto