Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port 7878 closed(???) [Fixed] #26

Closed
cmsigler opened this issue Dec 5, 2020 · 11 comments
Closed

Port 7878 closed(???) [Fixed] #26

cmsigler opened this issue Dec 5, 2020 · 11 comments

Comments

@cmsigler
Copy link
Contributor

cmsigler commented Dec 5, 2020

Hello nroi,

First, thank you for flexo, which I'm attempting to use for the first time. I appreciate the name and hope you'll adopt a suitable cartoon icon as the project logo, assuming no copyright issues....

I am a long time Archer, but I feel like a total n00b. I installed flexo-git from AUR. The only flexo.toml edit I made was to set low_speed_limit. 'port = 7878' is unchanged in flexo.toml. I systemctl started and enabled flexo, and it's running --

$ systemctl status flexo | cat
● flexo.service - central pacman cache
Loaded: loaded (/usr/lib/systemd/system/flexo.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-12-05 11:22:52 EST; 4s ago
Main PID: 66408 (flexo)
Tasks: 1 (limit: 35952)
Memory: 2.4M
CGroup: /system.slice/flexo.service
└─66408 /usr/bin/flexo

Dec 05 11:22:52 vagente595 systemd[1]: Started central pacman cache.
Dec 05 11:22:52 vagente595 flexo[66408]: [2020-12-05T16:22:52.049Z INFO flexo] Will switch mirror if download speed falls below 1.20 MiB/s

But port 7878 is closed :( --

$ nmap -p 7878 localhost
Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-05 11:24 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00010s latency).
Other addresses for localhost (not scanned): ::1

PORT STATE SERVICE
7878/tcp closed owms

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds

iptables, ip6tables and nftables services aren't enabled or running. I don't have any iptables or nftables packet filtering in place --

$ sudo iptables -vS
-P INPUT ACCEPT -c 16745 3135815
-P FORWARD ACCEPT -c 0 0
-P OUTPUT ACCEPT -c 18248 1334084
$ sudo ip6tables -vS
-P INPUT ACCEPT -c 30266 49863949
-P FORWARD ACCEPT -c 0 0
-P OUTPUT ACCEPT -c 27922 2447847
$ sudo nft list ruleset
$
$ sudo nft list tables
$

To add insult to injury, I installed pacoloco-git and systemctl started that after stopping flexo, and that port is open --

$ nmap -p 9129 localhost
Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-05 11:36 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00013s latency).
Other addresses for localhost (not scanned): ::1

PORT STATE SERVICE
9129/tcp open unknown

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds

... so I don't appear to have any networking misconfiguration. This is such a beginner problem! Why am I an idiot? Thank you for any help you can provide :)

Clemmitt Sigler

@nroi
Copy link
Owner

nroi commented Dec 5, 2020

I guess you're just a bit impatient: Flexo performs latency test at the first start, so it does not immediately listen on the port. Could you try after maybe 3 minutes or so? You should then see messages like the following in the log:

Dec 05 17:51:04 archWS flexo[21332]: [2020-12-05T16:51:04.531Z INFO  flexo] Primary mirror: "https://archlinux.mailtunnel.eu/"
Dec 05 17:51:04 archWS flexo[21332]: [2020-12-05T16:51:04.610Z INFO  flexo::mirror_flexo] Retrieved 5085 files with a total size of 18.08 GiB from local file system.

The next start of Flexo should be speedier, because after the first latency test, only a select few mirrors are tested because Flexo only considers mirrors from those locations that were fast during the first latency test.

I guess I could somehow improve this from a usability perspective. Even if it "works as intended", it's understandable that users are puzzled if nothing happens after the first startup for a minute or so.

@nroi
Copy link
Owner

nroi commented Dec 5, 2020

Or maybe there's something else going on… Could you please post the output of:

pacman -Qi flexo-git

@cmsigler
Copy link
Contributor Author

cmsigler commented Dec 5, 2020

Hi,

Me, impatient? ... How did you know? ;D OK, first --

$ pacman -Qi flexo-git
Name : flexo-git
Version : 1.0.7.r2.g2a2df95-1
Description : A central pacman cache
Architecture : x86_64
URL : https://github.com/nroi/flexo
Licenses : MIT
Groups : None
Provides : flexo
Depends On : curl
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 2.25 MiB
Packager : Unknown Packager
Build Date : Sat 05 Dec 2020 09:41:00 AM EST
Install Date : Sat 05 Dec 2020 09:42:44 AM EST
Install Reason : Explicitly installed
Install Script : Yes
Validated By : None

