error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused - virtual-machine

I added a virtual network card from a physical network card to the xml file of the virtual machine.
<devices>
<interface type='hostdev' managed='yes'>
<driver name='vfio'/>
<source>
<address type='pci' domain='0x0000' bus='0x86' slot='0x0a' function='0x7'/>
</source>
<mac address='52:54:00:6d:90:02'/>
</interface>
</devices>
When I execute virsh define, I get error info
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
I tried reinstall libvirt qemu ,but no effect.

Try these steps:
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
Exit the session and again logged in then,
sudo systemctl enable libvirtd
sudo systemctl start libvirtd

Related

Vagrant/Redis - Cannot connect from host

Still getting the hang of Vagrant/Redis/Linux. Please help! The issue is I cannot connect to redis server running on VM.
Host: Macbook
Vagrantfile:
config.vm.box = "laravel/homestead"
config.vm.hostname="redis-test"
config.vm.network "forwarded_port", guest: 6379, host: 6379, id: "redis"
Guest: laravel/homestead Vagrant box.
/etc/redis/redis.conf
bind 0.0.0.0
After changing redis.conf, I also restarted the service
sudo /etc/init.d/redis-server restart
(AND also) sudo service redis-server restart
Also made sure ufw is disabled
sudo ufw disable
sudo ufw status
Status: inactive
If I run redis-cli -h redis-test ping, I get pong, and can access redis as usual (on the guest VM)
Now back on the host machine (macbook), I cannot access redis-server.
redis-cli -h redis-test ping
Could not connect to Redis at redis-test:6379: nodename nor servname
provided, or not known
Can someone help me connect to redis-server on vagrant box, please? Any help is greatly appreciated!
You forwarded redis port 6379 from host machine to redis-test VM, but host machine knows nothing about redis-test domain you are trying to connect to.
You can connect redis on redis-test VM from host machine in two ways:
1.
connect to localhost, because redis port is already forwarded to redis on redis-test VM:
redis-cli -h localhost ping
2.
add redis-test to /etc/hosts:
echo '127.0.0.1 redis-test' >> /etc/hosts
and you can connect redis the way you used:
redis-cli -h redis-test ping

Rundeck ssh connection refused

I can't execute remotely on my nodes, I already stored the node's private key on /var/lib/rundeck/nodes/backend-01.key and I get this error:
Execution log:
Execution failed: 20 in project deployments: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [backend-01: ConnectionFailure: Conexión rehusada (Connection refused)]}, Node failures: {backend-01=[ConnectionFailure: Conexión rehusada (Connection refused)]}, status: failed]
My resources.xml:
<project>
<node name="backend-01"
description="Backend-01"
tags=""
hostname="10.10.10.10"
osArch=" x86_64"
osFamily="unix"
osName="Linux"
osVersion="x86_64"
username="backend-01"
ssh-keypath="/var/lib/rundeck/nodes/backend-01.key"
/>
</project>
I store node private key on /var/lib/rundeck/nodes/backend-01.key
I followed this tutorial, but didn't worked
https://www.youtube.com/watch?v=RxNSqprG_BU
https://www.youtube.com/watch?v=qOA-kWse22g
Connection refused means the ssh port on target node is not open. This can be firewall policy, openssh is not running and others
Are you be able to ssh from your rundeck server to your target node using ssh -i /var/lib/rundeck/nodes/backend-01.key backend-01#10.10.10.10?
Does your key require a passphrase? If so, see Rundeck Administration Guide: SSH Private Key Passphrase.

Firewalld seems to be blocking connecting to my CouchDB 2.0

I'm trying to set up a CouchDB 2.0 instance up on my CentOS 7 server.
I've got it installed and running as a systemd service and it responses with its friendly hello world message when I access it from the server using 127.0.0.1 or 0.0.0.0
$ curl 127.0.0.1:5984
{"couchdb":"Welcome","version":"2.0.0","vendor":{"name":"The Apache Software Foundation"}}
$ curl 0.0.0.0:5984
{"couchdb":"Welcome","version":"2.0.0","vendor":{"name":"The Apache Software Foundation"}}
in my local.ini file I've configed the bind_address to 0.0.0.0
[httpd]
bind_address = 0.0.0.0
My understanding was that if I had this bind address I could connect to port 5984 from any ip address open in my firewall
I'm using firewalld for my firewall and I've configured it to open port 5984
This config is confirmed by listing the configuration of the public zone:
$ sudo firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: couchdb2 dhcpv6-client http https ssh
ports: 443/tcp 5984/tcp
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
I've also created a service called couchdb2 at /etc/firewalld/services/couchdb2.xml with XML:
<service>
<short>couchdb2</short>
<description>CouchDB 2.0 Instance</description>
<port protocol="tcp" port="5984"/>
</service>
From what I know about firewalld I should be able to receive connection on 5984 now
but when I curl from my laptop my connection is refused:
$ curl my-server:5984 --verbose
* Rebuilt URL to: my-server:5984/
* Trying <my-ip>...
* connect to <my-ip> port 5984 failed: Connection refused
* Failed to connect to my-server port 5984: Connection refused
* Closing connection 0
When I connect to the couchdb instance locally via either 127.0.0.1 or 0.0.0.0 I can see the 200 response in my couchdb log:
$ sudo journalctl -u couchdb2
...
[notice] 2017-06-06T00:35:01.159244Z couchdb#localhost <0.3328.0> 222d655c69 0.0.0.0:5984 127.0.0.1 undefined GET / 200 ok 28
[notice] 2017-06-06T00:37:21.819298Z couchdb#localhost <0.5598.0> 2f8986d14b 127.0.0.1:5984 127.0.0.1 undefined GET / 200 ok 1
But when I curled from my laptop nothing shows up in the couchdb log for the Connection Refused error
This suggests to me that the problem may be the firewall and not CouchDB but I'm not sure about that.
Is Connection Refused always the firewall? Would I be getting some other error if this where the CouchDB instance having a problem?
To the best of my knowledge both CouchDB and firewalld are configured correctly, but its not working like I expected.
Any help would be appreciated, whether you know the problem or whether you can just help me discern if the problem is related to CouchDB or firewalld.

