Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obok relies on ip command to get MAC address, which is not available in the Calibre flatpak #585

Open
jcotton42 opened this issue Jul 30, 2024 · 1 comment · May be fixed by #586
Open

Comments

@jcotton42
Copy link

jcotton42 commented Jul 30, 2024

Question / bug report

I'm using the Calibre flatpak v7.15 on Linux, maintained at https://github.com/flathub/com.calibre_ebook.calibre, and it seems that Obok relies on the ip command to get the MAC address for Kobo eBook decryption. Unfortunately, the ip command isn't available inside the flatpak, as you can see the by the command not found errors in the log, and this shell session from inside the flatpak sandbox.

$ flatpak run --command=sh com.calibre_ebook.calibre
# now inside flatpak sandbox
$ ip
sh: ip: command not found

I can think of three possible solutions off the top of my head

  1. Remove the reliance on ip on Linux in favor of a pure Python solution
  2. Allow the user to manually input their MAC addresses in the Obok settings
  3. Ask the Calibre flatpak to include ip in their sandbox

Regarding #1 I found this, https://stackoverflow.com/a/32080877, reading /sys/class/IFACE/address for each interface. I should note that it seems it's possible for an interface to have no MAC, e.g. the tailscale0 interface for my Tailscale VPN returns no MAC, but my Ethernet and WiFi interfaces do return their MACs.

Which version of Calibre are you running?

7.15

Which version of the DeDRM plugin are you running?

v10.0.9

If applicable, which version of the Kindle software are you running?

No response

Log output

calibre 7.15  embedded-python: True
Linux-6.9.9-206.fsync.fc40.x86_64-x86_64-with-glibc2.38 Linux ('64bit', 'ELF')
('Linux', '6.9.9-206.fsync.fc40.x86_64', '#1 SMP PREEMPT_DYNAMIC Tue Jul 23 11:44:28 UTC 2024')
Python 3.11.5
Interface language: None
EXE path: /app/lib/calibre/bin/calibre-debug
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 15, 0) && Action Chains (1, 20, 7) && Annotations (1, 17, 13) && Count Pages (1, 13, 6) && EpubMerge (3, 1, 0) && EpubSplit (3, 8, 0) && FanFicFare (4, 36, 0) && Generate Cover (2, 3, 4) && Job Spy (1, 0, 239) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0) && KindleUnpack - The Plugin (0, 83, 1) && Kobo Metadata (1, 6, 3) && Kobo Utilities (2, 17, 1) && KoboTouchExtended (3, 6, 7) && Manage Series (1, 5, 2) && Modify ePub (1, 8, 4) && Obok DeDRM (10, 0, 9) && Prettify Cover (1, 6, 0) && Reading List (1, 15, 4)
QPA platform: wayland
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 52.053130929791266 x 164.75675675675674
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.03] splash screen shown
[0.03] Initializing db...
[0.06] db initialized
[0.06] Constructing main UI...
DEBUG:    0.0 Annotations plugin: Error loading libiMobileDevice. This hasn't worked for a while, and is blacklisted in calibre v3.
DEBUG:    0.0 Annotations plugin: Error is:  No module named 'calibre.devices.idevice'
DEBUG:    0.0 Annotations::reader_app_support.py - loading translations
DEBUG:    0.0 Annotations::common_utils.py - loading translations
DEBUG:    0.0 Annotations::appearance.py - loading translations
DEBUG:    0.0 Annotations::config.py - loading translations
DEBUG:    0.0 Annotations::annotated_books.py - loading translations
DEBUG:    0.0 Annotations::action.py - loading translations
DEBUG:    0.0 Kobo Utilities Configuration - CreateNewCustomColumn is supported
DEBUG:    0.0 KoboUtilites::action.py - loading translations
DEBUG:    0.0 KoboUtilites::dialogs.py - loading translations
DEBUG:    0.0 KoboUtilites::action.py - loading translations
DEBUG:    0.0 obok::utilities.py - loading translations
DEBUG:    0.0 obok::dialogs.py - loading translations
DEBUG:    0.0 obok::config.py - loading translations
DEBUG:    0.0 obok::action_err.py - loading translations
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
[0.96] GUI main window shown
EpubMerge: DEBUG: 2024-07-29 19:12:01,827: calibre_plugins.epubmerge.epubmerge_plugin(156): macmenuhack file_path:/home/joshua/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/fanficfare_macmenuhack.txt
FFF: DEBUG: 2024-07-29 19:12:01,832: calibre_plugins.fanficfare_plugin.fff_plugin(217): Plugin FanFicFare macmenuhack file_path:/home/joshua/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/fanficfare_macmenuhack.txt
Job Spy has begun initialization...
Calibre, and hence Job Spy, was gracefully shut down last time?  True
Last time daemon started:  never
Last time daemon failed:  never
Total daemon starts inception_to_date:  0
Total daemon failures inception-to-date:  0
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
JS: ===>>> change_gui_alternating_row_colors()
Job Spy has finished initialization...
DEBUG:    0.4 No Kobo Touch, Glo or Mini appears to be connected
DEBUG:    0.4 rebuild_menus - self.supports_ratings=None, self.supports_tiles=None
DEBUG:    0.4 KoboUtilities:set_toolbar_button_tooltip - start: text='None'
DEBUG:    0.4 KoboUtilities:set_toolbar_button_tooltip - setting to text='Utilities to use with Kobo ereaders

Driver: KoboTouchExtended'
[1.16] main UI initialized...
[1.16] Hiding splash screen
Action chains: _get_plugins_resources(): start
Action Chains: _get_plugins_resources(): finished
Action chains: formulas: running on_templates_update()
Action chains: _call_plugins_on_modules_update(): start
Action Chains: _call_plugins_on_modules_update(): finished
[1.27] splash screen hidden
[1.27] Started up in 1.27 seconds with 655 books
# this is when I clicked the Obok button in the toolbar
Running Obok DeDRM v10.0.9
DEBUG:    3.0 didn't find device
Obok v10.0.9
Copyright © 2012-2023 Physisticated et al.
/tmp/tmp0hnwxhma
DEBUG:    3.0 got kobodir /var/home/joshua/.var/app/com.usebottles.bottles/data/bottles/bottles/Default/drive_c/users/steamuser/AppData/Local/Kobo/Kobo Desktop Edition
Error parsing Kobo plist: no legacy user key found.
/bin/sh: line 1: ip: command not found
/bin/sh: line 1: ipconfig: command not found
jcotton42 added a commit to jcotton42/DeDRM_tools that referenced this issue Jul 30, 2024
Use /sys/class/net/IFACE/address for the MAC address instead of the ip
command.
@kii-chan-reloaded
Copy link

Just to pitch in my two cents: I also ran into this a few days ago, but I ended up using a different workaround. Since the manifest for the Calibre Flatpak declares --filesystem=host, we have access to the host's ip binary via /run/host/bin. My workaround was to shadow the PATH variable for the call to ip:

for line in os.popen('ip -br link'):

Turned into

# Shadowing PATH to circumvent a missing ip binary in Flatpak
for line in os.popen('PATH=$PATH:/run/host/bin:/run/host/usr/bin ip -br link'):

Re-running Obok with this change made the decryption complete successfully. This fix should work both on Flatpak and non-Flatpak releases of Calibre, as adding nonexistent folders to PATH does not cause any errors.

Hopefully this issue gets an official resolution soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants