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

CRIU RPC request failed with message: error:56 #21

Open
zhaohang15639535703 opened this issue Oct 25, 2024 · 1 comment
Open

CRIU RPC request failed with message: error:56 #21

zhaohang15639535703 opened this issue Oct 25, 2024 · 1 comment

Comments

@zhaohang15639535703
Copy link

zhaohang15639535703 commented Oct 25, 2024

let mut criu = rust_criu::Criu::new().expect("unable to new a criu");
    match criu.get_criu_version() {
        Ok(version) => info!("criu version: {}", version),
        Err(e) => error!("{:#?}", e),
    };

    
    let image_dir = format!("images_{}", pid);
    if Path::new(&image_dir).exists() {
        warn!("image directory exists");
        if let Err(e) = std::fs::remove_dir_all(&image_dir) {
            error!("Failed to remove existing directory '{}': {:#?}", image_dir, e);
            return Err(anyhow!("remove existing directory failed"));
        }
    }
    if let Err(e) = std::fs::create_dir(&image_dir) {
        error!("Failed to create directory '{}': {:#?}", image_dir, e);
        return Err(anyhow!("create dirctory fails"));
    }

    let directory = std::fs::File::open(&image_dir)?;
    
    criu.set_pid(pid); // set target pid
    criu.set_images_dir_fd(directory.as_raw_fd()); // set temporary file
    criu.set_log_file(format!("{}/dumppp.log", image_dir));
    criu.set_log_level(4);
    criu.set_leave_running(false); // set process to stop when dumping is done

    
    // do dump
    info!("dumping process {}",pid);
    criu.dump().map_err(|e| anyhow!("dump fails:{:#?}",e))?;

When I run this code i got an error: Error: dump fails:"CRIU RPC request failed with message: error:56".Is there any solution?

@adrianreber
Copy link
Member

Works for me. Are you running is as root? Are you using it on Linux? Any information about your system and environment?

I get:

target/debug/rust-criu-test /usr/sbin/criu
Version from CRIU found in $PATH: 31900
Version from /usr/sbin/criu: 31900
Dumping PID 3266180
Restoring PID 3266180
Cleaning up

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