Problems snapping new nextcloud desktop sync client

I’m trying to create a snap out of the new nextcloud desktop sync client:

The snapcraft.yaml that I’m creating is here:

It compiles:

And installs OK but when trying to launch it from the command line (still no .desktop), I get this errors:

$ nextcloud-client
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.nextcloud-client', please create it with 0700 permissions.
Qt: Session management error: Could not open network socket
nextcloud.gui.application: Migrating old config from "/home/pachulo/snap/nextcloud-client/x2/.local/share/data//Nextcloud" to "/home/pachulo/snap/nextcloud-client/x2/.config/Nextcloud/"
nextcloud.gui.application: Failed to move the old config file to its new location ( "/home/pachulo/snap/nextcloud-client/x2/.local/share/data//Nextcloud" to "/home/pachulo/snap/nextcloud-client/x2/.config/Nextcloud/" )
Avortat (s'ha bolcat la memòria)

Any ideas? Thanks!

Perhaps create this directory in a launcher script?

Probably requires connecting to the network interface.

Something like the one used in vscode? https://github.com/snapcrafters/vscode/blob/master/files/bin/electron-launch

1 Like

Is this different from https://snapcraft.io/nextcloud-client ?

If I understood it correctly this is the new implementation. It used to be a theme for the owncloud sync client:

The snapcraft to create the snap that you talk about is in there but now the repo is archived, so no changes can be done to it; they are working here now:

To add stuff like end2end encryption support:

But is still in beta state:

So I wanted to try to snap it.

Indeed, the client_theming repo is dead, and that’s what the nextcloud-client snap is currently. Thank you for undergoing the effort to snap the new version, @pachulo! I’m not sure about that XDG_RUNTIME_DIR error, though… kinda feel like the desktop helpers should be creating it if they’re what define it. Unfortunately I don’t know much about how that works. @Trevinho, we could use your insight here if you’re able.

The command: configurations don’t include the desktop-launch wrapper. @pachulo, you might benefit from adding those:

    command: desktop-launch snapcraft-preload nextcloud

Also, are you certain you need snapcraft-preload?

Well, that was pretty dumb from my side…I based of the old client and it was not using desktop-launch so I forgot to add it. Thanks for noticing it!!

The same here, the old snap was using it, so I just kept it.

I’ve modified the snap:
https://github.com/pachulo/desktop/commit/de220ce28d7c9872298b20aedde1cd34c57d5e81
and will see if it solves something.

1 Like

Well, I’ve tried it and now I only get these errors:

$ nextcloud-client
Qt: Session management error: None of the authentication protocols specified are supported
Avortat (s'ha bolcat la memòria)

How can I debug this?

Forgot to mention that with snappy-debug.security scanlog I was only seeing this:

= AppArmor =
Time: Oct 14 18:25:57
Log: apparmor="DENIED" operation="ptrace" profile="snap.nextcloud-client.nextcloud-client" pid=7219 comm="nextcloud" requested_mask="trace" denied_mask="trace" peer="unconfined"
Ptrace: peer=unconfined (trace)
Suggestions:
* adjust program to not trace processes
* do nothing if program otherwise works properly

I’ve tried to create the snap with the system-observe interface and connected it, but it fails with the same error, so I guess is not related to the sandbox…

Well, I’ve been doing some more research and I think that the problem could be related to the -DCMAKE_INSTALL_LIBDIR config flag:


When using -DCMAKE_INSTALL_LIBDIR=/usr I see this in the buildlog:

Install the project...
-- Install configuration: "Debug"
-- Installing: /build/nextcloud-client/parts/client/install/etc/Nextcloud/sync-exclude.lst
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/nextcloud/libocsync.so.2.5.0
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/nextcloud/libocsync.so.0
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/nextcloud/libocsync.so
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/account.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/syncengine.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/configfile.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/networkjobs.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/progressdispatcher.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/syncfileitem.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/mirall/syncresult.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/creds/abstractcredentials.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/include/nextcloudsync/creds/httpcredentials.h
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/libnextcloudsync.so.2.5.0
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/libnextcloudsync.so.0
-- Installing: /build/nextcloud-client/parts/client/install/usr/lib/libnextcloudsync.so
-- Set runtime path of "/build/nextcloud-client/parts/client/install/usr/lib/libnextcloudsync.so.2.5.0" to "/usr//usr/lib/nextcloud"
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/1024x1024/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/128x128/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/16x16/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/22x22/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/256x256/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/32x32/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/48x48/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/512x512/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/share/icons/hicolor/64x64/apps/Nextcloud.png
-- Installing: /build/nextcloud-client/parts/client/install/usr/bin/nextcloud
-- Set runtime path of "/build/nextcloud-client/parts/client/install/usr/bin/nextcloud" to "/usr//usr/lib/nextcloud"
...

I think that /usr//usr/lib/nextcloud doesn’t make a lot of sense, but I’m not really sure how to set it the -DCMAKE_INSTALL_LIBDIR to a value that makes the application work, or even if that’s my problem at all.

I’ve tried with -DCMAKE_INSTALL_LIBDIR=/ but that gave me an error when building…also without setting the config flag at all, but with no success…

Any ideas?

Thanks!!

I believe CMAKE_INSTALL_LIBDIR is relative to CMAKE_INSTALL_PREFIX and cannot accept a fully-qualified path. Try just -DCMAKE_INSTALL_LIBDIR=lib or omit it completely.

OK, you were right @lucyllewy, now I can see stuff like this:

-- Set runtime path of "/build/nextcloud-client/parts/client/install/usr/lib/libnextcloudsync.so.2.5.0" to "/usr/lib/nextcloud"

In the buildlog, but the resulting snap crashes as before:

$ nextcloud-client
Qt: Session management error: None of the authentication protocols specified are supported
propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.257\" (uid=1000 pid=1320 comm=\"nextcloud \" label=\"snap.nextcloud-client.nextcloud-client (enforce)\") interface=\"org.freedesktop.DBus.Properties\" member=\"GetAll\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1724 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.257\" (uid=1000 pid=1320 comm=\"nextcloud \" label=\"snap.nextcloud-client.nextcloud-client (enforce)\") interface=\"org.freedesktop.NetworkManager\" member=\"GetDevices\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1724 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
"Object path cannot be empty"
Avortat (s'ha bolcat la memòria)

And I ran out of ideas…:sweat:

use snappy-debug.security scanlog to see if those are covered by any current interfaces.

If I connect the network-manager extension:

$ sudo snap connect nextcloud-client:network-manager

I only see these errors (the second one is an Abort (memory dumped) error):

$ nextcloud-client
Qt: Session management error: None of the authentication protocols specified are supported
Avortat (s'ha bolcat la memòria)                 

And the only denial left is this one:

sudo snappy-debug.security scanlog
INFO: following '/var/log/syslog'. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug.security scanlog
kernel.printk_ratelimit = 0
= AppArmor =
Time: Oct 22 23:19:06
Log: apparmor="DENIED" operation="ptrace" profile="snap.nextcloud-client.nextcloud-client" pid=19358 comm="nextcloud" requested_mask="trace" denied_mask="trace" peer="unconfined"
Ptrace: peer=unconfined (trace)
Suggestions:
* adjust program to not trace processes
* do nothing if program otherwise works properly

But I also tried to use & connect the system-observe interface and the crash does not seem related…

Thanks again for you help!

I suspect the ptrace alert is a result of the SEGV, not the cause… It seems that the problem is unrelated to confinement, but could be either a broken compiled binary or an incompatible library was added somehow…

Well, after executing the snap with strace like this:

$ snap run --strace="-s512 -f" nextcloud-client

It seems that the problem is that it cannot find the QtWebEngineProcess executable inside the snap:

...
[pid  2982] stat("/usr/lib/x86_64-linux-gnu/qt5/libexec/QtWebEngineProcess", 0x7fff396e9ab0) = -1 ENOENT (No such file or directory)
[pid  2982] stat("/snap/nextcloud-client/x1/usr/bin/QtWebEngineProcess", 0x7fff396e9ab0) = -1 ENOENT (No such file or directory)
[pid  2982] rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
[pid  2982] rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
...

Because the path is wrong:

$ find /snap/nextcloud-client/x1/ -name QtWebEngineProcess
/snap/nextcloud-client/x1/usr/lib/x86_64-linux-gnu/qt5/libexec/QtWebEngineProcess

But I’m not really sure what is causing this.

P.D.
Could this also be related?
https://musescore.org/en/node/281322

Because then it’s maybe a problem with the libqt5webenginecore5 package and/or core18!

Just like to leave a note here: https://doc.qt.io/qt-5/qtwebengine-deploying.html#deploying-qt-webengine-processes

1 Like

OK, it seems that finally there’s a fix for this:

  1. This needs to be merged https://github.com/ubuntu/snapcraft-desktop-helpers/pull/188 (meanwhile I forked it an applied the fix: https://github.com/pachulo/snapcraft-desktop-helpers/commit/356dc11c0f374b3e30647d36554d4c4089670db5)
  2. This layout needs to be added to the snap:
layout:                                                                                                                                                                                                              
    /usr/share/qt5:                                                                                                                                                                                                  
        bind: $SNAP/usr/share/qt5

With this two pieces I get a working nextcloud-client snap! Now I have to clean it…