Obexd daemon not running - bluetooth

I am trying to run obexd as daemon during system startup but when i try to run it manually i get below problem:
obexd[5139]: obexd daemon 0.44
Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS
_SESSION_BUS_ADDRESS instead
obexd[5139]: manager_init failed
Please let me know the solution for this.

i was able to solve following problem using below statement to configure dbus path
export DBUS_SESSION_BUS_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"

Related

Running a systemd service without sudo privileges

I have a PC that transmits log data over a TCP/IP socket to a Raspberry Pi. I have written a python server program that runs on the Pi, so that when certain keywords are encountered, it has to play the corresponding audio track - this is a gist of the problem I'm currently working on.
Now, I want this server program to run as soon as the Raspberry Pi boots up, and so I wrote a systemd service to enable that. Assuming my server code is named as server.py, my service file looks as follows:
[Unit]
Description=Python Server
[Service]
# Command to execute when the service is started
ExecStart=/usr/bin/python3 -u /usr/bin/server.py
[Install]
WantedBy=multi-user.target
I make this server program executable, and I don't face any issues to start and enable the service (verified by rebooting the Pi as well). Now, taking a step back, I play the audio track on the python server program using the following lines (a little snippet):
import subprocess
subprocess.run(["cvlc", "~/Downloads/doors.wav"])
No errors here, all good. But when the service that runs the server program is started, when the specific keyword is encountered, the audio track does not play - it shows an error:
: [00005565470df480] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
: [0000556547157310] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $D
: [0000556547157310] main interface error: no suitable interface module
: [000055654700c570] main libvlc error: interface "dbus,none" initialization failed
: [0000556547101460] main interface error: no suitable interface module
: [000055654700c570] main libvlc error: interface "globalhotkeys,none" initialization failed
: [0000556547101460] dummy interface: using the dummy interface module...
: [00007f5f98c0b610] idummy demux: command `quit'
This same error shown above occurs when I try to play the audio from the command line with sudo, that is:
cvlc ~/Downloads/doors.wav
which led me to believe that if the service is enabled, then the whole python program corresponding to the service is run with sudo privileges automatically, even if I don't intend that to happen. I did a little bit of digging, but based on what I understand, to run the service, sudo privilege is necessary. I was not able to find a solution to run vlc with sudo, although I understand that ideally sudo privileges should not be given to something such as vlc. Is there a way around this?
This is happening because the PulseAudio server runs under your user, not as root. The service you are starting runs as root and tries to connect to root's PulseAudio server.
You can run specify which user/group to run the service as under the [Service] section with the User and Group directives.
You can also run the service as your user like this:
$ systemctl start --user <service>.service

Enabling systemd service with preseed

I'm trying to enable serial-getty#ttyS0.service to output getty to serial console as well as tty0.
I have tried running systemctl enable serial-getty#ttyS0 but I suspect that systemd might not be running when late_command is running.
Then I tried making the symlink manually with ln -s /lib/systemd/system/serial-getty#.service /etc/systemd/system/getty.target.wants/serial-getty#ttyS0.service and after the install getty.target.wants only contains getty#tty1.service.
I can't use console=tty0 console=ttyS0,115200n8 kernel parameter because then messages from the init system and the system logger will only appear on the first serial port and I want them to appear on tty0.
Does anyone have any experience or any idea on how to enable services in preseed config?
Thanks.

Neo4j Server running problems on Linux

I am using Neo4j 2.0.3 Community server by installing it on my linux system (by unzipping the tar.gz). I got this error while I tried to start the server
WARNING! You are using an unsupported Java runtime.
process [50690]... waiting for server to be ready.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
I checked for the solution for this and came to know that /usr/sbin had to be added to the path. On doing so and restarting the server, I got the following message
Another server-process is running with [40903], cannot start a new one. Exiting.
However, when I run the command neo4j staus , it says
Neo4j Server is not running
Can anybody please help me with how should I get started with it?
This is very late, but might help others.
If it tells you this, and you check that process id with, for example, ps aux | grep 40903, and it's not neo4j, the problem might be that the port is being used.
By default neo4j uses 7474, but can change this on the neo4j folder /conf/neo4j-server.properties and that was my problem, I had set the port to '22' which was being used. SO make sure it is set to a port that is open and available.
Hope this helps.
You might want to examine the startup script.
Another server-process is running with [40903], cannot start a new one. Exiting.
indicates (me to) that there might be a pid file (or the script uses them) which was written and is checked before attempting to start a new instances. This the normal thing to do.
I think you need to kill the other process using kill
You can see this answer for how to kill the process:
https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
Otherwise, restarting the operating system will also do the job. For me, I normally start neo4j in the console, as in ./neo4j console. This makes it easier to stop the process.

gnome-desktop docker image works with Linux Mint Host but not CentOS?

I'm using this docker imagine from the docker repo: traxtopel/docker-centos-gnome-desktop
https://index.docker.io/u/traxtopel/docker-centos-gnome-desktop/
I have a Linux Mint system with Docker 0.9.0 installed that can run the image and launch vncserver with a gnome-session without any problems.
However, when I run the same image on my CentOS6 system (also docker version 0.9.0) and attempt to launch a gnome-session I get the following:
Failed to start message bus: Failed to open "/etc/selinux/targeted/contexts/dbus_contexts": No such file or directory
EOF in dbus-launch reading address from bus daemon
I also tried to launch a gnome-terminal which works in the Linux Mint host but produces the following on my CentOS6 host.
Failed to get the session bus: /bin/dbus-launch terminated abnormally with the following error: EOF in dbus-launch reading address from bus daemon
Falling back to non-factory mode.
Failed to summon the GConf demon; exiting. Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: /bin/dbus-launch terminated abnormally with the following error: EOF in dbus-launch reading address from bus daemon
)
Since both docker versions are the same, and they are using the same docker image, my only guess is it has to do with the hosts kernel version or possibly the hosts selinux configuration.
Linux Mint Kernel: 3.8.0-19-generic
CentOS6 Kernel: 2.6.32-431.5.1
Any ideas what is causing this behavior?
Looks like the issue has something to do with selinux. I don't have all the details or a "proper" fix but the Linux Mint system was not running selinux while the CentOS6 system was.
I had initially ruled this out since when selinux is put into permissive mode the same behavior occurs. Disabling selinux entirely and rebooting the host system fixes the issue though.
Trying to determine the root cause, I ran selinux in permissive mode and tailed the /var/log/audit/audit.log file however nothing is written out to the log concerning this issue when gnome-terminal or gnome-session is run from the docker image.
If anyone has any better solutions please post however it seems a solution is to disable selinux on the host system.

Erlang: daemon 'init.d' script fails to start

I have a python script which manages an Erlang daemon. Everything works fine when used through a shell once the system is initialized.
Now, when I included the same script under "/etc/init.d" and with the symlinks properly set in "/etc/rcX.d", the python script still works but my Erlang daemon fails to start and leaves no discernible traces (e.g. crash_dump, dmesg etc.)
I also tried setting the environment variable "HOME" through 'erl -env HOME /root' and still no luck.
Any clues?
To manually run the script the same way the system does, use service daemon start if you have that command, or else try
cd /
env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" /etc/init.d/daemon start
That forces the script to run with a known, minimal environment just like it would at startup.
Thanks for this answer - I was having a devil of a time starting the "Alice" RESTful interface to rabbitmq on startup. The key was using 'env HOME=/root /path/to/alice/startup/script' in my init script.

Resources