Welcome to the Linux Foundation Forum!

Exercise 2.6 Create a systemd file with vim not working

Hello,

I'm trying to create the file foo1.service as it states on the instructions in the exercise 2.6 under the path /usr/lib/sytemd/system/.

I'm using vim to create the file. After I'm done with the file, I try to write and quite :wq But I just get the message:

"foo1.service" E212: Can't open file for writing

What can be wrong here?

Comments

  • lee42x
    lee42x Posts: 380

    Normally one needs "root" access to modify files in the /usr/lib/systemd/system directory. Try:

    $ sudo vim /usr/lib/systemd/system/foo1.service

    Should fix the issue. The lab will get updated to be clearer.

  • @lee42x said:
    Normally one needs "root" access to modify files in the /usr/lib/systemd/system directory. Try:

    $ sudo vim /usr/lib/systemd/system/foo1.service

    Should fix the issue. The lab will get updated to be clearer.

    Thanks for the explanation! That worked.

    Also there is a typo in the instructions. Once you create the file, the next step is to do the following steps:

    systemctl daemon-reload
    systemctl start foo
    

    But we created the foo1 (as instructed) not the foo, so you get an error. Once you change the command to

    systemctl start foo1
    

    It gives the correct response.

  • lee42x
    lee42x Posts: 380

    Thank you , the names will get fixed,.

  • Hello,
    I suppose there is an error on Figure 2.28 of 2.1 Lab. The line for CGroups reports system.slice.
    I believe that Cgroup: /foo.slice/foo.service was correct.

    Thanks for your attention

Categories

Upcoming Training