Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't edit a service file in system directory - Read-only file system

I want to edit a service file located in /usr/lib/systemd/system. Even if I edit it as root (sudo), it says Can't open file for writing.

I thought it's a permission problem, but when trying to add rights to the file I get: chmod: changing permissions of 'flannel-docker-opts.service': Read-only file system.

Since that isn't media(USB or something), I don't think I should mount it?

I'm on coreOS btw.

like image 976
mythic Avatar asked Dec 21 '25 07:12

mythic


1 Answers

This problem was more specific to Container Linux (specifically coreOS).

There are two methods of overriding default container Linux settings:

  1. Copying the unit file from /usr/lib64/systemd/system to /etc/systemd/system and modifying the chosen settings
  2. Using systemd drop-in units

I've used the latter.

I was configuring a file flannel-docker-opts.service located in the system direcotry. I solved it using a system drop-in. First step was creating a directory flannel-docker-opts.service.d in /etc/systemd/system. I created a configuration file in that directory, with my changes.

More info in the official coreOS documentation

like image 200
mythic Avatar answered Dec 23 '25 22:12

mythic