Error on provisioning apache2 opscode cookbook on Centos 5.9 vagrant with chef-solo - apache

Trying a simple apache2 provision on vagrant causes a Permission Denied error:
[2014-03-06T18:35:26+00:00] INFO: *** Chef 10.16.2 ***
[2014-03-06T18:35:26+00:00] INFO: Setting the run_list to ["recipe[chef-solo-proxy]", "recipe[yum]", "recipe[apache2]"] from JSON
[2014-03-06T18:35:26+00:00] INFO: Run List is [recipe[chef-solo-proxy], recipe[yum], recipe[apache2]]
[2014-03-06T18:35:26+00:00] INFO: Run List expands to [chef-solo-proxy, yum, apache2]
[2014-03-06T18:35:26+00:00] INFO: Starting Chef Run for localhost.localdomain
[2014-03-06T18:35:26+00:00] INFO: Running start handlers
[2014-03-06T18:35:26+00:00] INFO: Start handlers complete.
================================================================================
Error executing action `start` on resource 'service[apache2]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /sbin/service httpd start ----
STDOUT: Starting httpd: [FAILED]
STDERR: httpd: Could not open configuration file /etc/httpd/conf/httpd.conf: Permission denied
---- End output of /sbin/service httpd start ----
Ran /sbin/service httpd start returned 1
I logged into the guest host and saw that httpd.conf is owned by root, shouldn't it be? Am I missing something?

Related

Flask Apache Start Fails with Permission Denied

