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

Failed changing permissions of directory "/usr/lib64/netopeer2-server" (Read-only file system) #1619

Closed
marvinthepa opened this issue Aug 6, 2024 · 2 comments · Fixed by #1620
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)

Comments

@marvinthepa
Copy link
Contributor

marvinthepa commented Aug 6, 2024

Hey,

I encountered a problem with netopeer2-server-2.1.71-1.el8.x86_64

I don't know if this is an issue with this repo or someone elses build configuration, as I have a hard time finding out who built this package and what the configuration was (see SERVER_DIR below).
But maybe you can enlighten me.

When using a request that changes the candidate target and then commits:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
  <edit-config>
    <target>
      <candidate/>
    </target>
    <config>
      <system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
        <hostname>foobar</hostname>
      </system>
    </config>
  </edit-config>
</rpc>

<rpc  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="102">
  <commit>
    <confirmed/>
  </commit>
</rpc>

The following error is logged:

Failed changing permissions of directory "/usr/lib64/netopeer2-server" (Read-only file system)

I managed to track down the error to the following line in the systemd unit file:

which mounts /usr read only:

$ man systemd.exec
...
       ProtectSystem=
           Takes a boolean argument or the special values "full" or "strict". If true, mounts the /usr and /boot directories read-only 
           processes invoked by this unit.

in combination with SERVER_DIR being /usr/lib64/netopeer2-server in that build (I don't know if that comes from your repo or the distro build config), the directory cannot be written/created/chmodded.

This:

set(SERVER_DIR "/var/netopeer2")

looks like it should be set to /var/netopeer2 instead, but it seems like it is not..

I guess

-DSERVER_DIR=%{_libdir}/netopeer2-server

is the culprit, maybe this should not use _libdir, but some /var-like directory, like in the debian build:

dh_auto_configure --builddir=build -- -DCMAKE_BUILD_TYPE="Release" -DENABLE_TESTS=OFF -DBUILD_CLI=ON -DSYSREPO_SETUP=OFF -DPIDFILE_PREFIX=/run -DSERVER_DIR=/var/lib/netopeer2

Changing server_dir via the -f option (or, less safe, changing ProtectSystem from yes to no) is a usable workaround for now.

@jktjkt
Copy link
Contributor

jktjkt commented Aug 6, 2024

Nice work debugging this, and the .spec file looks very broken to me. There's no point in a NETCONF server writing to /usr.

I agree that _libdir is a wrong macro to use, this belong to /var or even /run, based on your platform's preferences and conventions. IIRC these spec files are there just on a best-effort basis to aid the real packagers. The maintainer of this repo is not building these packages AFAIK, but maybe someone will correct me.

I have a hard time finding out who built this package

That looks like a root cause of your problem, and you'll need to track that person down and point them to this issue. Even if we change this in the repo, you'll need "someone" to push you an updated package obviously. Many tools like dnf and what not will tell you what repo a package comes from, and hopefully that repo has a web interface or a documentation somewhere.

@marvinthepa
Copy link
Contributor Author

I have a hard time finding out who built this package
That looks like a root cause of your problem

Actually, the team that I am visiting were building the package themselves using your "example" spec.. 😀

So fixing it in your repo would actually fix it for us. Pull request attached, would be very much appreciated if you would consider it.

michalvasko pushed a commit that referenced this issue Aug 13, 2024
Fixes #1619.

Co-authored-by: Martin Sander <martin_sander@genua.de>
@michalvasko michalvasko added is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...) labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants