Shiny-mirrors - A alternative to pacman-mirrors made in Rust Lang

Looking at the source code the permission denied error occurs when trying to create /tmp/shiny_mirrors.pid.

Try sudo rm /tmp/shiny_mirrors.pid?

2 Likes

This did help :ok_hand:

sudo rm /tmp/shiny_mirrors.pid
sudo shiny-mirrors refresh                                                                                                                       ✔ 
 173ms Global  : https://mirrors.manjaro.org/repo/
 248ms Germany : https://mirror.alpix.eu/manjaro/
 215ms Germany : https://mirrors.xtom.de/manjaro/
 187ms Germany : https://ftp.gwdg.de/pub/linux/manjaro/
 252ms Germany : https://mirror.23m.com/manjaro/
 220ms Germany : https://ftp.halifax.rwth-aachen.de/manjaro/
 295ms Germany : https://mirror.netcologne.de/manjaro/
 365ms Germany : https://mirror.seahost.de/manjaro/
The average Mirror Time was 244ms

The other system (where it did work) had a restart a few minutes ago

hint:

I did see this error-message more then once in the last weeks !
:footprints:

1 Like

I’d guess what happened is it crashed while running as a different user and left that file there which your current user doesn’t have permissions to.

As a suggestion to @Arisa qpidfile is a tiny crate with no dependencies which does this better (it implements the Drop trait so will clean up even if the application panics).

1 Like

This may be the case, but when the error did show, shiny-mirrors had been lauched with sudo, so it should have permission to delete leftovers :rofl:

P.S.:
I really like using shiny-mirrors. It seems to be excellent software. (But what software has zero bugs?)

1 Like

Ah yes, I only glanced at the code first time but looking further it flocks that file. So qpidfile crate isn’t a suitable replacement, maybe pidfile-rs or implement the Drop trait another way.

1 Like

Hello there, @MrLavender @andreas85

I was not checking the Manjaro forum in some while, in future if possible report these things on GitLab as I get specific notifications for that. I am sorry for the delayed response on here.

Likewise, I had the same thing occur to me but only once, and I thought it was just some fluke, it seems it wasn’t as by these reports.
I will definitely look at this and try to fix it soon, but the solution for now when this happens just do rm /tmp/shiny_mirrors.pid with root permissions.

Sorry everyone for the bug, this was using the kernel API(flock) for locking file and there wasn’t really rust safety included.

EDIT:

I am quite curious when this happens, I really can’t replicate it on demand.

1 Like

I didn’t open an issue myself because I don’t actually use shiny-mirrors, I was just trying to help @andreas85 :slightly_smiling_face:

Not certain about this, but it looks like one way to replicate would be be to turn off your network connection and then it will fail without releasing the flock?

Installed shiny-mirrors and first time running it:

sudo shiny-mirrors 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', shiny-mirrors/src/main.rs:47:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

Yes, i saw the previous report and how to fix it, just thought to report that the problem exists also on first run ever.

So, as requested, please report the error on GitLab…