Receiving a Connection Refusal in Zeppelin

I'm receiving a connection refusal (see bottom) when attempting to run paragraphs in Zeppelin. I installed Docker Toolbox on my Windows machine, and then ran the following container in the Docker Terminal:
docker run -it --privileged=true -m 4096m -p 2222:22 -p 8888:8888 -p 8889:8889 -h bootcamp1.docker sunlab/bigdata:0.04.1 /bin/bash
After running this, I started the following services:
sudo service zeppelin start
sudo service sshd start
sudo service zookeeper-server start
sudo service hadoop-yarn-proxyserver start
sudo service hadoop-hdfs-namenode start
sudo service hadoop-hdfs-datanode start
sudo service hadoop-yarn-resourcemanager start
sudo service hadoop-mapreduce-historyserver start
sudo service hadoop-yarn-nodemanager start
sudo service spark-worker start
sudo service spark-master start
sudo service hbase-regionserver start
sudo service hbase-master start
sudo service hbase-thrift start
Once these were running, I successfully connected to my Zeppelin Notebook where I am noticing this error. Something peculiar that I noticed is that if I start Zeppelin last, the service actually fails to start. I am wondering if the issue is related to this phenomenon. Does anyone know how to resolve this error?
The tutorial I am trying to follow can be found at the below link (for reproducibility):
http://www.sunlab.org/teaching/cse8803/fall2016/lab/env-docker/
Error:
java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.thrift.transport.TSocket.open(TSocket.java:182) at org.apache.zeppelin.interpreter.remote.ClientFactory.create(ClientFactory.java:51) at org.apache.zeppelin.interpreter.remote.ClientFactory.create(ClientFactory.java:37) at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:60) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:861) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) at org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess.getClient(RemoteInterpreterProcess.java:139) at org.apache.zeppelin.interpreter.remote.RemoteInterpreter.init(RemoteInterpreter.java:129) at org.apache.zeppelin.interpreter.remote.RemoteInterpreter.getFormType(RemoteInterpreter.java:257) at org.apache.zeppelin.interpreter.LazyOpenInterpreter.getFormType(LazyOpenInterpreter.java:104) at org.apache.zeppelin.notebook.Paragraph.jobRun(Paragraph.java:198) at org.apache.zeppelin.scheduler.Job.run(Job.java:169) at org.apache.zeppelin.scheduler.RemoteScheduler$JobRunner.run(RemoteScheduler.java:322) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

Raspberry Pi 2 GPSD Not Running

I am following this tutorial to hook up Adafruit's Ultimate GPS Breakout to my Raspberry Pi 2. I have carefully read each step.
When I run gpsmon /dev/ttyUSB0, it displays expected output with my location, speed, etc. When I run cgps -s, however, I get this message cgps: no gpsd running or network error: -4, can't create socket.
The really weird thing is that the GPSD seems to be failing. Here is me trying to start it:
pi#raspberrypi:~$ sudo service gpsd status
[FAIL] gpsd is not running ... failed!
pi#raspberrypi:~$ sudo service gpsd restart
[ ok ] Restarting GPS (Global Positioning System) daemon: gpsd.
pi#raspberrypi:~$ sudo service gpsd status
[FAIL] gpsd is not running ... failed!
pi#raspberrypi:~$ sudo service gpsd start
pi#raspberrypi:~$ sudo service gpsd status
[FAIL] gpsd is not running ... failed!
So, it is apparent that cgps is failing because GPSD is not starter. Any suggestions to get GPSD working?
EDIT
When I run sudo gpsd -N -D3 -F /var/run/gpsd.sock, I get this output:
gpsd:INFO: launching (Version 3.6)
gpsd:ERROR: can't bind to IPv4 port gpsd, Cannot assign requested address
gpsd:ERROR: can't create IPv6 socket
gpsd:DATA: command sockets creation failed, netlib errors -1, -1
Late answer. However I just bumped into this problem and found that my /etc/network/interfaces didn't exist. Thusly there was no loopback interface present. If interfaces doesn't exist, try creating it by running sudo nano /etc/network/interfaces and add:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
(Or as it suits your setup.)
Then run ifup -a and check if there's a new interface by running ifconfig. It should be somewhat like:
eth0 Link encap:Ethernet HWaddr b8:27:eb:16:bc:52
[...]
lo Link encap:Local Loopback
[...]
Hope it works for others as well.
For unrelated reasons, I reimaged my Pi, and the gps module is now working as expected. I don't know what was wrong last time, but it is working now.