cgcel / obsidian-local-backup

Automatically creates a local backup of the vault.
MIT License
48 stars 3 forks source link

Unable to find 7z on Linux, "No such file or directory" #25

Open jaymehta-g opened 8 months ago

jaymehta-g commented 8 months ago

OS: Linux Mint 21.2

In a terminal:

$ whereis 7z
7z: /usr/bin/7z /usr/share/man/man1/7z.1.gz

Then I enable external archiver in settings and set /usr/bin/7z as the file archiver path for Unix. When I make a backup or one is made automatically, I get the "No such file or directory /usr/bin/7z

For me, /usr/bin/7z is a shell script just containing exec /usr/lib/p7zip/7z, but when I try that path I get the same error

cgcel commented 8 months ago

Hi, try to install p7zip. :)

jaymehta-g commented 7 months ago

Hi, try to install p7zip. :)

I had p7zip installed on both my laptop and desktop and saw the same issues on both. On my laptop the path for the 7z executable is /usr/lib/p7zip/7z by default, and i get the error whether i use that or /usr/bin/7z

cgcel commented 7 months ago

Hi, maybe I reproduced your problem, I installed pyzip on my ubuntu 22.04 (WSL), and after I typed /usr/bin/p7zip -h, it didn't show the command I need:

Usage: /usr/bin/p7zip [options] [--] [ name ... ]

Options:
    -c --stdout --to-stdout      output data to stdout
    -d --decompress --uncompress decompress file
    -f --force                   do not ask questions
    -k --keep                    keep original file
    -h --help                    print this help
    --                           treat subsequent arguments as file
                                 names, even if they start with a dash

So I tried to type /usr/bin/7 and click "tab" button, I finally found the file we need: /usr/bin/7zr:

cgc@DESKTOP-UFCDD51:~$ /usr/bin/7zr -h

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,24 CPUs 13th Gen Intel(R) Core(TM) i7-13700K (B0671),ASM,AES-NI)

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths
...

So, the solution is replace /usr/bin/7z with /usr/bin/7zr, thank you for using and hope this helps.

jaymehta-g commented 7 months ago

7zr and 7za both didn't work for me

cgcel commented 7 months ago

7zr and 7za both didn't work for me

Hi, use Ctrl+Shift+I in Obsidian, then run local backup once to see the log, and share me the log if possible.

cgcel commented 7 months ago

Or install p7zip-full instead of p7zip, and try again.

jaymehta-g commented 7 months ago
command: "/usr/bin/7z" a "/home/jay/Documents/ObsidianBackup/Obsidian-Backup-2024_02_19-00_40_59.7z" "/home/jay/Documents/Obsidian"
Failed to create file by 7-Zip: Error: Command failed: "/usr/bin/7z" a "/home/jay/Documents/ObsidianBackup/Obsidian-Backup-2024_02_19-00_40_59.7z" "/home/jay/Documents/Obsidian"
/bin/sh: line 1: /usr/bin/7z: No such file or directory

    at __node_internal_genericNodeError (node:internal/errors:867:15)
    at ChildProcess.exithandler (node:child_process:430:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:322:12)
Error during archive attempt 1: Error: Command failed: "/usr/bin/7z" a "/home/jay/Documents/ObsidianBackup/Obsidian-Backup-2024_02_19-00_40_59.7z" "/home/jay/Documents/Obsidian"
/bin/sh: line 1: /usr/bin/7z: No such file or directory
Failed to create vault backup after 1 attempts.

Strange because when i try to manually run the command from the first console log it works just fine

jaymehta-g commented 7 months ago

Almost identical errors with 7za and 7zr

cgcel commented 7 months ago

For me, /usr/bin/7z is a shell script just containing exec /usr/lib/p7zip/7z, but when I try that path I get the same error

Remove this script first.

Then you could try to install p7zip-full, after installation, you can use /usr/bin/7z directly.

foegra commented 2 months ago

p7zip-full

I am on Debian. This still does not work