Offline docs missing?

I feel silly with this post but I checked everywhere.

Did the

rustup component add/remove rust-docs

multiple times to the same effect. ndex is present. Also book is present in a different directory but only has the index.html as well.

This is PopOS (linux) install. Using the .sh in the instructions. I've also just uninstalled and reinstalled just now and same issue.

What happens when you run rustup doc in your console?

I get an index page opened in a browser, that also lives in it's own separate doc directory but none of the hlinks resolve to anything that exists on the local drive because they all point to sub directories in the same location. Naturally the web links work fine.

Also --std and --book options open in different ../doc/ directories. All have index.html files only.

What toolchain (e.g. stable 1.88.0) and platform (e.g. x86_64-unknown-linux-gnu) are you working on?

correct

❯ rustup --version
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.88.0 (6b00bc388 2025-06-23)

I run the same locally and my docs (located at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/) open fine. The rustup component history also says the rust-docs component should be available. I don't know what's wrong with your local installation.

Thanks. It's a clue. Looks like the files are where you pointed to. But they all resolve back to the /run/user/... directory so links are all still broken. I'm a bit new to linux, returning to it after a long hiatus. I'll look into what might be going on when I learn what the /run/user/* directories are supposed to be used for

/run/user/... is a temporary file system for the given login session. Rustup should not be putting anything there. Something is probably wrong or highly unusual in your environment.

Is this a normal Linux install of a normal desktop OS? Or something more exotic? Any unusual environment variables?

What web browser are you using, and how did you install the browser?

This reminds me of a problem I encountered with google chrome installed through a flatpak on fedora silverblue. I had to use flatpak override --user --filesystem=home com.google.Chrome to give it access to my home dir.

3 Likes

you omitted the actual file path, but it looks like an xdg portal mapped path, so I'm guessing you are probably using a sandboxed browser.

as @kingparra said, you have to explicitly grant local filesystem access to the browser app.

alternatively, you can start a local http server, and point the browser to the url, something like http://localhost:8000/htm/index.html, you only need to serve static files, so you can use any http server you like.


shameless plug

I also wrote a simple program for this exact use case:

GitHub - nerditation/cargo-serve-doc: serve local `cargo doc` artifacts over http

the basic usage is to serve local build of crate docs, it use $CARGO_MANIFEST_DIR/target/doc/ as the http server root directory. when the open subcommand is given, it is expected to be called by cargo doc --open as a proxy command for your browser and convert the command line argument, which should be a local file path, into the corresponding url.

# build the doc
$ cargo doc
# serve the doc
$ cargo serve-doc &
# open your favorite browser, default port is 8000
$ flatpak run org.mozilla.firefox http://localhost:8000/CRATENAME/index.html

# or combine the above commands into a single one:
$ cargo serve-doc open --build

when use the --rustup option, this tool can also serve the the toolchain docs (i.e. the rust-docs component of rustup), it calls rustup doc --path to get the locaiton of the doc files instead of $CARGO_MANIFEST_DIR/target/doc, and start the http server there, extra command line arguments are appended to rustup doc --path, for example:

# by default opens the rust documentation landing page
$ cargo serve-doc open --rustup
# open the book
$ cargo serve-doc open --rustup -- --book
# open the documentation of `core`
$ cargo serve-doc open --rustup core

I wrote this tool for personal use, so I didn't bother to write much documentation, but it's a simple tool with not much functionalities really. in case you need more than what I have in mind, the source code is there, happy hacking and have fun.

2 Likes

Thanks the browser was flatpak installed. I didn't think I'd had it installed that way. I just uninstalled and reinstalled via apt. Everything working now.

I appreciate your patience for such a silly question.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.