Well, now I see there's a problem. The process seems to die then auto-restart (I'm not an expert on systemd) --

$ systemctl status -n 50 flexo | cat
● flexo.service - central pacman cache
Loaded: loaded (/usr/lib/systemd/system/flexo.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-12-05 12:14:15 EST; 404ms ago
Process: 71971 ExecStart=/usr/bin/flexo (code=exited, status=1/FAILURE)
Main PID: 71971 (code=exited, status=1/FAILURE)

This seems to happen over and over again. After I stop flexo I see this --

Dec 05 12:15:51 vagente595 systemd[1]: Started central pacman cache.
Dec 05 12:15:51 vagente595 flexo[72177]: [2020-12-05T17:15:51.928Z INFO flexo] Will switch mirror if download speed falls below 1.20 MiB/s
Dec 05 12:15:56 vagente595 flexo[72177]: [2020-12-05T17:15:56.066Z ERROR flexo] Unable to find remote mirrors that match the selected criteria.
Dec 05 12:15:56 vagente595 systemd[1]: flexo.service: Main process exited, code=exited, status=1/FAILURE
Dec 05 12:15:56 vagente595 systemd[1]: flexo.service: Failed with result 'exit-code'.
Dec 05 12:15:59 vagente595 systemd[1]: flexo.service: Scheduled restart job, restart counter is at 79.
Dec 05 12:15:59 vagente595 systemd[1]: Stopped central pacman cache.
Dec 05 12:15:59 vagente595 systemd[1]: Started central pacman cache.
Dec 05 12:15:59 vagente595 flexo[72195]: [2020-12-05T17:15:59.178Z INFO flexo] Will switch mirror if download speed falls below 1.20 MiB/s
Dec 05 12:16:03 vagente595 flexo[72195]: [2020-12-05T17:16:03.914Z ERROR flexo] Unable to find remote mirrors that match the selected criteria.
Dec 05 12:16:03 vagente595 systemd[1]: flexo.service: Main process exited, code=exited, status=1/FAILURE
Dec 05 12:16:03 vagente595 systemd[1]: flexo.service: Failed with result 'exit-code'.
Dec 05 12:16:07 vagente595 systemd[1]: flexo.service: Scheduled restart job, restart counter is at 80.
Dec 05 12:16:07 vagente595 systemd[1]: Stopped central pacman cache.

80 restarts :\ I did nothing but use yay to build and install flexo-git, then add low_speed_limit to flexo.toml. I didn't screw around with any file permissions under /var/cache/flexo, or anything else like that :(

I have even tried logging out and back in again in case it had to do with /etc/passwd, /etc/group.

I would be very happy to help debug, please let me know how I can help :) And thank you for everything!

Clemmitt

@nroi
Copy link
Owner

nroi commented Dec 5, 2020

Could you first upgrade Flexo and try again? I pushed a new version just a few minutes before you have opened this issue. pacman -Qi flexo-git should show the following:

Version         : 1.0.8.r0.g9a02658-1

@cmsigler
Copy link
Contributor Author

cmsigler commented Dec 5, 2020

Hi,

OK, with the new version flexo is no longer loop crashing. Here's systemctl status --

