# Having trouble installing Qtile through ports / understanding ports



## lv426 (Dec 2, 2022)

Greetings, new FreeBSD 13.1 user here.

I am trying to install the Qtile window manager and am having a hell of a time. I have been using the FreeBSD Handbook up until this point and it has been great. However, when it comes to installing packages and ports, I am getting overwhelmed.

Qtile can be found using `pkg search qtile` and returns the package `py39-qtile`. I installed this using `sudo pkg install py39-qtile`. It seemed to install successfully. I added `exec /usr/local/bin/qtile start` to my `.xinitrc` file. When running `startx`, I would get a blackscreen, then it would return to the console. I don't remember the exact error, because I am long past this part. Something about libgdk pixbuf, which doesn't seem to be a required dependency. I tried rebooting, but that didn't solve the issue. I know Xorg works because I can run `su startx` and get into Tom's Window Manager. My user is already part of the `wheel` and `video` groups.

I uninstalled Qtile using `sudo pkg delete py39-qtile`. Then I tried to install it using ports. This is where I got completely lost.

> When installing FreeBSD, I explicitly chose to install the ports.

I ran `cd /usr/ports/x11-wm/qtile` which is what is listed on Freshports for Qtile. *Here I found out that the ports version of Qtile was significantly* *older than the `pkg` version, which was already a year old itself...* Regardless, I wanted to see if it would work. I then ran `make install clean`. This is where things got overwhelming. The console was just flooded with information. Then these pop-ups in blue windows (similar to the FreeBSD installer) appeared, asking me to confirm certain dependencies. I read some of the dependency names and they didn't seem to match the ones Qtile needed... It was like a bunch of extra Python stuff. It must have taken 10 minutes and 20 pop-ups to complete. After installation, I went to confirm if Qtile was installed using `which` and it returned nothing. I tried `whereis` and it just points the ports folder. So, lost again, I rebooted.

Now I thought maybe the problem was ports were way out of date. I returned to the Handbook for help. After trying to find how to update ports, I found this *Warning: "Before compiling any port, be sure to update the Ports Collection as described in the previous section." *So, I am looking around for this previous section. Where is it? I tried `git -C /usr/ports pull` but it's not a git directory. I scrolled up more and tried `pkg update -f`. This updated the repositories, but when I checked Qtile, it was still version 0.14, whereas the pkg was 0.18. *So I had to deviate from the Handbook because I have no clue what to do*. A Google result said I need to use `portsnap fetch` and then `portsnap extract`. *Neither of these commands are listed in the Handbook.* I ran both these commands. The latter must have taken 10-12 minutes, because it rebuilt the entire ports directory. It did update though. Qtile is now 0.18. So I ran through the steps again. `cd /usr/ports/x11-wm/qtile && cd make install clean`. This time however was very different. I only got 2 pop-ups and the install finished very quickly. I ran `startx` but still had the same issue. Qtile will not launch. It says Qtile cannot be found, there also keybinding errors, and xinit connection to the server lost.

Any help would be appreciated. I am coming from Arch Linux and have used the AUR before which is supposed to be similar to ports. Never expected this much trouble.


----------



## richardtoohey2 (Dec 2, 2022)

Stick to one or the other, don’t mix them up.

As a new user stick to binary packages.

If something doesn’t work in packages stop there and ask for help.

Don‘t type random commands from the internet because as you’ve discovered things go downhill fast. 

So you’ve made a Frankenstein installation of ports and packages - might be best using pkg delete to clean everything up and then starting with packages again.

I don’t mean that rudely - you were just trying to get it to work but have ended up in a pickle so best to go back a couple of steps.

Get yourself back to where you were and hopefully someone can help with the qtile issue when installed from a package.


----------



## SirDice (Dec 2, 2022)

-RELEASE versions use quarterly packages by default. The ports tree is latest. That's where the version differences come from.

The ports tree that's on the install media is old, it was made when the -RELEASE was created.


----------



## lv426 (Dec 2, 2022)

richardtoohey2 said:


> Stick to one or the other, don’t mix them up.
> 
> As a new user stick to binary packages.
> 
> ...


No offense taken.

I already did `pkg delete py39-qtile` and also ran `make clean` inside `/usr/ports/x11-wm/qtile`. I rebooted and tried installing the binary package agian, but I still can't load in with startx.

I did some Googling and there was a hacky suggestion to add `sleep 1000000` to your `.xinitrc` file. I tried this, but Qtile still didn't work. Not really sure what to do at this point.



SirDice said:


> -RELEASE versions use quarterly packages by default. The ports tree is latest. That's where the version differences come from.
> 
> The ports tree that's on the install media is old, it was made when the -RELEASE was created.


Good to know. Thanks!

So, what I should have done, as per the Handbook, is made a new directory, change a line in the .conf file, and ran `pkg update -f`.

Have I made a mess by running this `portsnap` command? I mean, I have the latest ports verison now, but maybe it will cause problems in the future? Is this the reason `portsnap` and similar commands are not listed in the Handbook? Are they deprecated? All the Google searches I did about ports recommended these commands, but there is nothing about in the Handbook.


----------



## SirDice (Dec 2, 2022)

If you want to keep your ports tree more "in sync" with the quarterly binary packages, you need to use net/gitup or devel/git to get the ports tree. You can also update the ports tree using portsnap(8) but it can only fetch the latest version of the ports tree. 

It's up to you what to do, keep using portsnap(8) and switch to the latest packages. Or use git(1) or gitup(1) to match the ports tree with the quarterly packages. 



lv426 said:


> Is this the reason `portsnap` and similar commands are not listed in the Handbook? Are they deprecated?


portsnap(8) is going to disappear some time in the future. The biggest 'problem' is that it requires specific infrastructure to provide the snapshot files (the other tools use the existing git infrastructure). The other issue is that it can only track 'latest'.


----------



## lv426 (Dec 10, 2022)

Just wanted to saying I got Qtile working today, though the solution is very hacky. Hopefully this helps someone if you come across this post from Google.

First, if you made a mess trying to install the binary version, then the ports version, like I did, run `sudo pkg autoremove`

1. Install `gdk-pixbuf2-2.42.9` or newer. This is a dependecy for Qtile, but for some reason *it's not included... *Qtile won't run without this.
2. Download the default configuration file . For some reason this also is not included in the FreeBSD install. You will need to make the directory `.config/qtile` and paste the default configuration file into `.config/qtile/config.py`
3. In your `.xinitrc` add 

```
qtile start &
sleep 1000000
```
After these 3 steps, Qtile should be working. This was tested on a fresh install of FreeBSD 13.1.

*Issues:*
- The hacky solution I mentioned above is using `sleep 1000000` to keep Qtile "alive" for 277+ hours. This is the only way it will launch.
- You cannot use `shutdown` from either Qtile's menu or the terminal using the method above. You will just get a black screen.
- To shutdown you need to switch to a tty.


----------

