disnix icon indicating copy to clipboard operation
disnix copied to clipboard

Can't get disnix to work on Ubuntu 14.04 LTS

Open matthiasbeyer opened this issue 8 years ago • 3 comments

So I installed things on a Ubuntu 14.04 LTS VM:

sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install htop curl -y

curl https://nixos.org/nix/install | sh
. /home/clouduser/.nix-profile/etc/profile.d/nix.sh

nix-env -i $(nix-build -E 'with import <nixpkgs> {}; dysnomia.override { jobTemplate = "direct"; }')
nix-env -f '<nixpkgs>' -iA disnix

sudo cp /nix/var/nix/profiles/default/etc/dbus-1/system.d/disnix.conf /etc/dbus-1/system.d/
sudo cp /nix/var/nix/profiles/default/share/doc/disnix/disnix-service.initd /etc/init.d/

sudo mv /etc/init.d/disnix-service.initd /etc/init.d/disnix
sudo chmod +x /etc/init.d/disnix

osrel() {
    cat /etc/os-release | grep -E "$1"
}

if [[ $(osrel "^NAME=" | grep Debian) ]]; then
    sudo systemctl daemon-reload
elsif [[ $(osrel "^NAME=" | grep Ubuntu) ]]; then
    if [[ $(osrel "^VERSION_ID" | cut -d "=" -f 2) =~ '"14.04"' ]];
    then
        sudo initctl reload-configuration
    else
        echo "NOT SUPPORTED: $(osrel "^VERSION_ID")"
        exit 1
    fi
fi


for n in 2 3 4 5; do
    sudo ln -s /etc/init.d/disnix-service.initd /etc/rc${n}.d/S06disnix-service;
done

sudo vim /etc/dbus-1/system.d/disnix.conf
sudo vim /etc/init.d/disnix

sudo chmod a+w /var/run
sudo /etc/init.d/disnix start
sudo /etc/init.d/disnix status

echo "DONE"

And it seems that the call to sudo /etc/init.d/disnix start somehow failed (status returns nothing and gives exit code 3).

@svanderburg thinks that the dbus name gets lost somewhere.

With this patch applied (git diff):

diff --git a/src/dbus-service/disnix-service.c b/src/dbus-service/disnix-service.c
index 288d7b9..c279524 100644
--- a/src/dbus-service/disnix-service.c
+++ b/src/dbus-service/disnix-service.c
@@ -84,6 +84,12 @@ static void on_name_acquired(GDBusConnection *connection, const gchar *name, gpo
 static void on_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
     g_printerr("Name lost: %s\n", name);
+
+       if (connection == NULL)
+               g_printerr("No D-Bus connection has been established!\n");
+       else
+               g_printerr("A D-Bus connection seems to have been established!\n");
+
     exit(1);
 }

I get the following output:

$ ./result/bin/disnix-service 
The Disnix service is running!
Name lost: org.nixos.disnix.Disnix
A D-Bus connection seems to have been established

So at least something seems to work.

I'm not sure where the actual error is located, though.

matthiasbeyer avatar Apr 07 '16 15:04 matthiasbeyer