$ systemctl status -n 50 flexo | cat
● flexo.service - central pacman cache
Loaded: loaded (/usr/lib/systemd/system/flexo.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-12-05 12:31:33 EST; 3min 37s ago
Main PID: 83760 (flexo)
Tasks: 1 (limit: 35952)
Memory: 2.3M
CGroup: /system.slice/flexo.service
└─83760 /usr/bin/flexo

Dec 05 12:31:33 vagente595 systemd[1]: Started central pacman cache.
Dec 05 12:31:35 vagente595 flexo[83760]: [2020-12-05T17:31:35.504Z INFO flexo] No cached latency test results available. Continue to run latency tests on all mirrors.
Dec 05 12:32:06 vagente595 flexo[83760]: [2020-12-05T17:32:06.005Z INFO flexo] Primary mirror: "https://mirror.osbeck.com/archlinux/"
Dec 05 12:32:06 vagente595 flexo[83760]: [2020-12-05T17:32:06.006Z INFO flexo::mirror_flexo] Retrieved 0 files with a total size of 0.00 B from local file system.

TCP port 7878 is open now. But "0 files from local file system" seems strange because my local /var/cache/pacman/pkg/ is 16 GiB in size.

I can now run pacman with the flexo proxy cache.... I've got a /var/cache/flexo/state/latency_test_results.json file, but it didn't seem to proxy cache anything although 4 pkgs were upgraded --

$ find /var/cache/flexo/ ! -type d -print | sort
/var/cache/flexo/state/latency_test_results.json

I'm afraid I'm being stupid again. My first Server line in mirrorlist is --

Server = http://localhost:7878/$repo/os/$arch

Please let me know if PEBKAC :\

Clemmitt

Edit: Removed unneeded word

@cmsigler
Copy link
Contributor Author

cmsigler commented Dec 5, 2020

Hi again nroi,

Perhaps this issue should be closed as fixed since the TCP port issue is solved. I will flag for closing with this comment.

I will open a new issue if flexo isn't proxy caching. Again, thank you for your timely support :)

Clemmitt

@cmsigler cmsigler closed this as completed Dec 5, 2020
@cmsigler cmsigler changed the title Port 7878 closed(???) Port 7878 closed(???) [Fixed] Dec 5, 2020
@nroi
Copy link
Owner

nroi commented Dec 5, 2020

It looks like you previously ran into this bug: #23
I'm glad this works now.

I think you're mixing up two different directories: Pacman uses the CacheDir configured in /etc/pacman.conf. All files that are downloaded by pacman are stored in this directory. If a file already exists in this directory, pacman isn't going to download it again. Flexo on the other hand uses the cache_directory configured in /etc/flexo/flexo.toml. It doesn't care about pacman's CacheDir.

So the message Retrieved 0 files with a total size of 0.00 B from local file system. initially appears because no files are present in Flexo's cache_directory, which is different from /var/cache/pacman/pkg.

You can try the following:

  1. Follow the log with journalctl -f --unit=flexo
  2. Download a package that you haven't downloaded before, e.g. pacman -S --downloadonly cowsay. If this works as intended, you should now see something like Attempt to create file: "/var/cache/flexo/pkg/extra/os/x86_64/cowsay-3.04-2-any.pkg.tar.zst" in your log. This means that Flexo has downloaded the file from a remote mirror.
  3. Remove the file from you pacman's CacheDir (not the flexo cache directory). By default, this is /var/cache/pacman/pkg/. This way, pacman has no way to facilitate its own cache, so it has to make an HTTP request to download the package.
  4. Download the same file again with pacman -S --downloadonly cowsay. If this also works as intended, then you should see something like the following in your log: Request served: "extra/os/x86_64/cowsay-3.04-2-any.pkg.tar.zst", but you shouldn't see the message Attempt to create file: […] appear a second time in the log, because it has already been created. This means Flexo has served the file from its cache.

@cmsigler
Copy link
Contributor Author

cmsigler commented Dec 5, 2020

Hi one last time,

Just to follow up, flexo is now working for me as intended :) Yes, after I posted that reply I wondered if that message was referencing files under /var/cache/flexo/pkg. So, once I did things correctly the newly installed ffmpeg pkg is cached as /var/cache/flexo/pkg/extra/os/x86_64/ffmpeg-2:4.3.1-3-x86_64.pkg.tar.zst

Downloading that pkg was very slow :( Perhaps I need to edit flexo.toml to set 'mirror_selection_method = "predefined"' and populate the 'mirrors_predefined = []' list(?). I'm spoiled because I use yay with powerpill on my boxes and have an excellent mirrorlist produced via rankmirrors.

Thank you again for your nearly instantaneous support :)

Clemmitt

@nroi
Copy link
Owner

nroi commented Dec 5, 2020

Downloading that pkg was very slow :(

Have you tried increasing the low_speed_limit setting?

Perhaps I need to edit flexo.toml to set 'mirror_selection_method = "predefined"' and populate the 'mirrors_predefined = []' list(?).

This could also solve your problem, but this would be more of a workaround than a fix. You would have to manually edit this list when a mirror is put offline. The low_speed_limit is used to handle the case when you got unlucky and have selected a slow mirror, so maybe try that first.

@cmsigler
Copy link
Contributor Author

cmsigler commented Dec 5, 2020

Hi again,

The low_speed_limit is used to handle the case when you got unlucky and have selected a slow mirror, so maybe try that first.

Aha! OK, that makes sense. I will go forth and do :) Again, many thanks!

Clemmitt

@nroi
Copy link
Owner

nroi commented Dec 5, 2020

If the downloads are still slow even with low_speed_limit set to an appropriate value, then I consider this a bug, so feel free to open a new issue in case that happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants