dbus_bus_request_name (): Connections are not allowed to own the service

Error on starting RIL daemon using dbus: “dbus_bus_request_name() failed (“Connection “connection_name” is not allowed to own the service “service_id” due to security policies in the configuration file”)”.

Solution

Make sure that access is granted in configuration file for user and group running the application

<!DOCTYPE busconfig PUBLIC 
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>
<policy user="user">
<allow own="service_id"/>
</policy>

<policy group="group">
<allow own="service_id"/>
</policy>

<policy context="default">
<allow send_destination="service_id"/>
<allow receive_sender="service_id"/>
</policy>

</busconfig>

Copy configuration file into /etc/dbus-1/system.d.

Read more

How to build and install cmocka?

Step into directory containing sources and create build sub-directory.

Step into build directory and execute

$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
$ make

Installing

$ sudo make install

Download cmocka

cmocka at GitHub

cmocka

How to create self-extracting script for Android?

This is useful for consistent updating RIL, applications and configuration file.

Idea is to add compressed binary at the end of executable shell script file.

Step 1

On the build machine create payload directory and copy files into it.

Step 2

Create script installer in that directory which should do installation of components on target platform.

Step 3

Move one level up from payload directory and create decompress script with following content:

#!/system/bin/sh
echo “”
echo “Self Extracting Installer”
echo “”

# Creates temporary directory.
export TMPDIR=`mktemp -d selfextract.XXXXXX`

# Searches for marker of beginning of binary data.
ARCHIVE=`sed -n ‘/^__ARCHIVE_BELOW__/=’ $0`

# Adds 1 to get next line after the marker.
let ARCHIVE=$ARCHIVE+1

# Extracts binary data into temporary directory.
tail -n+$ARCHIVE $0 | tar xv -C $TMPDIR

# Stores current directory, goes to the temporary
# directory and starts the install script.
CDIR=`pwd`
cd $TMPDIR
./installer

# Returns back and removes temporary directory.
cd $CDIR
rm -rf $TMPDIR

# Prevents executing binary data.
exit 0

# No extra lines should be added after the marker.
__ARCHIVE_BELOW__

Step 4

Create build script having following content:

#!/bin/sh
# Compresses payload data.
cd payload
tar cf ../payload.tar ./*
cd ..

if [ -e “payload.tar” ]; then
# Data aren’t compressed due to lack of gunzip on target platform.
# Concatenates the decompressing script with binary data.
cat decompress payload.tar > selfextract.bsx
else
echo “payload.tar does not exist”
exit 1
fi

echo “selextract.bsx created”
exit 0

Step 5

Execute build script. Make sure that selfextract.bsx file is created.

Step 6

Copy selfextract.bsx file to target device, change file mode by

# chmod 755 selfextract.bsx

and execute it by

# ./selfextract.bsx

Make sure that files were updated successfully.

Read in more details

Bash Self-Extracting Script

How to make a self-extracting shell script from a TAR archive

Use grep to report back only line numbers

Sed Command in Linux/Unix with examples

Alternative to awk

The main differences from the solution proposed in referenced articles are:

  • sed utility is used instead of awk because the latter is not included in Android distribution by default;
  • compressing by gzip is not used because gunzip utility is not included as well.

How to get debug output from pppd on Android-x86

Disable starting ppp as a service (comment corresponding lines in file /hardware/ril/rild/rild.rc)

service ril-daemon /system/bin/rild
    class main
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    user root
    group radio cache inet misc audio log readproc wakelock

#service ppp /system/bin/pppd call gprs
#    user root
#    group system radio
#    disabled
#    oneshot

and start pppd manually with redirecting stderr output

# pppd call gprs &>/data/misc/radio/pppd.log

Bash Reference Manual

Logcat command-line tool