tsukumijima / KonomiTV

KonomiTV: Kept Organized, Notably Optimized, Modern Interface TV media server
MIT License
597 stars 37 forks source link

Ver0.7.0のインストーラELFバイナリのアーキテクチャがAArch64になっており、X86-64環境で実行できない #39

Closed ybiorl closed 1 year ago

ybiorl commented 1 year ago

はじめまして、大変ありがたく使用させていただいております。

環境

$  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

$ uname -a
Linux fiena5 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

問題

Ver0.7.0のインストーラが実行できません。 Ver0.6.2までのLinux用インストーラのELFバイナリのアーキテクチャは[X86-64]でした。 Ver0.7.0では[AArch64]になっています。

実行内容

$ curl -LO https://github.com/tsukumijima/KonomiTV/releases/download/v0.7.0/KonomiTV-Installer.elf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 14.5M  100 14.5M    0     0  4120k      0  0:00:03  0:00:03 --:--:-- 4914k

$ chmod a+x KonomiTV-Installer.elf

$ ./KonomiTV-Installer.elf
-bash: ./KonomiTV-Installer.elf: バイナリファイルを実行できません: 実行形式エラー

$ readelf -h KonomiTV-Installer.elf
ELF ヘッダ:
  マジック:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  クラス:                            ELF64
  データ:                            2 の補数、リトルエンディアン
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI バージョン:                    0
  型:                                DYN (Position-Independent Executable file)
  マシン:                            AArch64
  バージョン:                        0x1
  エントリポイントアドレス:               0x21d4
  プログラムヘッダ始点:          64 (バイト)
  セクションヘッダ始点:          102712 (バイト)
  フラグ:                            0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         27
  Section header string table index: 26
tsukumijima commented 1 year ago

あまりにも疲れすぎた(今日一睡もしていない)上に明日からハードな諸用が入るので取り急ぎなんですが、この Artifacts から多分 x64 のインストーラー落とせると思うのでそれで試してみてもらえますか…?

ybiorl commented 1 year ago

あまりにも疲れすぎた(今日一睡もしていない)上に明日からハードな諸用が入るので取り急ぎなんですが、この Artifacts から多分 x64 のインストーラー落とせると思うのでそれで試してみてもらえますか…?

取り急ぎ、Artifactsのx64インストーラが実行できることを確認しました。

tsukumijima commented 1 year ago

やはりビルド後のリリースタイミングでファイルが誤って上書きされてしまったみたいです。後でファイルを差し替えておきますね。 インストール/アップデート自体は上手く動作しましたか?

ybiorl commented 1 year ago

