Why is %systemd_post, used in the spec-file, not enabling or starting the service after installation? - fedora

I'm having a very simple unit-file which comes with a service which I package to a RPM-file. This RPM-file is built and installed on Fedora 28.
My service-file could not be simpler:
[Unit]
Description=Hello Work
[Service]
ExecStart=/usr/bin/executable
[Install]
WantedBy=multi-user.target
In my spec file I added these sections:
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
The service file is copied correctly via
mkdir -p %{buildroot}%{_unitdir}/
cp %{name}.service %{buildroot}%{_unitdir}/
in the %install-section.
When I install the package, the service is not started. When I run manually
systemctl enable <service-name>
it works.
Where is my mistake that the installation does not enable and start my service?

When looking at the documentation, it does not say that %systemd_post starts your service. They refer to systemd.preset: you need to define and package a %{name}.preset file that specifies that your service should be enabled by default.
This should enable your package by default.
I'm not entirely sure that now your package will be started by default, but it looks like it :)

Related

OCI CLI fails to load default profile from config file even if I have proper default profile

When I run any oci cli command I'm getting below error:
ERROR: Profile '<DEFAULT>' not found in config file C:\Users\user1\.oci\config
Below is my config file for OCI CLI:
[DEFAULT]
user=<admin user ocid>
fingerprint=<fingerprint>
key_file=<path/to/private/key>
tenancy=<tenancy ocid>
region=ap-mumbai-1
I had a similar problem to this. If you use Python and have changed some of the libraries it's possible you may have updated some of the needed dependencies. Upgrade/reinstall oci ie.
pip install oci-cli --upgrade
This sorted the problem for me.
I would suggest you take a backup of this config file, delete it and reconfigure CLI automatically by executing "oci setup config"
I guest that you are using pacman to install oci-cli. You should remove it and reinstall with official method.
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
Please refer this document on Configuring the CLI and tally it with the config file of yours.
And refer the discussion in this forum OCI Config not found issue, this might be useful as well.

How does one restart Openshift Origin master on Centos 7?

Openshift origin was installed via the ansible playbooks.
According to this documentation, the correct command to restart is:
$ systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers
However, this just results in:
Failed to restart atomic-openshift-master-api.service: Unit not found.
Failed to restart atomic-openshift-master-controllers.service: Unit not found.
What is the correct way to restart openshift origin (okd) after installing via ansible on Centos7?
If you get the following error:
bash: master-restart: command not found
try:
/usr/local/bin/master-restart
If you installed the OKD as v3.10, you should restart master services as follows. [0] The service is running as pod from v3.10, so you should use the specific command for restarting the master services, such as api and controllers
# master-restart api
# master-restart controllers
[0] RESTARTING MASTER SERVICES
As far as I know, you have two alternatives:
Using ansible
Use the same inventory.ini as you used when installing OpenShift origin.
Assuming that you have the inventory.ini file and the openshift-ansible repository cloned under /home/user/, execute the master restart playbook:
ansible-playbook -i /home/user/inventory.ini /home/user/openshift-ansible/playbooks/openshift-master/restart.yml
Restart the services
To restart the services manually, the service names are origin-master-api and origin-master-controllers. Thus the command to restart them should be:
systemctl restart origin-master-api origin-master-controllers
I strongly recommend using the first option.

How do I enable the intl extension in CakePHP?

