ChromeOS, Flatpak, and Obsidian
Bad experience with ChromeOS trying to install Obsidian following these instructions. I did eventually get it working but only with a bunch of ugly hacks as root.
Note the install instructions have you making bwrap setuid root. Ugh! I did not do that, because other things online say it isn’t necessary. I did try enabling setuid a few times and it didn’t fix anything.
First problem: flatpak just won’t work other than root. Even flatpak list gives me a “Permission denied” error (unhelpfully not telling me what permission is denied.) This happens even with bwrap setuid. I don’t know if that’s a general flatpak thing or is a problem specific to ChromeOS. Docs I’ve read online suggest that at least parts of flatpak shouldn’t require root but that installing software probably will. Whatever, I’ll just do everything as root. (At least part of the problem is /home/nelson/.local/share/flatpak ended up being owned by root and permissions 0700; this happened on Ubuntu too, so a Flatpak bug? But even fixing that, still couldn’t flatpak list on the Chromebox.)
Installing with Flatpak went smoothly. There’s now an Obsidian app icon in the ChromeOS GUI. But when I launch it either nothing happens, or the logo for Obsidian shows up but with an infinite spinning circle on top of it. No feedback on what’s wrong. The online advice for access to ChromeOS system logs is all out of date. I finally found my way to a log viewer at chrome://device-log/ but there’s nothing there about the app not working. The log dump generated from chrome://network/ does seem to have useful info but I could not understand what was failing.
OK, so let’s launch from a command line instead. An hour later, here’s a short transcript of all the breakage I encountered.
~ ⬢ [Systemd] ❯ flatpak run md.obsidian.Obsidian
error: Permission denied
~ ⬢ [Systemd] ❯ sudo !!
sudo flatpak run md.obsidian.Obsidian
error: "flatpak run" is not intended to be ran with sudo
~ ⬢ [Systemd] ❯ sudo bash
root ~ ⬢ [Systemd] ❯ flatpak run md.obsidian.Obsidian
Debug: Will run Obsidian with the following arguments:
Debug: Additionally, user gave:
[13 zypak-helper] Failed to connect to session bus: [org.freedesktop.DBus.Error.NoReply] Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
[13 zypak-helper] src/helper/main.cc:40(DetermineZygoteStrategy): Assertion failed: bus
/app/bin/obsidian.sh: line 40: 13 Aborted (core dumped) zypak-wrapper /app/obsidian $@ ${EXTRA_ARGS[@nelsonminar
root ~ ⬢ [Systemd] ❯ dbus-run-session flatpak run md.obsidian.Obsidian
...
[0319/141600.942543:FATAL:electron_main_delegate.cc(299)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
root ~ ⬢ [Systemd] ❯ dbus-run-session flatpak run md.obsidian.Obsidian --no-sandbox
it worked!
So.. it has to run as root. Then it turns out it doesn’t want to run as root, at least via sudo. And then it needs access to the system’s DBus, which for some reason the Flatpak hasn’t set up. Then Electrno complains about root needing --no-sandbox so if I provide that option it works! Lololo.
Just a total mess of complex systems stuff that’s standing between me and my application. DBus, the Crostini container, the Flatpak container, the Chrome/Electron sandbox. Layers and layers of stuff and some of it is broken.
So a failed experiment, even if in the end I did get the thing running. To be fair to ChromeOS: this is really not what that product is designed for. A Linux program, Flatpak, a separate Chrome/Electron instance. Yeah, don’t do that. I suspect if I need to do this for real I’ll just end up using the Android app running on the Chromebook and put up with the less-than-optimal mobile UI.