libvrt: dnsmasq: failed to bind DHCP server socket: Address already in use - kvm

I am trying to create a VM using virt-manager. BUt i see
Error starting network 'default': internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) unexpected exit status 2:
dnsmasq: failed to bind DHCP server socket: Address already in use
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb
callback(*args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
ret = fn(self, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/network.py", line 69, in start
self._backend.create()
File "/usr/lib/python3.9/site-packages/libvirt.py", line 3463, in create
raise libvirtError('virNetworkCreate() failed')
libvirt.libvirtError: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) unexpected exit status 2:
dnsmasq: failed to bind DHCP server socket: Address already in use
Can anyone help me what to do now.
also checked
# journalctl -u libvirtd.service
-- Journal begins at Fri 2022-01-07 04:27:05 IST, ends at Sat 2022-01-08 11:10:46 IST. --
Jan 08 10:34:38 gauranga systemd[1]: Started Virtualization daemon.
Jan 08 11:03:20 gauranga dnsmasq[702843]: failed to bind DHCP server socket: Address already in use
Jan 08 11:03:20 gauranga dnsmasq[702843]: FAILED to start up
Jan 08 11:03:20 gauranga libvirtd[699713]: libvirt version: 7.9.0
Jan 08 11:03:20 gauranga libvirtd[699713]: hostname: gauranga
Jan 08 11:03:20 gauranga libvirtd[699713]: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf>
dnsmasq: failed to bind DHCP server socket: Address already in use
Jan 08 11:03:49 gauranga dnsmasq[702936]: failed to bind DHCP server socket: Address already in use
Jan 08 11:03:49 gauranga dnsmasq[702936]: FAILED to start up
Jan 08 11:03:49 gauranga libvirtd[699713]: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf>
dnsmasq: failed to bind DHCP server socket: Address already in use
Jan 08 11:04:10 gauranga dnsmasq[703015]: failed to bind DHCP server socket: Address already in use
Jan 08 11:04:10 gauranga dnsmasq[703015]: FAILED to start up
Jan 08 11:04:10 gauranga libvirtd[699713]: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf>
dnsmasq: failed to bind DHCP server socket: Address already in use

Related

Ubuntu server: Apache status show old failure information, and is running fine

I am a bit puzzled about this... Apache status is showing information from 12 days ago. It's running fine and website is working. Is the status command not supposed to show current state of Apache?
# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-01-05 05:19:24 CET; 1 weeks 5 days ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 514 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jan 05 05:19:24 serverX systemd[1]: Starting The Apache HTTP Server...
Jan 05 05:19:24 serverX apachectl[532]: AH00112: Warning: DocumentRoot [/some/dir] does not exist
Jan 05 05:19:24 serverX apachectl[532]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 10.42.24.6:80
Jan 05 05:19:24 serverX apachectl[532]: no listening sockets available, shutting down
Jan 05 05:19:24 serverX apachectl[532]: AH00015: Unable to open logs
Jan 05 05:19:24 serverX apachectl[514]: Action 'start' failed.
Jan 05 05:19:24 serverX apachectl[514]: The Apache error log may have more information.
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 05 05:19:24 serverX systemd[1]: Failed to start The Apache HTTP Server.
OS: Ubuntu 20
netstat shows that port 80 is actually listening on 10.42.24.6
# netstat -tulpn | grep apache
tcp 0 0 10.42.24.6:80 0.0.0.0:* LISTEN 1557/apache2
tcp 0 0 10.42.24.6:443 0.0.0.0:* LISTEN 1557/apache2
Also Apache is logging requests to the access logs
I noticed this problem, because I am using systemctl status apache2 to check apache status in a new shell script I wrote... But the way this command is working, makes it useless.

Service running on RHEL7.5 is not running on RHEL8 (httpd service)

I have service which was working fine with RHEL 7.5, now I have upgraded to RHEL 8 and same service is failing with below status:
Service.service - LSB: Web Server
Loaded: loaded (/etc/rc.d/init.d/Service; generated)
Active: failed (Result: protocol) since Mon 2020-04-06 12:02:21 IST; 38min ago
Docs: man:systemd-sysv-generator(8)
Process: 403 ExecStart=/etc/rc.d/init.d/Service start (code=exited, status=0/SUCCESS)
Apr 06 12:02:21 localhost.localdomain systemd[1]: Starting LSB: Web Server...
Apr 06 12:02:21 localhost.localdomain Service[403]: httpd (pid 29434) already running
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain:
/usr/local/apache/logs/Service.pid
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain:
/usr/local/apache/logs/Service.pid
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Failed with result 'protocol'.
Apr 06 12:02:21 localhost.localdomain systemd[1]: Failed to start LSB: Web Server
THis is my Service unit placed under /etc/init.d/Service, same is done for RHEL 7.5 but there this service is working and in RHEL 8 it is not. One more thing here to note is web server is working as expected although giving me this error.
#!/bin/sh
#
# chkconfig: 345 97 03
# description:Web Server
# processname: httpd
# config: /usr/local/Test/apache/conf/httpd.conf
# pidfile: /usr/local/Test/apache/logs/httpd.pid
### BEGIN INIT INFO
# Provides: Service
# Required-Start: $remote_fs $network $syslog
# Should-Start:
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6`enter code here`
# Short-Description: Web Server
# Description: Web Server
### END INIT INFO
LANG=en_US.iso88591
export LANG
BASEDIR=/usr/local/Test/apache
PATH=$BASEDIR/bin:/usr/bin:/bin
export PATH
LD_LIBRARY_PATH=$BASEDIR/lib
export LD_LIBRARY_PATH
inst=/usr/local/Test
MIBDIRS=$inst/mibs
export MIBDIRS
case $1 in
start)
apachectl start
;;
stop)
apachectl stop
;;
restart)
apachectl restart
;;
*)
echo "usage: $0 { start | stop | restart }"
;;
esac
Plz help me into this.

Redhat Server oracle-rdbms.service Startup Error

I am trying to create a service file that will allow me to automatically startup my Oracle 12C database and listener automatically on reboot. I have written the service file which contains the following:
# /etc/systemd/system/oracle-rdbms.service
# Invoking Oracle scripts to start/shutdown Instances defined in /etc/oratab
# and starts Listener
[Unit]
Description=Oracle Database(s) and Listener
Requires=network.target
[Service]
Type=forking
Restart=no
ExecStart=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.2.0/dbhome_1/
ExecStop=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut /u01/app/oracle/product/12.2.0/dbhome_1/
User=oracle
[Install]
WantedBy=multi-user.target
When I enabled the service and checked the status, I get the following error:
● oracle-rdbms.service - Oracle Database(s) and Listener
Loaded: loaded (/etc/systemd/system/oracle-rdbms.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2018-10-22 11:45:02 EDT; 1 day 23h ago
Process: 1377 ExecStop=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut /u01/app/oracle/product/12.2.0/dbhome_1 (code=exited, status=0/SUCCESS)
Process: 615 ExecStart=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.2.0/dbhome_1 (code=exited, status=0/SUCCESS)
Oct 22 11:45:00 oracle-dev dbstart[615]: /u01/app/oracle/product/12.2.0/dbhome_1/bin/dbstart: line 94: /u01/app/oracle/product/12.2.0/dbhome_1/listener.log: Permission denied
Oct 22 11:45:02 oracle-dev dbstart[615]: touch: cannot touch ‘/u01/app/oracle/product/12.2.0/dbhome_1/startup.log’: Permission denied
Oct 22 11:45:02 oracle-dev dbstart[615]: chmod: changing permissions of ‘/u01/app/oracle/product/12.2.0/dbhome_1/startup.log’: Operation not permitted
Oct 22 11:45:02 oracle-dev dbstart[615]: Processing Database instance "orcl": log file /u01/app/oracle/product/12.2.0/dbhome_1/startup.log
Oct 22 11:45:02 oracle-dev dbstart[615]: /u01/app/oracle/product/12.2.0/dbhome_1/bin/dbstart: line 346: /u01/app/oracle/product/12.2.0/dbhome_1/startup.log: Permission denied
Oct 22 11:45:02 oracle-dev dbshut[1377]: /u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut: line 63: /u01/app/oracle/product/12.2.0/dbhome_1/listener.log: Permission denied
Oct 22 11:45:02 oracle-dev dbshut[1377]: /u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut: line 64: /u01/app/oracle/product/12.2.0/dbhome_1/listener.log: Permission denied
Oct 22 11:45:02 oracle-dev dbshut[1377]: Processing Database instance "orcl": log file /u01/app/oracle/product/12.2.0/dbhome_1/shutdown.log
Oct 22 11:45:02 oracle-dev dbshut[1377]: /u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut: line 160: /u01/app/oracle/product/12.2.0/dbhome_1/shutdown.log: Permission denied
Oct 22 11:45:02 oracle-dev systemd[1]: Started Oracle Database(s) and Listener.
I am logged in as root and am still not sure what the problem is. Thank you
Your startup.log and listerner.log don't have the correct permissions set up. Use the chmod command on those two files to the appropriate permissions and it should work

NetworkManager kills apache when going offline

When i turn off my WiFi, NetworkManager kills apache2. This can be seen in '/var/log/apache/error_log':
[Sun Mar 01 13:25:55 2015] [notice] caught SIGTERM, shutting down
However, this does not happen if i turn off the WiFi manually by doing
sudo ifconfig wlan0 down
It seems NetworkManager goes to status 'inactive' when i disconnect it from the WiFi.
These are some of the contents of '/var/log/messages' around the time i turn off the WiFi:
Mar 1 13:25:52 raven NetworkManager[22393]: <info> (wlan0): device state change: activated -> disconnected (reason 'user-requested') [100 30 39]
Mar 1 13:25:52 raven NetworkManager[22393]: <info> (wlan0): deactivating device (reason 'user-requested') [39]
Mar 1 13:25:52 raven dhcpcd[350]: received SIGTERM, stopping
Mar 1 13:25:52 raven dhcpcd[350]: wlan0: removing interface
Mar 1 13:25:53 raven NetworkManager[22393]: <info> (wlan0): canceled DHCP transaction, DHCP client pid 350
Mar 1 13:25:53 raven NetworkManager[22393]: <info> NetworkManager state is now DISCONNECTED
Mar 1 13:25:53 raven dbus[16077]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> (pid 350) unhandled DHCP event for interface wlan0
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> Connection disconnected (reason -3)
Mar 1 13:25:53 raven NetworkManager[22393]: <info> (wlan0): supplicant interface state: completed -> disconnected
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> Connection disconnected (reason -3)
Is there a way to "uncouple" apache2 from NetworkManager so it is not killed when going offline
I have gentoo 3.10.7-gentoo-r1, i am using OpenRC (not systemd),
NetworkManager 0.9.8.8, and apache 2.2.25
Same problem here (Gentoo user for years).
Very quick solution:
As root, just type apache1 this will start apache with the same configs as the init script /etc/init.d/apache2 does. The only difference is that it will not check for a started network.
The reason why it is stopped then NetworkManager is stopped is this part of the init script:
depend() {
need net
use mysql dns logger netmount postgresql
after sshd
}
The need net part tells the script that this service requires the network to be up. On machine where NetworkManager is used and there is no network connection, through WiFi or wired networks, this condition is not given and the service is stopped automatically.
So as a second (still hacky) solution, you could just comment out this line.

Two virtual machines limited in one physical machine above Eucalyptus Xen

I have an Eucalyptus-based cloud using Xen with 3 nodes. When I run a VM more than twice the number of physical machines in the xen cluster, the extra VMs never boot up, they always change state from pending to terminate, and the log file shows the node controller shutoff the extra VM after it check the instances number. When I manually shutdown some VM, then I can easily start up some VM exactly as the number I've shutdown.
The log shows this error:
ERROR: [Tue Jan 17 12:51:05 2012][004231][EUCAERROR ] libvirt: POST
operation failed: xend_post: error from xen daemon: (xend.err 'Device
2049 (vbd) could not be connected. /etc/xen/scripts/block failed;
error detected.') (code=11) [Tue Jan 17 12:51:05
2012][004231][EUCADEBUG ] doDescribeResource() invoked [Tue Jan 17
12:51:06 2012][004231][EUCADEBUG ] doDescribeInstances() invoked [Tue
Jan 17 12:51:06 2012][004231][EUCADEBUG ] doDescribeInstances():
instanceId=i-3BB00757 publicIp=192.168.4.165 privateIp=192.168.4.165
mac=d0:0d:3B:B0:07:57 vlan=-1 networkIndex=-1 [Tue Jan 17 12:51:06
2012][004231][EUCADEBUG ] doDescribeInstances(): instanceId=i-473807EE
publicIp=192.168.4.112 privateIp=192.168.4.112 mac=d0:0d:47:38:07:EE
vlan=-1 networkIndex=-1 [Tue Jan 17 12:51:06 2012][004231][EUCADEBUG ]
doDescribeInstances(): instanceId=i-348A06AE publicIp=0.0.0.0
privateIp=0.0.0.0 mac=d0:0d:34:8A:06:AE vlan=-1 networkIndex=-1 [Tue
Jan 17 12:51:06 2012][004231][EUCAERROR ] libvirt: POST operation
failed: xend_post: error from xen daemon: (xend.err 'Device 2049 (vbd)
could not be connected. /etc/xen/scripts/block failed; error
detected.') (code=11) [Tue Jan 17 12:51:08 2012][004231][EUCAERROR ]
libvirt: POST operation failed: xend_post: error from xen daemon:
(xend.err 'Device 2049 (vbd) could not be connected.
/etc/xen/scripts/block failed; error detected.') (code=11) [Tue Jan 17
12:51:09 2012][004231][EUCAERROR ] libvirt: POST operation failed:
xend_post: error from xen daemon: (xend.err 'Device 2051 (vbd) could
not be connected. /etc/xen/scripts/block failed; error detected.')
(code=11) [Tue Jan 17 12:51:10 2012][004231][EUCAERROR ] libvirt: POST
operation failed: xend_post: error from xen daemon: (xend.err 'Device
2051 (vbd) could not be connected. /etc/xen/scripts/block failed;
error detected.') (code=11) [Tue Jan 17 12:51:10
2012][004231][EUCAFATAL ] hypervisor failed to start domain [Tue Jan
17 12:51:10 2012][004231][EUCADEBUG ] state change for instance
i-348A06AE: Staging -> Shutoff (Extant) [Tue Jan 17 12:51:10
2012][004231][EUCAERROR ] libvirt: Domain not found:
xenUnifiedDomainLookupByName (code=42) [Tue Jan 17 12:51:10
2012][004231][EUCAINFO ] cleaning up state for instance i-348A06AE
Is this a limitation for CentOS 5.* and RedHat 5.? Is it fixed on CentOS 6.?
http://docs.vmd.citrix.com/XenServer/5.0.0/1.0/en_gb/guest.html#rhel5_limitations
"Only 3 virtual network interfaces are supported in versions below 5.2. For 5.2 and above, 7 virtual network interfaces are supported."
I opened this topic in both CentOS and Eucalyptus forums without luck:
https://www.centos.org/modules/newbb/viewtopic.php?topic_id=35491&forum=38
http://open.eucalyptus.com/forum/unable-run-more-4-instances-even-extra-resources
Thanks, Leandro
The error you are seeing seems related to disk not to network (Device 2049 (vbd) could not be connected. /etc/xen/scripts/block failed; error detected). I don't see that script on a CentOS 5.7 install I have here, so you may want to dig into that script to see if there is some obvious error.
The solution was to increase number of loop devices in CentOS 5, as detailed in the following link:
http://open.eucalyptus.com/participate/wiki/increase-number-loop-devices-centos-5
As the link is no longer valid, you have to go to archive.org or see this similar answer:
how to increase the loop devices number