I am using CakePHP 3 and MAMP Pro server for my project. When I am trying to bake the cake, this error shows up:
Fatal error: You must enable the intl extension to use CakePHP.
I have even included intl.so and extension=php_intl.dll in my php.ini file but couldn't figure out solution for this error.
this issue was happening to me some days ago. I had installed Ubuntu 18.04 and php 7.1.
I was trying to run the comman php cake.php bake in orden to use cakephp's console but I was getting the following error message:
You must enable the intl extension to use CakePHP.
This extension (intl) was installed for php 7.1 (php7.1-intl) but this message was appearing every time I used php cake.php bake
After some google searches, I saw that I have to install the extension but with the following command:
sudo apt-get install php-intl
The same issue happened with mbstring extension, I used the command:
sudo apt-get install php-mbstring
then I restarted the apache server with:
sudo service apache2 restart
It's difficult to pinpoint exactly what's wrong without seeing your system setup. However based on what was said in the question, you may be setting up the intl extension incorrectly.
First off, if your OS is Linux/macOS and the PHP extension is a shared library (i.e. has a .so extension) then the php.ini entry should be extension=intl.so not extension=php_intl.dll. Also make sure the intl.so file is in the directory configured under the ini entry extension_dir. Otherwise make sure the extension ini entry is fully qualified (e.g. extension=/path/to/extension/dir/intl.so).
If you are using a Linux OS that has a package manager such as Debian/Ubuntu, you may be able to more easily install the extension for the PHP packaged for that distro. For example, in Ubuntu/Debian the package php5-intl provides the intl extension for PHP5 (I assume it's something similar for PHP7 if you've enabled those repos).
If you build PHP from source, you can try bundling the extension into your PHP. See the instructions from the manual.
I faced the same issue.
I added extension="php_intl.dll" in php.ini and restarted the Apache server.
Now it is working.
I had the same issue. After starting from scratch, I did :
$ brew install php
$ composer install && composer update && composer dump-autoload --optimize
$ composer self-update && composer create-project --prefer-dist cakephp/app:^3.8 cms
$ cd cms
$ bin/cake server
And it was working !

Cannot retrieve and install ejabberd contribution modules

I have installed ejabberd 16.03 from binary source (ejabberd-16.03-osx-installer.app.zip)
My os is OS X Yosemite
After installation completed I started ejabberd:
cd ejabberd_directory/bin
./ejabberdctl start
I even checked the status to make sure it is started. Then I tried to retrieve the list of available modules:
./ejabberdctl modules_update_specs
and it says ok!
But I get nothing by running this:
./ejabberdctl modules_available
And I cannot install any module.
I would appreciate any help..
Github made some changes and we have to adapt the code to be able to install modules again. You will need ejabberd 16.06 to use this feature.
Workaround:
./ejabberdctl modules_update_specs
this command creates an empty folder ~/.ejabberd_modules/sources
cd ~/.ejabberd_modules/sources
git clone https://github.com/processone/ejabberd-contrib.git
and then you get module list and install them:
./ejabberdctl modules_available
But keep in mind that running ./ejabberdctl modules_update_specs will empty your sources folder and delete the modules.

configure mysql and apache2 module in webmin

This question might not be appropriate to ask in this forum but unfortunately the linux stack forum is not as active as here.
I installed mysql and apache2 successfully on my linux (kaliv2 x64 on vmware) and used it. I decided to use webmin as well but I have been facing some problems:
for mysql it says
The MySQL startup script (/usr/bin/safe_mysqld was not found on your system. Maybe MySQL is not installed, or your module configuration is incorrect
I can not find safe_mysqld in my directories. apparently safe_mysqld has been changed to mysqld.sock (/var/run/mysqld/mysqld.sock) however when I change /usr/bin/safe_mysqld to mysql.sock I still facing the error.
for apache2
The Apache configuration file /etc/apache2 does not exist. If you have Apache installed, adjust the module configuration to use the correct path.
I should mention that Apache Webserver is located in unused modules
Use locate command to find mysqld_safe, apache2 and maybe apachectl. In case you couldn't find mysqld_safe, look for mysqld. As for apache2 look for BOTH file and directory with this name - the first one is a command to start and stop the service, the second one is the server root directory which contains bin/httpd and bin/apachectl.
Apparently all configuration for MySQL is correct except
"Command to start MySQL server" : /etc/init.d/mysql
And for Apache I did as below
"Apache server root directory" :/etc/apache2
"Path to httpd executable" :/etc/init.d/apache2
"Path to httpd.conf or apache2.conf" :/etc/apache2/apache2.conf
"Path to access.conf" : Automatic