I am trying to install Flask on my CentOS 7.9.2009 VM running Apache HTTP Server. I've installed Python3.8 and mod_wsgi but when I attempt to start Apache I get the below Permissioned denied when loading the mod_wsgi. I've checked multiple blogs and forums and cannot find a resolution. Any idea why I am getting this error?
Error: cannot open shared object file: Permission denied
httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/02-wsgi.conf: Cannot load /home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so into server: /home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so: cannot open shared object file: Permission denied
I installed python3.8 from source using ./configure --enable-optimizations --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" but I am still getting the above permission denied error.
Below is how my app.conf file looks like and also output of mod_wsgi module-config.
app.conf:
LoadModule wsgi_module "/home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
mod_wsgi module-config:
[myuser#mycentos conf.d]$ mod_wsgi-express module-config
LoadModule wsgi_module "/home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
WSGIPythonHome "/usr/local"
I get the error when I try to start Apache - sudo systemctl start httpd.
The permission issue was because of SELinux enabled/enforced on my system. I reached out to one of the mod_wsgi source code authors and he pointed me to check this. For now disabling this resolved my immediate issue. If others have suggestions to resolve this without turning it off please suggest.
$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31

● libvirtd.service ,Active: inactive (dead), Initialization of QEMU state driver failed: invalid argument: Failed to parse user 'libvirt-qemu'

When I check status of libvirtd using the cmd: sudo systemctl status libvirtd the o/p is as follows:
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2021-07-22 18:00:59 EDT; 1min 4s ago
TriggeredBy: ● libvirtd-admin.socket
● libvirtd.socket
● libvirtd-ro.socket
Docs: man:libvirtd(8)
https://libvirt.org
Process: 1717 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS)
Main PID: 1717 (code=exited, status=0/SUCCESS)
Jul 22 18:00:59 eb2-2259-lin04 systemd[1]: Starting Virtualization daemon...
Jul 22 18:00:59 eb2-2259-lin04 systemd[1]: Started Virtualization daemon.
Jul 22 18:00:59 eb2-2259-lin04 libvirtd[1717]: libvirt version: 6.0.0, package: 0ubuntu8.11 (Christian Ehrhardt <christian.ehrhardt#canonical.com> Tue, 05 Jan 2021 13:48:48 +0100)
Jul 22 18:00:59 libvirtd[1717]: hostname: eb2-2259-lin04
Jul 22 18:00:59 eb2-2259-lin04 libvirtd[1717]: invalid argument: Failed to parse user 'libvirt-qemu'
Jul 22 18:00:59 eb2-2259-lin04 libvirtd[1717]: Initialization of QEMU state driver failed: invalid argument: Failed to parse user 'libvirt-qemu'
Jul 22 18:00:59 eb2-2259-lin04 libvirtd[1717]: Driver state initialization failed
Jul 22 18:00:59 eb2-2259-lin04 systemd[1]: libvirtd.service: Succeeded.
The status is always inactive(dead). And I get lines invalid argument: Failed to parse user 'libvirt-qemu' , Initialization of QEMU state driver failed: invalid argument: Failed to parse user 'libvirt-qemu' and Driver state initialization failed
I also tried sudo systemctl start libvirtd
and sudo systemctl status libvirtd but the issue doesn't get resolved.
I was actually installing KVM2 driver for GPU support within minikube following the link [https://help.ubuntu.com/community/KVM/Installation][1]. According to the link KVM2 is successfully installed in Ubuntu if virsh list --all cmd does not return an error. For me all the steps returned no error except for the virsh list --all returned the following error.
error: failed to connect to the hypervisor
error: Cannot recv data: Connection reset by peer
and sometimes returns the following error
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
When I start minikube with kvm2 as the driver using the command minikube start --driver kvm2I get the following error
😄 minikube v1.15.1 on Ubuntu 20.04
💢 Exiting due to GUEST_DRIVER_MISMATCH: The existing "minikube" cluster was created using the "virtualbox" driver, which is incompatible with requested "kvm2" driver.
💡 Suggestion: Delete the existing 'minikube' cluster using: 'minikube delete', or start the existing 'minikube' cluster using: 'minikube start --driver=virtualbox'
Please suggest me how to start minikube with kvm2 as driver.

can't start rabbitmq-server after installation on windows

I try to run this 'rabbitmq-server' command in my cmd but that give me this error ...
Configuring logger redirection
13:44:01.865 [warning] Using RABBITMQ_ADVANCED_CONFIG_FILE: c:/Users/saikat/AppData/Roaming/RabbitMQ/advanced.config
13:44:02.838 [error]
13:44:02.838 [error] BOOT FAILED
BOOT FAILED
13:44:02.838 [error] ===========
===========
13:44:02.838 [error] ERROR: distribution port 25672 in use by another node: rabbit#DESKTOP-1I7H1RC
ERROR: distribution port 25672 in use by another node: rabbit#DESKTOP-1I7H1RC
13:44:02.838 [error]
13:44:03.839 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"} in context start_error
13:44:03.840 [error] CRASH REPORT Process <0.152.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"DESKTOP-1I7H1RC\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"}}},{r
Crash dump is being written to erl_crash.dump...done
No doubt you have already resolved this, but for anyone else this may help I had the same issue on Windows and managed to resolve it by doing the followed.
Open powershell as admin in *\rabbitmq_server-3.8.9\sbin*
Stop the service by running: .\rabbitmq-service.bat stop
Start the service by running: .\rabbitmq-server.bat
If you are on windows then go to Services
Search RabbitMq and Right click
Stop service
Open cmd as administrator
run cd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.17\sbin
and then run rabbitmq-server
For me what I did was killing the process of erl from the task manager and then running the command:
rabbitmq-server.bat

Failure when creating Content Runtime

When I tried to deploy the Content Runtime it failed with the error:
null_resource.singlenode (remote-exec): ERROR: CONFIGURATION ERROR:Specified config file /etc/opscode/pivotal.rb does not exist
null_resource.singlenode (remote-exec): Creating admin user: chef-admin
null_resource.singlenode: Still creating... (8m30s elapsed)
null_resource.singlenode (remote-exec): ERROR: CONFIGURATION ERROR:Specified config file /etc/opscode/pivotal.rb does not exist
Error applying plan:
I see this error when I try to create content-runtime using vSphere or Other template. What could be the cause?
This looks like an issue while installing chef. Run the command on the failed vm:
~/advanced-content-runtime/verify-installation.sh
And check the results.
The command will indicate a failure with chef, but will show you the location of the chef install log:
~/advanced-content-runtime/.advanced-runtime-config/chef-install.log
Then check the log for pivotal:
egrep pivotal ~/advanced-content-runtime/.advanced-runtime-config/chef-install.log
On a system where chef installed correctly, the result seen with the commands above are:
[2017-11-07T16:44:10-06:00] INFO: Storing updated cookbooks/private-chef/templates/default/pivotal.rb.erb in the cache.
[2017-11-07T16:44:13-06:00] INFO: Processing file[/etc/opscode/pivotal.pem] action create (private-chef::private_keys line 33)
[2017-11-07T16:44:13-06:00] INFO: file[/etc/opscode/pivotal.pem] created file /etc/opscode/pivotal.pem
[2017-11-07T16:44:13-06:00] INFO: file[/etc/opscode/pivotal.pem] updated file contents /etc/opscode/pivotal.pem
[2017-11-07T16:44:13-06:00] INFO: file[/etc/opscode/pivotal.pem] owner changed to 999
[2017-11-07T16:44:13-06:00] INFO: file[/etc/opscode/pivotal.pem] group changed to 0
[2017-11-07T16:44:13-06:00] INFO: file[/etc/opscode/pivotal.pem] mode changed to 600
[2017-11-07T16:47:51-06:00] INFO: Processing template[/etc/opscode/pivotal.rb] action create (private-chef::ctl_config line 32)
[2017-11-07T16:47:51-06:00] INFO: template[/etc/opscode/pivotal.rb] created file /etc/opscode/pivotal.rb
[2017-11-07T16:47:51-06:00] INFO: template[/etc/opscode/pivotal.rb] updated file contents /etc/opscode/pivotal.rb
[2017-11-07T16:47:51-06:00] INFO: template[/etc/opscode/pivotal.rb] owner changed to 0
[2017-11-07T16:47:51-06:00] INFO: template[/etc/opscode/pivotal.rb] group changed to 0
[2017-11-07T16:47:51-06:00] INFO: template[/etc/opscode/pivotal.rb] mode changed to 644
From review of the chef logs, you might find a failed chef config, specifically this issue: https://github.com/chef/chef-server/issues/987.
You can clean the chef install (chef-server-ctl cleanse), and launch the command line to then successfully complete the install. From CAM perspective, you can resubmit the other template create of the content runtime, and the VM will then become usable and known to CAM.

Unable to install httpd service on chef client(node)

I am new to chef and following "Learning Chef" book from "O'Riely" to learn the chef basics.
In its chapter 07 they have described to install httpd service on chef client(node) from chef host using cookbook.
This is how my .kitchen.yaml file looks like :
---
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: centos_apache
driver:
box: learningchef/centos65
boxurl: learningchef/centos65
suites:
- name: default
run_list:
- recipe[my_apache::default]
attributes:
The recipe for installing httpd service looks like :
#
# Cookbook Name:: my_apache
# Recipe:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
#
yum_package 'httpd' do
source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
action :install
end
And this is the log which I get after executing the command "kitchen converge"
-----> Starting Kitchen (v1.4.0)
-----> Converging <default-centos-apache>...
Preparing files for transfer
Preparing dna.json
Preparing current project directory as a cookbook
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
Transferring files to <default-centos-apache>
Starting Chef Client, version 12.4.0
[2015-07-08T12:56:06+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
resolving cookbooks for run list: ["my_apache::default"]
Synchronizing Cookbooks:
- my_apache
Compiling Cookbooks...
Converging 1 resources
Recipe: my_apache::default
================================================================================
Error executing action `install` on resource 'yum_package[httpd]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
STDERR: yum-dump Repository Error: Cannot find a valid baseurl for repo: base
---- End output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
Ran /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb
8: yum_package 'httpd' do
9: source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
10: action :install
11: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb:8:in `from_file'
yum_package("httpd") do
action :install
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "httpd"
source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
flush_cache {:before=>false, :after=>false}
declared_type :yum_package
cookbook_name "my_apache"
recipe_name "default"
end
Running handlers:
[2015-07-08T12:56:14+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-08T12:56:14+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 11.596431753 seconds
[2015-07-08T12:56:14+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2015-07-08T12:56:14+00:00] ERROR: yum_package[httpd] (my_apache::default line 8) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
STDERR: yum-dump Repository Error: Cannot find a valid baseurl for repo: base
---- End output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
Ran /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 returned 1
[2015-07-08T12:56:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-centos-apache>.
>>>>>> Please see .kitchen/logs/default-centos-apache.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '
sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889
']
>>>>>> ----------------------
I want to install httpd service using the local rpm package. Chef client is already installed on the virtual machine.
I have tried various steps, but getting same output always.
Update: So I did yum update in my host and client both.
After that the output log changed.. I says that it couldn't find the package at defined source, while it is present there. Please suggest::
-----> Starting Kitchen (v1.4.0)
-----> Converging <default-centos-apache>...
Preparing files for transfer
Preparing dna.json
Preparing current project directory as a cookbook
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
Transferring files to <default-centos-apache>
Starting Chef Client, version 12.4.0
[2015-07-09T14:16:57+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
resolving cookbooks for run list: ["my_apache::default"]
Synchronizing Cookbooks:
- my_apache
Compiling Cookbooks...
Converging 1 resources
Recipe: my_apache::default
================================================================================
Error executing action `install` on resource 'yum_package[httpd]'
================================================================================
Chef::Exceptions::Package
-------------------------
Package httpd not found: /home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb
8: package "httpd" do
9: source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
10: action :install
11: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb:8:in `from_file'
yum_package("httpd") do
action :install
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "httpd"
source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
flush_cache {:before=>false, :after=>false}
declared_type :package
cookbook_name "my_apache"
recipe_name "default"
end
Running handlers:
[2015-07-09T14:17:01+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-09T14:17:01+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 6.822340816 seconds
[2015-07-09T14:17:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2015-07-09T14:17:01+00:00] ERROR: yum_package[httpd] (my_apache::default line 8) had an error: Chef::Exceptions::Package: Package httpd not found: /home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm
[2015-07-09T14:17:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-centos-apache>.
>>>>>> Please see .kitchen/logs/default-centos-apache.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '
sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889
']
>>>>>> ----------------------
Might want to try following the steps outlined here if you can't work out your proxy/network issues. http://xmodulo.com/how-to-fix-yum-errors-on-centos-rhel-or-fedora.html
Regards,
The answer to the problem is in comments of question,by Mark.
Hence just pasting it here.
Terminal proxies are not enough. Kitchen is running chef client within a virtual machine. See: docs.chef.io/config_yml_kitchen.html#work-with-proxies

Categories