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

Noob issue : "failed to retrieve some files" #50

Open
dhruv8sh-kdk opened this issue Dec 25, 2024 · 3 comments
Open

Noob issue : "failed to retrieve some files" #50

dhruv8sh-kdk opened this issue Dec 25, 2024 · 3 comments

Comments

@dhruv8sh-kdk
Copy link

So i keep hitting this error and I wonder if I'm doing something wrong.

fn main() {
    let root = "/home/user";
    let dbpath = "/home/user/.local/lib/pacman";
    let mut alpm = match alpm::Alpm::new(root, dbpath) {
        Ok(alpm) => alpm,
        Err(err) => {
            eprintln!("Failed to initialize ALPM: {}", err);
            return;
        }
    };
    let core = alpm
        .register_syncdb_mut("kde-unstable", SigLevel::USE_DEFAULT)
        .unwrap();

    core.add_server("http://mirror.4v1.in/archlinux/core/os/x86_x64").unwrap();
    // Added more servers here
    
    core.set_usage(Usage::SYNC | Usage::SEARCH).unwrap();
    match alpm.syncdbs_mut().update(true) {
        Ok(updated) => {
            if updated {
                println!("Database was updated." )
            } else {
                println!("Database is up to date.");
            }
        }
        Err(e) => {
            eprintln!("Failed to update database. {}", e);
        }
    }
}

@Morganamilo
Copy link
Member

If you add a logging callback you can see the mirror times out

registering sync database 'kde-unstable'
database path for tree kde-unstable set to /home/morganamilo/aa/sync/kde-unstable.db
"/home/morganamilo/aa/sync/kde-unstable.db" is not readable: No such file or directory
adding new server URL to database 'kde-unstable': http://mirror.4v1.in/archlinux/core/os/x86_x64
kde-unstable.db: url is http://mirror.4v1.in/archlinux/core/os/x86_x64/kde-unstable.db
kde-unstable.db: maxsize 134217728
kde-unstable.db: opened tempfile for download: /home/morganamilo/aa/sync/download-lVEAli/kde-unstable.db.part (wb)
kde-unstable.db: curl returned result 28 from transfer
failed retrieving file 'kde-unstable.db' from mirror.4v1.in : Connection timed out after 10001 milliseconds
kde-unstable.db: no more servers to retry
curl_download_internal return code is -1
failed to sync dbs: download library error
Failed to update database. download library error
unregistering database 'local'
unregistering database 'kde-unstable'

@dhruv8sh-kdk
Copy link
Author

This mirror is working with pacman just fine. I have also tested with more worldwide mirrors and local mirrors which are working just fine with pacman too. Might I add, I have also tested with core and extra repos as well.

I think there must be some other underlying issue.
Could you please provide me with the code for the callback you are using.

@Morganamilo
Copy link
Member

use alpm::*;

fn main() {
    let root = "/home/user";
    let mut alpm = match alpm::Alpm::new(root, dbpath) {
        Ok(alpm) => alpm,
        Err(err) => {
            eprintln!("Failed to initialize ALPM: {}", err);
            return;
        }
    };
    alpm.set_log_cb((), logcb);
    let core = alpm
        .register_syncdb_mut("kde-unstable", SigLevel::USE_DEFAULT)
        .unwrap();

    core.add_server("http://mirror.4v1.in/archlinux/core/os/x86_x64")
        .unwrap();
    // Added more servers here

    core.set_usage(Usage::SYNC | Usage::SEARCH).unwrap();
    match alpm.syncdbs_mut().update(true) {
        Ok(updated) => {
            if updated {
                println!("Database was updated.")
            } else {
                println!("Database is up to date.");
            }
        }
        Err(e) => {
            eprintln!("Failed to update database. {}", e);
        }
    }
}

fn logcb(_level: LogLevel, msg: &str, _: &mut ()) {
    print!("{msg}");
}

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