Skip to content

Conversation

Stebalien
Copy link
Member

As pointed out by @MrCowKing in, "${HOME}" isn't expanded. We use the state directory as that's guaranteed to exist (and, in the default configuration, will match the "HOME" directory of the ipfs user).

See: b47ecd0#commitcomment-83565661

@aschmahmann aschmahmann requested a review from Jorropo August 21, 2023 13:44
@aschmahmann aschmahmann requested a review from a team as a code owner August 21, 2023 13:44
@gammazero
Copy link
Contributor

gammazero commented May 30, 2025

We may want to use the "data" (%D) directory instead of the "state" (%S) directory, since the contents of the ipfs repo may be considered more important that non-critical state.

State directory %S

This is either /var/lib (for the system manager) or the path $XDG_STATE_HOME resolves to (for user managers).

The XDG_STATE_HOME environment variable specifies the base directory for user-specific state files. It defaults to $HOME/.local/state if not set or empty. This directory is used for persistent data that should survive application restarts but is not crucial enough to be stored in XDG_DATA_HOME.

Data directory %D

This is either /usr/share/ (for the system manager) or the path $XDG_DATA_HOME resolves to (for user managers).

The XDG_DATA_HOME defines the base directory where user-specific data files are stored. If XDG_DATA_HOME is not set or is empty, it defaults to $HOME/.local/share.

Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a problem for upgrade/migration is it changes the location of the ipfs repo. The user will need to manually move the repo to the new location before upgrade.

Group=ipfs
StateDirectory=ipfs
Environment=IPFS_PATH="${HOME}"
Environment=IPFS_PATH="%S"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Environment=IPFS_PATH="%S"
Environment=IPFS_PATH="%D"

Seems more appropriate to use "data" directory instead of "state" directory.

Group=ipfs
StateDirectory=ipfs
Environment=IPFS_PATH="${HOME}"
Environment=IPFS_PATH="%S"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Environment=IPFS_PATH="%S"
Environment=IPFS_PATH="%D"

@gammazero gammazero requested review from a team and removed request for Jorropo May 30, 2025 21:24
As pointed out by @MrCowKing in, "${HOME}" isn't expanded. We use the
state directory as that's guaranteed to exist (and, in the default
configuration, will match the "HOME" directory of the ipfs user).

See: b47ecd0#commitcomment-83565661
@gammazero gammazero added the need/triage Needs initial labeling and prioritization label May 30, 2025
@hsanjuan
Copy link
Contributor

hsanjuan commented Jun 2, 2025

I think the systemd file doesn't work at all without modifications, probably for the reason mentioned.

Also note this is hardcoded: ReadWritePaths="/var/lib/ipfs/" which I think also breaks ipfs running with a repository outside that folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
No open projects
Status: 🔎 In Review
Development

Successfully merging this pull request may close these issues.

3 participants