monero-project / monero-gui

Monero: the secure, private, untraceable cryptocurrency
Other
1.76k stars 772 forks source link

šŸž Bug - Arch/Manjaro Linux - P2Pool permissions #4108

Open Rikj000 opened 1 year ago

Rikj000 commented 1 year ago

Issue Description

When installing monero-gui and p2pool from the official repositories on Arch/Manjaro Linux,
then p2pool will run into permission issues.

This happens because:

Fix Proposal

Alter the P2PoolManager to launch p2pool under a different working directory when running on Linux.

Reproduction steps

  1. Install the monero, monero-gui and p2pool packages on Arch/Manjaro from the Official Repositories (community)
  2. Run the monero-gui as the logged in user from CLI with:
    QT_QPA_PLATFORMTHEME=qt5ct monero-wallet-gui %u
  3. Start mining with p2pool through the monero-gui (Configured in the dropdown)
  4. Monitor the permission issues in the CLI output
    • At the start: monero-gui-p2pool-permission-issue
    • After a while of running: monero-gui-p2pool-peer-list-issue
  5. The monero-gui stays stuck with Network Status Connected + Mining and Mining Status Starting P2Pool monero-gui-stuck-starting-p2pool

Note

When starting p2pool manually from CLI as following,
then none of these permission issues occur

# Move to a directory where the currently logged in user has write-permissions
cd ~
# Run p2pool
p2pool
# Stop p2pool with CTRL+C and check if the p2pool.log file got created
ls -alh ~ | grep p2pool.log

Environment

Software Version Source
OS Manjaro Linux x86_64 Official Repositories (core)
Kernel 5.15.89-1-MANJARO Official Repositories (core)
QT5 5.15.8+kde+r174-1 Official Repositories (extra)
Monero 0.18.1.2-3 Official Repositories (community)
Monero GUI 0.18.1.2-2 Official Repositories (community)
P2Pool 2.7-1 Official Repositories (community)

Linked issues

selsta commented 1 year ago

p2pool integration was built with the portable binaries from getmonero.org in mind.

I thought about adding this for package managers: https://github.com/monero-project/monero-gui/pull/3926

Alter the P2PoolManager to launch p2pool under a different working directory when running on Linux.

What would you suggest here?

Rikj000 commented 1 year ago

Alter the P2PoolManager to launch p2pool under a different working directory when running on Linux.

What would you suggest here?

To modify the m_p2poolPath variable after the m_p2pool variable has been set in the P2PoolManager's constructor.

Something like:

#elif defined(Q_OS_UNIX)
    m_p2poolPath = QApplication::applicationDirPath();
    m_p2pool = m_p2poolPath + "/p2pool";
    m_p2poolPath = QString::fromStdString(tools::get_default_data_dir()) + "/p2pool/"; // A.k.a. m_p2poolWorkingDir

With above change,
the m_p2poold->setWorkingDirectory(m_p2poolPath); line of the P2PoolManager::start() function, should initialize the p2pool process under a write-able p2pool directory,
inside the already existing ~/.bitmonero folder.

However I didn't check the other occurrences/usages of m_p2poolPath in the rest of the P2PoolManager thoroughly.
To prevent breaking anything, it might be good to introduce a new variable for this, e.g. m_p2poolWorkingDir,