個人の環境の問題かもしれませんが、インストールとアップデートがうまくできません

  1. [Docker/インストール]Docker Compose(v1)が入っている環境なのにインストーラの選択肢でDockerの質問が出てこない。
  2. [Docker/アップデート]Docker Composeでインストールしたv0.6.2をアップデートしようとすると、Docker Composeがインストールされていないと出て進められない
  3. [直接/インストール]直接インストールしようとすると以下のエラーが発生する
  依存パッケージをインストールしています…

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Python path configuration:
  PYTHONHOME = '/tmp/onefile_231560_1683016180_636466'
  PYTHONPATH = (not set)
  program name = '/opt/KonomiTV/server/thirdparty/Python/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/tmp/onefile_231560_1683016180_636466/lib/python3.11'
  sys._base_executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python'
  sys.base_prefix = '/tmp/onefile_231560_1683016180_636466'
  sys.base_exec_prefix = '/tmp/onefile_231560_1683016180_636466'
  sys.platlibdir = 'lib'
  sys.executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python'
  sys.prefix = '/tmp/onefile_231560_1683016180_636466'
  sys.exec_prefix = '/tmp/onefile_231560_1683016180_636466'
  sys.path = [
    '/tmp/onefile_231560_1683016180_636466/lib/python311.zip',
    '/tmp/onefile_231560_1683016180_636466/lib/python3.11',
    '/tmp/onefile_231560_1683016180_636466/lib/python3.11/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f5cf92c0b80 (most recent call first):
  <no Python frame>
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  データベースをアップグレードしています…
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:00:00

  PM2 サービスをインストールしています…
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:00:00

  ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ PM2 サービスのインストール中に予期しないエラーが発生しました。                                                   │
  │ お手数をおかけしますが、下記のログを開発者に報告してください。                                                   │
  └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ PM2 のエラーログ:                                                                                                │
  │ [PM2][ERROR] Script not found: /opt/KonomiTV/server/.venv/bin/python                                             │
  └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  1. [直接/アップデート]直接インストールしたv0.6.2をアップデートしようとすると、以下のエラーが発生してサービスが起動しない
    
    依存パッケージを更新しています…

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Python path configuration: PYTHONHOME = '/tmp/onefile_328751_1683017613_901768' PYTHONPATH = (not set) program name = '/opt/KonomiTV/server/thirdparty/Python/bin/python' isolated = 0 environment = 1 user site = 1 safe_path = 0 import site = 1 is in build tree = 0 stdlib dir = '/tmp/onefile_328751_1683017613_901768/lib/python3.11' sys._base_executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python' sys.base_prefix = '/tmp/onefile_328751_1683017613_901768' sys.base_exec_prefix = '/tmp/onefile_328751_1683017613_901768' sys.platlibdir = 'lib' sys.executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python' sys.prefix = '/tmp/onefile_328751_1683017613_901768' sys.exec_prefix = '/tmp/onefile_328751_1683017613_901768' sys.path = [ '/tmp/onefile_328751_1683017613_901768/lib/python311.zip', '/tmp/onefile_328751_1683017613_901768/lib/python3.11', '/tmp/onefile_328751_1683017613_901768/lib/python3.11/lib-dynload', ] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007ff1fd8ceb80 (most recent call first):

Python path configuration: PYTHONHOME = '/tmp/onefile_328751_1683017613_901768' PYTHONPATH = (not set) program name = '/opt/KonomiTV/server/thirdparty/Python/bin/python' isolated = 0 environment = 1 user site = 1 safe_path = 0 import site = 1 is in build tree = 0 stdlib dir = '/tmp/onefile_328751_1683017613_901768/lib/python3.11' sys._base_executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python' sys.base_prefix = '/tmp/onefile_328751_1683017613_901768' sys.base_exec_prefix = '/tmp/onefile_328751_1683017613_901768' sys.platlibdir = 'lib' sys.executable = '/opt/KonomiTV/server/thirdparty/Python/bin/python' sys.prefix = '/tmp/onefile_328751_1683017613_901768' sys.exec_prefix = '/tmp/onefile_328751_1683017613_901768' sys.path = [ '/tmp/onefile_328751_1683017613_901768/lib/python311.zip', '/tmp/onefile_328751_1683017613_901768/lib/python3.11', '/tmp/onefile_328751_1683017613_901768/lib/python3.11/lib-dynload', ] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings' Current thread 0x00007fe271c39b80 (most recent call first): ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── データベースをアップグレードしています… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:00:00 PM2 サービスを起動しています… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:00:00 サービスの起動を待っています… (時間がかかることがあります) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:01:59 ``` 同じ環境でv0.6.2であれば直接・Dockerのどちらでもインストールできています。
ybiorl commented 1 year ago

cloneしたKonomiTV-Installer.pyを実行して試したところ、直接・Dockerのどちらでもv0.7.0がインストールできました。

ybiorl commented 1 year ago

Linuxのみでしか確認していませんが、nuitka v1.5.6でビルドすると事象が発生し、v1.5.7だと発生しないので以下の問題に起因するかもしれません。 https://github.com/Nuitka/Nuitka/issues/2168

Dockerのインストール判定で使われているsubprocessが異常になっているように見えたので、問題の内容とも合致しているかと思われます。

最新のv1.5.7から修正されている問題であり、KonomiTVのPipfile.lockも直近で既にこのバージョンへ修正してらっしゃるので、Actionsの最新のビルドでは解決しているように見受けられます。

すでに認識済みならすみません。

tsukumijima commented 1 year ago

調査ありがとうございます…!! 私も Nuitka を更新したこと or Python 3.11 ベースに更新したことが原因ではないかと思っていましたが、試しに依存関係を更新して Actions でビルドされたインストーラーを試してみたところ(まだ Windows 版しか確認できていないものの)普通に動作したので、やはり Nuitka 側に何らかの問題があったみたいです。

Nuitka は元々ビルドに非常に時間がかかること、インストーラーという用途上パフォーマンスはあまり求められないことから、これを機に PyInstaller に変更する予定です。

nozomi328 commented 1 year ago

こんにちは、いつもKonomi TVを利用させていただいております。ありがとうございます。

Windows 10 x64 環境ですが、v0.7.0にアップデートする際、Linux環境と同じくPython Error "failed to get the Python codec of the filesystem encoding"が発生し、進まなくなります。インストールも似た現象が起こります。

ご参考になれば幸いです。

nozomi328 commented 1 year ago

こんにちは、いつもKonomi TVを利用させていただいております。ありがとうございます。

Windows 10 x64 環境ですが、v0.7.0にアップデートする際、Linux環境と同じくPython Error "failed to get the Python codec of the filesystem encoding"が発生し、進まなくなります。インストールも似た現象が起こります。

ご参考になれば幸いです。

v0.7.1にて解消した模様です。ありがとうございました。

tsukumijima commented 1 year ago

手元の環境で動作することは確認していましたが、0.7.1 のインストーラーにて無事インストールできたようで何よりです。 基本 0.7.1 で解決したかと思いますので、この Issue は閉じさせていただきます。 @ybiorl