Meta Post - Linux tips, tricks & solutions to common problems

I’ll keep a running list of tips, tricks and common problems here.

If you found a great tool or have a nifty trick for using Obsidian in Linux post below!

How to

Installation

Import

Solutions to common problems

3 Likes

Common “too many open files” related issues:

  1. ENOSPC: System limit for number of file watchers reached happens if you have too many files open on a system. By default this limit is set very low (65535) but it’s trivial to increase it:
    Obsidian starts with blank screen

  2. Error: EMFILE: too many open files might happen if you have a very large Obsidian vault with a lot of files inside. You can raise this limit by adding relevant entries in your /etc/security/limits.conf as mentioned in this post: https://www.tecmint.com/increase-set-open-file-limits-in-linux/

1 Like

How to use the Obsidian AppImage

After downloading the AppImage, and make it executable chmod +x Obsidian-0.8.14.AppImage, you should place it somewhere in your PATH as described here, e.g. in ~/bin/.

To add a desktop entry, you can create an obsidian.desktop file and place it in either /usr/share/applications/ or /usr/local/share/applications/ for applications installed system-wide, or ~/.local/share/applications/. The contents should look something like this:

[Desktop Entry]
Name=Obsidian
Comment=Markdown Notetaking App
GenericName=Text Editor
Type=Application
Exec=/path/to/appimage/Obsidian-0.8.14.AppImage %U
Icon=obsidian
StartupWMClass=obsidian
MimeType=x-scheme-handler/obsidian;

Note that for the Application icon to work, the following line is important:

See also Application Icon missing in Gnome on Linux - #11 by sekhar989 . If all else fails, you can manually download and save the icon to ~/.icons/obsidian.png

In case you prefer a tool that can manage that for you, you can look into AppImageLauncher.

3 Likes

I used the AppImageLauncher and it worked great! It comes up as Obsidian(1) for some reason but I’ll take it for now :slight_smile:

1 Like

I could not have the icon for the .desktop & there was no .icons folder in home. what should I do?
I didn’t use AppImageLauncher and want to do it manually if there is a way.

Thank you

You can create the folder yourself!

AppImages are—in my opinion—the better alternatives to FlatPak or Snap. Thanks to the Obsidian team for providing one! Since AppImages run on such a variety of Linux systems, they don’t easily “self-integrate” into the miscellaneous desktop environments out there.

The easiest way is to use AppImageLauncher, especially if you use more than just one or two AppImages.

But it can be done manually, too. The basic steps here are:

  • Get the AppImage and make it executable.
  • Put it in a sensible location (I use ~/AppImages but some prefer /opt).
  • Get an application icon and store it where your DE can use it.
  • Make a “starter” (.desktop) file and put it in a location appropriate for your DE. A normal text editor can be used for this.

Here is an example for how I did it on my Linux Mint 20.1:

  1. Download the Obsidian AppImage.

  2. I moved it to ~/AppImages/Obsidian-0.10.11.AppImage.

  3. Make it executable: chmod +x ~/AppImages/Obsidian-0.10.11.AppImage.

  4. Get an icon. I used:

    curl -L -o obsidian.png https://cdn.discordapp.com/icons/686053708261228577/1361e62fed2fee55c7885103c864e2a8.png
    
  5. Move the icon to a place where Cinnamon (my DE) can find and use it:

    sudo mv obsidian.png /usr/share/pixmaps
    
  6. Create an Obsidian.desktop file and store it in ~/.local/share/applications (you might need to create this folder first):

    [Desktop Entry]
    Name=Obsidian
    Comment=Markdown Notetaking App
    Terminal=false
    GenericName=Text Editor
    Type=Application
    Exec=/home/matthias/AppImages/Obsidian-0.10.11.AppImage %u
    Icon=obsidian
    StartupWMClass=obsidian
    MimeType=x-scheme-handler/obsidian;
    

    Note: Case matters!

    In the Exec= line, replace /home/matthias with your home folder. Also, use the correct Obsidian installer version name for the file you downloaded.

After all this, a restart may be needed and you’ll have Obsidian working from the Menu, and with its beautiful icon in the menu, the app switcher, etc.

