Skip to content

Classic snap launcher script is broken on Ubuntu 26.04 LTS #9704

@jnsgruk

Description

@jnsgruk

Hi there

I recently upgraded to Ubuntu 26.04 LTS, and the Obsidian snap stopped working. After some investigation with colleagues, it seems this is due to a divergent behaviour in rust-coreutils and a (potentially incorrect?) script that is packaged in the snap by Electron builder.

The issue in this snap is /snap/obsidian/current/desktop-common.sh:

function can_open_file() {
  head -c0 "$1" &> /dev/null
}
...
if can_open_file "$REALHOME/.config/user-dirs.dirs" && can_open_file "$REALHOME/.config/user-dirs.locale"; then
...
# Create links for user-dirs.dirs
if [ $needs_xdg_links = true ]; then
  for ((i = 0; i < ${#XDG_SPECIAL_DIRS_PATHS[@]}; i++)); do
    b="$(realpath "${XDG_SPECIAL_DIRS_PATHS[$i]}" --relative-to="$HOME")"
    if [ -e "$REALHOME/$b" ]; then
      if [ -d "$HOME/$b" ]; then
        rmdir "$HOME/$b" 2> /dev/null
      fi
...

Basically trying to replace XDG directories for the snap by symlink to the real dir. In that case it’s a classic snap so it shouldn’t try to do that but

$ gnuhead -c0 ~/Documents; echo $?
0
$ head -c0 ~/Documents; echo $?
head: error reading '/home/ubuntu/Documents': Is a directory
1

The head behavior is different in rust-coreutils which makes the check it does to decide if it needs to do the symlink dance or not fail and try to rmdir ~/Documents and errors out

That launcher script appears to be included as part of electron builder, and hasn’t been updated for some time.

The script seems to be in the binary release tarball but I can't find it in the source anywhere to propose a patch.

I suspect there are more snaps affected than just Obsidian

(Reference to the Obsidian forum post: https://forum.obsidian.md/t/obsidian-snap-doesnt-start-open-with-ubuntu-26-04/113569/28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions