Update dbus on Raspberry Pi - raspberry-pi

I need to update DBus on my Raspberry Pi, in order to upgrade to the latest Bluez version (and I hope for performance benefits). I can't use a package install, as the latest packaged version is old, so I "configure/make/make install".
The problem with this is that it appears to install alongside the old version, but in a different directory. So, if I run dbus-daemon --version, I see the old version number following the install.
The original version (and launch path) is /usr/bin, whereas my install is going to /usr/arm-linux-gnueabi/bin. I did try editing the path for launch in /lib/systemd/system/dbus.service, but after this, Linux failed to start.
So now I have two versions of dbus on my Pi, with the old one booting.
Any help would be greatly appreciated.

Here is what I did to successfully have D-Bus 1.10.18 on my Raspberry Pi 3 with Raspbian Jessie Lite Fresh (release 2017-04-10) :
[I use aptitude instead of apt-get. You can substitute one by another.]
sudo aptitude install -y libapparmor1
cd ~
wget http://ftp.fr.debian.org/debian/pool/main/d/dbus/libdbus-1-3_1.10.18-1_armhf.deb
sudo dpkg --auto-deconfigure -i libdbus-1-3_1.10.18-1_armhf.deb
wget http://ftp.fr.debian.org/debian/pool/main/d/dbus/dbus_1.10.18-1_armhf.deb
sudo dpkg -i dbus_1.10.18-1_armhf.deb
sudo reboot
and after reboot :
pi#RasPi3-Tests:~ $ dpkg -l dbus
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom Version Architecture Description
+++-=======================-================-================-===================================================
ii dbus 1.10.18-1 armhf simple interprocess messaging system (daemon and ...
and :
pi#RasPi3-Tests:~ $ dbus-daemon --version
D-Bus Message Bus Daemon 1.10.18
Copyright (C) 2002, 2003 Red Hat, Inc., CodeFactory AB, and others
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Before answering your question, share the failure log from "journalctl -xe" or "systemctl status dbus". Following might solve your problem,
Make sure to stop the dbus before update it. "systemctl stop dbus"
systemctl daemon-reload (Needs to run after changing service file of any daemon)
Start dbus again, systemctl start dbus.
check the binary path available in "echo $PATH", if not, export it. In your case, export PATH=/usr/arm-linux-gnueabi/bin:$PATH should help
Note: Many applications will stop working when you stop dbus.

sudo apt-get install python3-dbus

Related

What does it mean to have a "masked" clickhouse-server?

I am new to clickhouse.
After several unfruitful attempts to install version 18.16.1, I purged both clickhouse-server and clickhouse-client (sudo dpkg --purge clickhouse-server and sudo dpkg --purge clickhouse-common).
After I made sure that sudo apt --fix-broken install did not return any error message, I went over and installed both the client and server using apt: sudo apt install clickhouse-server clickhouse-client.
Upon installation I received the following warning:
dpkg: warning: clickhouse-server: conffile
'/etc/systemd/system/clickhouse-server.service' is not a plain file or
symlink (= '/dev/null')
Trying service clickhouse-server status returned:
● clickhouse-server.service
Loaded: masked (Reason: Unit clickhouse-server.service is masked.)
Active: inactive (dead)
What does it mean to have a masked service? I found this post on AskUbuntu, but it seems specific to PostgreSQL. Am I OK to implement the solution provided in there to "unmask" the clickhouse service?
Not related to CH. Related to https://en.wikipedia.org/wiki/Systemd.
https://medium.com/#codingmaths/service-masking-in-linux-f7265d9b2181
mask is a stronger version of disable. Using disable all symlinks of the specified unit file are removed....
Denny Crane was right.
You need to run the following commands
systemctl unmask clickhouse-server
systemctl start clickhouse-server

How to disable Nouveau kernel driver on CentOS

I am installing CUDA on my GPU machines. While at it, I need to disable Nouveau Kernel Driver.
I did find a solution here: https://askubuntu.com/questions/841876/how-to-disable-nouveau-kernel-driver
But update-initramfs is not found on CentOS.
I am looking for an equivalent of sudo update-initramfs -u in CentOS
If your goal is to install the latest nvidia driver to run with cuda. The best way to disable nouveau is indeed to rebuild the initramfs, as written by Gediz. Since, as spotted here (https://forums.centos.org/viewtopic.php?t=68800), it is only a 5 steps process I think it deserves to be right here :
grubby ––update-kernel=ALL ––args="rd.driver.blacklist=nouveau nouveau.modeset=0"
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
echo "blacklist nouveau" > /etc/modprobe.d/nouveau-blacklist.conf
dracut /boot/initramfs-$(uname -r).img $(uname -r)
reboot
I believe Nouveau driver can be easily unloaded using modprobe:
modprobe -r nouveau
Also there is an option -b which blacklists it.
-b, --use-blacklist Apply blacklist to resolved alias.
In the web address you attached there is :
option nomodeset
I guess it is a kernel option not to load !ANY display drivers.You wont always need to update initramfs, only if module is included in initramfs you need to update it.
You can check it using one of initramfs-tools by :
lsinitramfs /boot/initrd.img-4.9.0-5-amd64 |less
However if you need to update or rebuild initramfs there is a way shown in CentOs Wiki :
https://wiki.centos.org/TipsAndTricks/CreateNewInitrd

Connect BLE devices with Raspberry pi 3 B

I know this is not the first time this question was asked but after trying every thing I could during a week, I still have problems.
I'm trying to connect to my Raspberry pi to BLE devices. I can scan them but not connect to them.
The last explanation I have followed was this github issue: https://github.com/ukBaz/python-bluezero/issues/30
And here is all the commands I have done to try to update bluez and make this connection works.
###Install RASPBIAN JESSIE LITE
2017-01-11-raspbian-jessie-lite.img
###Updates
$ sudo apt-get update
$ sudo apt-get upgrade
###Add libs
$ sudo apt-get install bluetooth bluez-tools build-essential autoconf glib2.0 libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev git
###Get bluez-5.43
$ wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.43.tar.xz
$ tar xf bluez-5.43.tar.xz
$ cd bluez-5.43
###Patch bluez
$ wget https://gist.github.com/pelwell/c8230c48ea24698527cd/archive/3b07a1eb296862da889609a84f8e10b299b7442d.zip
$ unzip 3b07a1eb296862da889609a84f8e10b299b7442d.zip
$ git apply -v c8230c48ea24698527cd-3b07a1eb296862da889609a84f8e10b299b7442d/*
###Install bluez
$ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental --enable-maintainer-mode
$ make -j 4 && sudo make install
### Add to /etc/dbus-1/system.d/bluetooth.conf
<!-- allow users of bluetooth group to communicate -->
<policy group="bluetooth">
<allow send_destination="org.bluez"/>
</policy>
$ sudo usermod -G bluetooth -a $USER
$ sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/' /lib/systemd/system/bluetooth.service
$ sudo systemctl daemon-reload
$ sudo service bluetooth restart
$ service bluetooth status
$ sudo reboot
$ sudo hcitool lescan
LE Scan ...
XX:XX:XX:XX:XX:XX (name)
$ gatttool -b XX:XX:XX:XX:XX:XX -I
[XX:XX:XX:XX:XX:XX][LE]> connect
Attempting to connect to XX:XX:XX:XX:XX:XX
Error: connect error: Transport endpoint is not connected (107)
$ gatttool -b XX:XX:XX:XX:XX:XX -t random -I
[XX:XX:XX:XX:XX:XX][LE]> connect
Attempting to connect to XX:XX:XX:XX:XX:XX
Error: connect error: Connection refused (111)
Thank you for your help
Edit for Constantin Chabirand's answer
$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
Active: active (running) since Tue 2017-01-17 21:17:07 UTC; 1min 51s ago
Docs: man:bluetoothd(8)
Main PID: 587 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─587 /usr/libexec/bluetooth/bluetoothd --experimental
$ bluetoothctl
[NEW] Controller B8:27:EB:FD:93:2B raspberrypi [default]
[bluetooth]# scan on
Discovery started
....
[bluetooth]# scan off
[bluetooth]# connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
Failed to connect: org.bluez.Error.Failed
Edit 2
After reinstalling with the simple solution:
$ bluetoothctl -v
5.43
$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
Active: active (running) since Wed 2017-01-18 15:46:53 UTC; 3min 37s ago
Docs: man:bluetoothd(8)
Main PID: 586 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─586 /usr/local/libexec/bluetooth/bluetoothd --experimental
$ sudo bluetoothctl
[bluetooth]# connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
Failed to connect: org.bluez.Error.Failed
Thank's to Constantin Chabirand, I made it work. I needed a few more command lines to make it work and I needed to change the advertising frequency of my BLE device (I still need to do some tests on that).
Here is the exact commands I used to install bluez on my rpi3 and connect to BLE devices:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.43.tar.xz
tar xf bluez-5.43.tar.xz
cd bluez-5.43/
./configure
make
sudo make install
sudo reboot
# check version
bluetoothctl -v
sudo nano /lib/systemd/system/bluetooth.service
# Add --experimental to this lane
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sudo hciconfig hci0 up
sudo reboot
sudo usermod -G bluetooth -a pi
sudo reboot
That's it. Thank's again for your help.
What is the result of the bash command systemctl status bluetooth ?
Can you start bluetoothctl (just type it in your shell) ?
I also use a raspberry pi 3 to connect to BLE devices and I don't need a patch. Start a fresh install with bluez5.43 and post the results of the two commands I've written
UPDATE
For the installation I did it the simplest way I could. I followed the "The simplest way to compile this package is:" section in the INSTALL file which is :
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.43.tar.xz
tar xf bluez-5.43.tar.xz
cd bluez-5.43.tar.xz
./configure
make
make install
Did you succesfully connect to your BLE device using something else ? Like a smartphone ? There are applications out there that can read gatt atrributes.
UPDATE 2
I did not remove a thing. Merely installed bluez5.43 on top of the rest. When I run
bluetoothctl -v it returns : 5.43.
When I run apt list --installed is can see the following packages installed automatically :
bluez/stable,now 5.23-2+rpi2 armhf [installed,automatic]
bluez-firmware/stable,now 1.2-3+rpi1 all [installed,automatic]
bluez-obexd/stable,now 5.23-2+rpi2 armhf [installed,automatic]
bluez-tools/stable,now 0.2.0~20140808-3 armhf [installed]
As you can see I still have the old version installed.
I needed to install the bluez-5.43 to get around bugs in the default bluez-5.23 when using bluetoothctl from scripts.
You could probably install the binary version from stretch, but my experience is that you often run into other dependencies.
I had the same problem under Ubuntu-16.04 and used the deb-src package from Ubuntu-Zesty, to fix that. Since this is just a debian package I used this on the Raspberry pi too, worked fine when using a USB-bluetooth dongle. To make this work on the RPI-3, which has its bluetooth controller attached via a serial line, you need to install the ../issue/30 patches too.
The advantage of doing it this way, is that once your Raspbian will contain a newer bluez version it will replace what we do here, and if you got more raspbian system you of course only need to install the generated .deb packages
This is what I did (handsfree):
#!/bin/bash
sudo apt-get install devscripts debhelper dh-autoreconf flex bison libdbus-glib-1-dev libglib2.0-dev libcap-ng-dev libudev-dev l
ibreadline-dev libical-dev check dh-systemd libebook1.2-dev
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43.orig.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43-0ubuntu1.debian.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43-0ubuntu1.dsc
tar xf bluez_5.43.orig.tar.xz
cd bluez-5.43
tar xf ../bluez_5.43-0ubuntu1.debian.tar.xz
# install patches relevant for rpi-3 bluetooth
. /etc/os-release
if [ $ID = raspbian ]; then
wget https://gist.github.com/pelwell/c8230c48ea24698527cd/archive/3b07a1eb296862da889609a84f8e10b299b7442d.zip
cd debian/patches
unzip ../../3b07a1eb296862da889609a84f8e10b299b7442d.zip
for i in c8230c48ea24698527cd-3b07a1eb296862da889609a84f8e10b299b7442d/*;do
mv $i .
basename $i >> series
done
rmdir c8230c48ea24698527cd-3b07a1eb296862da889609a84f8e10b299b7442d
cd ../..
fi
# end of Raspian related patches
debchange --local=~lorenzen 'Backport to Xenial'
debuild -b -j4
cd ..
sudo dpkg -i *.deb
This would should work under other Debian derived systems too,
https://askubuntu.com/a/884062/655086
I faced the same problem that connecting and playing BLE devices with Raspberry Pi 3 built-in Bluetooth. First of all, I learned how to play and control a tool of bluetoothctl in virtue of below webpage.
[https://mcuoneclipse.com/2016/12/19/tutorial-ble-pairing-the-raspberry-pi-3-model-b-with-hexiwear/][1]
In this tutorial, after successful connection with your BLE devices, you can work with an attribute that you want to play with.
For example, if you want to work with the attribute of Bluetooth UART TX or RX, you just need to input commands below, then read or write a value of that attribute of characteristic.
list-attributes 00:34:40:0A:00:4E
select-attribute /org/bluez/hci0/dev_00_32_40_08_00_12/service0026/char0027
read
write
If there is anyone who is fully aware of creating bluetooth connecting between Raspberry Pi 3 built-in BLE with Arduino Ble, Please share your knowledge. ;)

Setup issues using the hw watchdog with systemd

I'm trying to create a post using the hardware watchdog on a Raspberry Pi running Jessie. I have created a post on the raspberry Pi forum, but up until now no replies with help.
Rather than repeating everything here, this is the link with my setup woes.
Raspi Forum post
The setup procedure is complicated, awkward, poorly documented and confusing. I would like to solicit help to get it right, or pointers to where I should direct a bug report. (watchdog itself works, so does systemd, where do I go for these integration issues?)
Thanks!
Paulv's link and post explains how to do this - check it out for explanations and more info.
If you just want the setup do this:
Install the watchdog package
sudo apt-get install watchdog
Add a line to the watchdog service file
sudo nano /lib/systemd/system/watchdog.service
insert after [install]
WantedBy=multi-user.target
Enable on boot
sudo systemctl daemon-reload
sudo systemctl enable watchdog
Reboot and check status
sudo systemctl status watchdog
I'd repeat what Paulv said, and I think you will also need to enable the Broadcom watchdog module (bcm2835_wdt) in modules:
sudo modprobe bcm2835_wdt
echo "bcm2835_wdt" | sudo tee -a /etc/modules

Pi 3 + Microstack GPS communication

I bought a Raspberry Pi 3 Model B, a microstack baseboard and a microstack GPS.
I followed the instructions written in the official documentation but I can't connect to the GPS.
Basically, the GPS led flashes so it means it has find a gps fix, but I can't see any data from the PI.
For example, if I try
cat /dev/ttyAMA0
I get always nothing. I already used raspi-config to disable kernel serial and to enable i2c and spi.
Also if I try
stty -F /dev/ttyAMA0 ispeed 4800 && cat </dev/ttyAMA0"
I get an error.
Anyone has any advice, please?
Or maybe these modules are not compatible with Pi 3?
Thanks a lot!
It's hard telling what has been done, or not done. The 'official' documentation from Microstack provides two methods of setting up the serial port. It then continues with
Automatically Starting gpsd
To automatically start the gps service when the Raspberry Pi® boots, re­configure the GPS
daemon by typing into a terminal
sudo dpkg-­reconfigure gpsd
● Choose <yes> when asked if you want to start gpsd automatically.
● Choose <no> when asked “should gpsd handle attached USB GPS
receivers automatically” .
● When asked which “Device the GPS receiver is attached to” , enter
/dev/ttyAMA0 .
● Accept the defaults for other options.
If you have configured your serial port as per instructions and configured gpsd to automagically start and pick up the device you have just setup, ...then, since the gpsd is handling the device (right?), the device will be busy and the command cat /dev/ttyAMA0 should return cat: /dev/ttyAMA0: Device or resource busy...but, it did not.
Either the serial is not configured as per instructions, or the gpsd is not running and picking up the device, or both.
The goal is not to cat your gps data, but the cat not returning an error indicates something is amiss.
Typically, it's just a typo. But it can be from skipping a step in the process, or mixing instructions from various sources so that the left hand doesn't know what the right hand has done.
Try:
sudo killall gpsd if it returns gpsd: no process found that answers one question.
If it returns with no error, follow it up with cat /dev/ttyAMA0. If it returns nothing, the direction you should look is your serial port configuration.
If sudo dpkg-reconfigure gpsd is not allowing you to reconfigure (I thought it was just me) you can modify the configuration of gpsd by using your favourite editor, e.g. sudo nano /etc/default/gpsd and entering something like:
# Default settings for the gpsd init script and the hotplug wrapper.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyAMA0"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n -G"
You may find the -n and -G useful. Save and restart.
I finally found a solution:
On the Pi 3, there are more steps to use serial, you have to disable the BT.
Edit config file:
sudo nano /boot/config.txt
Add this at the bottom:
dtoverlay=pi3-disable-bt-overlay
Then run this:
sudo systemctl disable hciuart
This article was very usefull for me
http://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/#comment-67160
and i recommand you to read it
Now on RPI3 the Serial port
ttyAMA0 is used by BlueTooth
ttySO refers to the GPIO
The Alias Serial0 refers to the GPIO both on RPI2 and RPI3.
So :
after a reinstallation of Jessie with a recent version to be sure all is clean
as usual
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo raspi-config
go to Advanced options : Would you like a login shell to be accessible over serial? response "yes" (not as in the microstack datasheet )
$ sudo apt-­get install python3-­microstacknode
To install the gpsd standard tools
$ sudo apt­-get install gpsd gpsd-­clients python­-gps
edit GPSD by
$ sudo nano /etc/default/gpsd
and put the options :
START_DAEMON="true"
USBAUTO="false"
DEVICES="/dev/serial0"
GPSD_OPTIONS="-n -G"
equally
$ sudo nano /boot/cmdline.txt
remove
console=serial0,115200
and save
$ sudo nano /boot/config.txt
you must have at the end
enable_uart=1
Disable the console by
$ sudo systemctl stop serial-getty#ttyS0.service
$ sudo systemctl disable serial-getty#ttyS0.service
i have equally done $ sudo chmod 775 ../../dev/ttySO ( i dont know if it is really necessary )
and obviously a reboot
and miracle the gps works with
cgps -s
NB: you must have a fix on the GPS ( the red led flashes )
jpherrenknecht