Note: This is a single-user setup. If you want other users on this system to have access to Obsidian, consider using

  • /usr/share or /opt instead of ~/AppImages for storing the Obsidian AppImage, and
  • /usr/share/applications instead of ~/.local/share/applications for storing the .desktop file.
3 Likes

How to enable Wayland Support

Hey everyone! I’ve added an experimental option to the Obsidian flatpak to enable Wayland support now that it got native support after updating to Electron 12.

It you’ve already installed the flatpak, can test Wayland support by enabling OBSIDIAN_USE_WAYLAND=1 in Flatseal.

Alternatively, you can set it on the command line like so:

$ flatpak override --user --env=OBSIDIAN_USE_WAYLAND=1 md.obsidian.Obsidian

I hope that helps!

2 Likes

For those of you out there who aren’t using Flatpak (I installed Obsidian from AUR), you can enable Wayland by calling obsidian with --enable-features=UseOzonePlatform --ozone-platform=wayland options.

I tried calling Obsidian with environment variable OBSIDIAN_USE_WAYLAND=1, but it didn’t work for some reason.

2 Likes

@gnull Are you calling OBSIDIAN_USE_WAYLAND=1 from within the Obsidian flatpak, or from the AUR build? If the former, then you need to make sure that you’re running in a Wayland session:

$ echo $XDG_SESSION_TYPE 
wayland

So far this has been extensively tested in Gnome Shell. Other Wayland compositors like KDE and Sway will need feedback.

It’s also worth noting that OBSIDIAN_USE_WAYLAND is a custom environment variable for easily testing Wayland support, so it’d make sense if it didn’t do anything in other builds. This variable is declared here:

Why do I always think of “waylaid” when reading “Wayland” … ah, yes, because I’m still happily using X11.

But I guess one can’t avoid Wayland nowadays.

I think X11 will continue to be a fallback for applications that cannot function completely under Wayland, and for all intents and purposes that’s fine. There’s a lot of new development happening in the Linux desktop ecosystem right now, and with it comes an awkward adjustment period where new APIs are introduced and applications are eventually updated to use them to gain back functionality that was previously provided under X11.

I think in the case of Obsidian it seems to work readily under Wayland, as it’s not primarily using parts of the stack that’ve historically been pain points in Wayland (screen sharing, hot keys, etc). For most users who’re running Wayland compositors, there probably won’t be a noticeable difference.

2 Likes

A post was split to a new topic: URL Scheme on Flatpak not recognized

Disabling frameless mode on Linux:

If someone want to go easy route (particulary Arch-based distro users) use AppImageLauncher.

I have EndeavourOS so I used yay appimagelauncher to get the package from AUR. Afterwards just
press Integrate and run and Obsidian will be added to Application Launcher (start menu).

If you have no icons and using KDE/Plasma just restart system and icons will be there.

2 Likes

Setting up the Obsidian URI on Linux (tested on Ubuntu 18.04, YMMV)

Make sure your desktop file is set up correctly. If it doesn’t exist, you can create it. I have mine on ~/.local/share/applications:

Then run:

xdg-mime default obsidian.destkop x-scheme-handler/obsidian
update-desktop-database

Check that the URI works by confirming that the output of both xdg-mime query default x-scheme-handler/obsidian and xdg-settings get default-url-scheme-handler obsidian is obsidian.desktop.

It should also appear on your ~/.config/mimeapps.list:

[Default Applications]
...
text/html=obsidian.desktop
x-scheme-handler/obsidian=obsidian.desktop
2 Likes

I am using the extracted AppImage, but the Obsidian URI didn’t work.

The issue was that the AppRun file didn’t get the $APPDIR supplied, so it didn’t get the correct path to execute the binary.

Below is part of the AppRun with the change I made.

THIS="$0"
# http://stackoverflow.com/questions/3190818/
args=("[email protected]")
NUMBER_OF_ARGS="$#"
  
# Supply the path to where the extracted AppImage is
# below is just an example
APPDIR='/home/username/Applications/obsidian/'
  
if [ -z "$APPDIR" ] ; then
   # Find the AppDir. It is the directory that contains AppRun.
   # This assumes that this script resides inside the AppDir or a subdirectory.
   # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR