archlinux / archinstall

Arch Linux installer - guided, templates etc.
GNU General Public License v3.0
6.32k stars 542 forks source link

archinstall tries installing on import. #2728

Open git-girl opened 1 month ago

git-girl commented 1 month ago

Which ISO version are you using?

(git latest but also 2.8.6-1 but since longer afaik)

The installation log

this is not about that.

describe the problem

Description of the issue

importing archinstall

git clone https://github.com/archlinux/archinstall.git
cd archinstall
python
import archinstall

archinstall will try to do an installation. =>

/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.201 (2024-10-02) and kernel driver (unknown version).
Not enough permission to place log file at /var/log/archinstall/install.log, creating it in /tmp/archinstall/install.log instead
Archinstall requires root privileges to run. See --help for more.

(also just on archinstall --version)

Imo this is especially annoying, bc there is tooling such as pydoc that when just searching with -k will evaluate everything on the system. So when i go to look at docs archinstall tries to do an archinstall. If I were a bit more stupid then i already am and maybe run pydoc -k something as euid 0 then i do archinstall? (it just crashes ftr)

svartkanin commented 1 month ago

It isn't doing an installation, it's trying to read your available devices which requires root privileges. What hppens if you run the above in a root shell?

git-girl commented 1 month ago

It isn't doing an installation, it's trying to read your available devices which requires root privileges. What hppens if you run the above in a root shell?

oki yes it is trying to open devices. i think this is kinda besides the point though as it trying to do so when being evaluated seems rather not good regardeless. like it shouldn't interfer with this. (ig maybe we just arent on the same side if u are trying to troubleshoot and i'm trying to get thing recognized as this is issue)

when i run the explicit import archinstall in python running as root nothing happens.

best regards

Torxed commented 1 month ago

I agree that simply importing the library shouldn't trigger things. It's fine for what we use it for so I've let it slide for a few years now.

We should change this behavior, but I'll be upfront and say that this is a low priority fix personally.

svartkanin commented 1 month ago

We can definitely lazy load it, but generally archinstall will not work without root, so even if lazy loaded it may break shortly after anyways

Torxed commented 1 month ago

In the old days, dinosaur times, the tool could also be used as Python lib to do package search and stuff. If you wanted to avoid using subprocess yourself. But it's a very small use case that doesn't require root that's for sure.