"WallpaperDownloader" snap won't run in Solus OS or openSUSE

Hi all.

I’m having a problem with the last version of wallpaperdownloader snap. It is a Java-based application and it works flawlessly in Ubuntu (tested on 16.04 with Unity, 18.04 with GNOME, 17.10 wit MATE) and Arch Linux for example. Nevertheless, I’m having problems with the same snap (which is in the store) in Solus OS 3 and openSUSE so far. It won’t run because there is an exception. This is the log of the application and the expection thrown:

[23:20:17] INFO  WDConfigManager:70 - Checking configuration...
[23:20:17] INFO  WDConfigManager:71 - Checking application's folder
[23:20:17] INFO  PreferencesManager:49 - Creating PreferenceManager instance for the first time...
[23:20:17] INFO  PreferencesManager:65 - Setting user's configuration file path to /home/egarcia/snap/wallpaperdownloader/18/.wallpaperdownloader/config.txt
[23:20:17] INFO  WDConfigManager:75 - Checking downloads folder...
[23:20:17] INFO  WDConfigManager:235 - It has been detected that wallpaperdownloader application has been installed via snap package. Reconfiguring downloads directory just in case it is a new version and it is needed to move downloads directory to the new confinement space...
[23:20:17] INFO  WDConfigManager:249 - Downloads directory -> /home/egarcia/snap/wallpaperdownloader/18/.wallpaperdownloader/downloads
[23:20:17] INFO  WDConfigManager:279 - Checking blacklist directory...
[23:20:17] INFO  WDConfigManager:289 - Blacklist directory already exists. Skipping...
[23:20:17] INFO  WDConfigManager:294 - Retrieving operating system... Linux
[23:20:17] INFO  WDConfigManager:312 - Operating System detected: Linux
[23:20:17] INFO  WallpaperChanger:49 - Instanciating wallpaper changer...
[23:20:17] INFO  LinuxWallpaperChanger:54 - Checking XDG_CURRENT_DESKTOP environment variable. Value = Budgie:GNOME
[23:20:17] INFO  LinuxWallpaperChanger:88 - Desktop environment detected: GNOME3
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
	at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
	at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
	at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
	at sun.font.SunFontManager$2.run(SunFontManager.java:431)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.font.SunFontManager.<init>(SunFontManager.java:376)
	at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
	at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
	at sun.font.FontUtilities.getFontConfigFUIR(FontUtilities.java:485)
	at javax.swing.plaf.nimbus.NimbusDefaults.<init>(NimbusDefaults.java:138)
	at javax.swing.plaf.nimbus.NimbusLookAndFeel.<init>(NimbusLookAndFeel.java:100)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:583)
	at es.estoes.wallpaperDownloader.window.WallpaperDownloader.<init>(WallpaperDownloader.java:284)
	at es.estoes.wallpaperDownloader.window.WallpaperDownloader$1.run(WallpaperDownloader.java:265)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

This exception is from Solus OS 3 and this is the version of snapd:

egarcia@solus ~ $ snap version
snap    2.30
snapd   2.30
series  16
solus   3
kernel  4.15.3-53.current

When I started to build WallpaperDownloader snap back in 2016, I had to include some exports in order to avoid some fontconfig exceptions. These were the exports included in the script which run the application:

export XDG_DATA_HOME=$SNAP/usr/share
# Font Config
export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
export HOME=$SNAP_USER_DATA

When desktop-launch part was released, those exports where removed and everything was working fine until version 3.0 of WallpaperDownloader. I tried to add them again but the result is the same. This is the actual script:

#!/bin/sh
# Only for packaging!
# Script for snap packaging wallpaperdownloader application. It is not related to the code itself
# Old exports are not needed anymore because of desktop/gtk3 part use within snapcraft.xml configuration file
export HOME=$SNAP_USER_DATA
# Memory usage is limited to 256 MBytes of RAM
# -Dsun.java2d.xrender=f to avoid RenderBadPicture exception and JVM crashes when previewing wallpapers
desktop-launch java -Dsun.java2d.xrender=f -Xmx256m -Xms128m -jar -Duser.home=$SNAP_USER_DATA $SNAP/jar/wallpaperdownloader.jar

And this is the snapcraft.yaml file:

name: wallpaperdownloader
version: "3.0"
summary: Download, manage and change your favorite wallpapers from the Internet
description: WallpaperDownloader is a simple GUI Java based application for downloading, managing and changing wallpapers from the Internet
grade: stable
confinement: strict

apps:
  wallpaperdownloader:
    command: wallpaperdownloader.sh
    # network-observe plug will be needed to run ping command from the snap
    plugs: [x11, unity7, network-bind, network-observe, home, gsettings]

parts:
  # Pulls the code from the original source (master branch)
  # desktop-gtk3 is a snapcraft part (snapcraft-desktop-helpers) from the Wiki: https://wiki.ubuntu.com/snapcraft/parts
  # It enables desktop integration and gsettings manipulation from the confined application
  # It is necessary to use gsettings interface (see above) in order to have a fully functional
  # desktop-gtk3 part
  # Github repository for snapcraft-desktop-helpers: https://github.com/ubuntu/snapcraft-desktop-helpers
  wallpaperdownloader:
    plugin: maven
    source: ..
    stage-packages:
      # mate-desktop-common is necessary to have MATE gsettings schemas available for the application
      - mate-desktop-common
      # Due to ping command has setuid bit, command line invocation from a snap causes permission denied error.
      # It is necessary for the user execute sudo snap connect wallpaperdownloader:network-observe 
      # In order to make the use of the application more transparent for the user, curl will be used
      # instead of pin to check Internet connectivity
      - curl
    after: [desktop-gtk3]

  # It will copy wallpaperdownloader script into /bin/
  # This script contains all the commands needed (sets env variables, launches the jar file...) to
  # execute the application
  exec:
    plugin: dump
    source: scripts

Do you have any idea why this version is working fine in Ubuntu and Arch for example but it won’t run on Solus or openSUSE?

Thank you very much for your time :slight_smile:

1 Like