ton-blockchain / mytonctrl

A tool to run and maintain a TON node/validator
GNU General Public License v3.0
215 stars 129 forks source link

[Defect] And again: `dbLoad: [Errno 2] No such file or directory: '/usr/local/bin/mytoncore/mytoncore.db'` (#9 reappeared) #50

Closed asmexcaliburwoods closed 1 year ago

asmexcaliburwoods commented 2 years ago

#9 defect reappeared

DUP of #9

Let's fix this, I'm an sw dev too...

TLDR

Occurs at: commit a3a8cc8003734a326f816546025621c0024a2f3e

[warning] 20.10.2021, 11:26:54.008 (UTC)  <MainThread>  dbLoad: [Errno 2] No such file or directory: '/usr/local/bin/mytoncore/mytoncore.db'

pwd
/usr/src/mytonctrl

git log
commit a3a8cc8003734a326f816546025621c0024a2f3e (HEAD -> master, origin/master, origin/HEAD)
Author: Igroman787 <27614297+igroman787@users.noreply.github.com>
Date:   Sat Sep 25 12:04:05 2021 +0300
...

git branch
* master

git remote get-url origin
https://github.com/igroman787/mytonctrl.git

date
+2021-10-20 11:30:24 UTC

Details and logs

Just installed mytonctrl on Ubuntu 18.04.x

under root; pwd: /home/user/vcs/ton/mytonctrlsolyanka; date: +2021-10-20 10:38:14 UTC nanoseconds:623394757 Ante De Christ; host: atthemountainkingscave

wget -t0 https://raw.githubusercontent.com/igroman787/mytonctrl/master/scripts/install.sh

// wget -t0 means infinite retries to fetch the full stream content

sudo bash install.sh -m lite

...

// -- The C compiler identification is Clang 6.0.0 // -- The CXX compiler identification is Clang 6.0.0

// a lot of C++ warns

[5/6] Downloading config files
--2021-10-20 18:57:11--  https://newton-blockchain.github.io/global.config.json
Распознаётся newton-blockchain.github.io (newton-blockchain.github.io)… 185.199.111.153, 185.199.108.153, 185.199.110.153, ...
Подключение к newton-blockchain.github.io (newton-blockchain.github.io)|185.199.111.153|:443... соединение установлено.
HTTP-запрос отправлен. Ожидание ответа… 200 OK
Длина: 27926 (27K) [application/json]
Сохранение в: «global.config.json»

global.config.json  100%[===================>]  27,27K  --.-KB/s    за 0,02s   

2021-10-20 18:57:11 (1,24 MB/s) - «global.config.json» сохранён [27926/27926]

[6/6] TON software installation complete
[3/4] Launching the mytoninstaller.py
[debug]   20.10.2021, 10:57:12.192 (UTC)  <Logging>     Start WritingLogFile thread.
[debug]   20.10.2021, 10:57:12.192 (UTC)  <SelfTesting> Start SelfTesting thread.
[info]    20.10.2021, 10:57:12.192 (UTC)  <MainThread>  Start program '/usr/src/mytonctrl/mytoninstaller.py'
[debug]   20.10.2021, 10:57:12.192 (UTC)  <MainThread>  start FirstMytoncoreSettings fuction
Created symlink /etc/systemd/system/multi-user.target.wants/mytoncore.service → /etc/systemd/system/mytoncore.service.
[debug]   20.10.2021, 10:57:12.543 (UTC)  <MainThread>  Start/restart mytoncore service
[debug]   20.10.2021, 10:57:12.549 (UTC)  <MainThread>  start CreateSymlinks fuction
[4/4] Mytonctrl installation completed
// my PS1 tells: exit status: 0

cd

pwd
/root

mytonctrl 
[warning] 20.10.2021, 11:32:19.840 (UTC)  <MainThread>  dbLoad: [Errno 2] No such file or directory: '/usr/local/bin/mytoncore/mytoncore.db'
[warning] 20.10.2021, 11:32:19.840 (UTC)  <MainThread>  dbLoad: [Errno 2] No such file or directory: '/usr/local/bin/mytoncore/mytoncore.db'
[warning] 20.10.2021, 11:32:19.840 (UTC)  <MainThread>  The config file is broken
[debug]   20.10.2021, 11:32:19.841 (UTC)  <Logging>     Start WritingLogFile thread.
[debug]   20.10.2021, 11:32:19.842 (UTC)  <SelfTesting> Start SelfTesting thread.
[debug]   20.10.2021, 11:32:19.842 (UTC)  <LocdbSaving> Start LocaldbSaving thread.
[info]    20.10.2021, 11:32:19.842 (UTC)  <MainThread>  Start program '/usr/src/mytonctrl/mytonctrl.py'
Welcome to the console. Enter 'help' to display the help menu.
MyTonCtrl> `/* I pressed ^D */` Bye.
// my PS1 tells: exit status: 0

Versions

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic
Ok
uname -a
Linux host1 5.4.0-89-generic #100~18.04.1-Ubuntu SMP Wed Sep 29 10:59:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Ok
python3 --version
Python 3.6.9
Ok
date
+2021-10-20 11:24:01 UTC
Ok
asmexcaliburwoods commented 2 years ago

ls -alR /usr/local/bin/mytoncore/
/usr/local/bin/mytoncore/:
итого 12K
drwxr-xr-x 3 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC .
drwxr-xr-x 5 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC ..
drwxr-xr-x 2 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC wallets

/usr/local/bin/mytoncore/wallets:
итого 8,0K
drwxr-xr-x 2 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC .
drwxr-xr-x 3 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC ..
Ok
asmexcaliburwoods commented 2 years ago
ls -alR /usr/local/bin/mytonctrl/
/usr/local/bin/mytonctrl/:
итого 20K
drwxr-xr-x 2 root root 4,0K 2021-10-20 18:58:14 +08 nanoseconds:260871270 ADC .
drwxr-xr-x 5 root root 4,0K 2021-10-20 18:58:04 +08 nanoseconds:248967123 ADC ..
-rw-r--r-- 1 root root  296 2021-10-20 19:41:32 +08 nanoseconds:789011396 ADC mytonctrl.db
-rw-r--r-- 1 root root 2,9K 2021-10-20 19:42:04 +08 nanoseconds:293008851 ADC mytonctrl.log
-rw-r--r-- 1 root root    5 2021-10-20 19:42:03 +08 nanoseconds:293009126 ADC mytonctrl.pid
Ok
asmexcaliburwoods commented 2 years ago

I feel that MyPyClass gets created with arg file=".../mytonctrl/" at some places, and gets created with with arg file=".../mytoncore/" at some other places, and https://github.com/igroman787/mypylib/blob/e194d7e8e3151549f56419d6377c16cb1e2f2e8f/mypylib.py#L306 MyPyClass::GetMyFullName returns wrong value.

I launch mytonctrl under root.

The .db file exists at /usr/local/bin/mytonctrl/mytonctrl.db and the mytonctrl command indirectly (via MyPyClass::dbLoad https://github.com/igroman787/mypylib/blob/e194d7e8e3151549f56419d6377c16cb1e2f2e8f/mypylib.py#L531 ) tries to read /usr/local/bin/mytoncore/mytoncore.db where it doesn't exist.

UPDATE: After many rounds of rm of a lot of things and after many reinstalls with edited .py files and installers scripts files, this is no longer the case, see the following comment.

asmexcaliburwoods commented 2 years ago

One workaround is:

sudo cp -v /usr/local/bin/mytoncore/mytoncore.db /usr/local/bin/mytonctrl/mytonctrl.db

You can also verify that you have a correctly initialized mytoncore db:

sudo cat /usr/local/bin/mytoncore/mytoncore.db

Its output should be like:

{
    "config": {
        "logLevel": "debug",
        "isLocaldbSaving": true
    },
    "fift": {
        "appPath": "/usr/bin/ton/crypto/fift",
        "libsPath": "/usr/src/ton/crypto/fift/lib",
        "smartcontsPath": "/usr/src/ton/crypto/smartcont"
    },
    "liteClient": {
        "appPath": "/usr/bin/ton/lite-client/lite-client",
        "configPath": "/usr/bin/ton/global.config.json"
    },
    "miner": {
        "appPath": "/usr/bin/ton/crypto/pow-miner"
    },
    "sendTelemetry": false
}
igroman787 commented 1 year ago

Problem No such file or directory: '/usr/local/bin/mytoncore/mytoncore.db' may pop up due to the fact that the program is running under a different user. For example, it was installed by the superuser. Then the configuration file will be located here: /usr/local/bin/mytoncore/mytoncore.db. And when run as a user, the configuration file will be expected here: /home/{user}/.local/share/mytoncore/mytoncore.db

Another warning message No such file or directory: '/usr/local/bin/mytonctrl/mytonctrl.db may appear when you first start the program - this is normal