Welcome to the Linux Foundation Forum!

Lab 2.1 Can’t delete mycgroup.

Dumb question. But after doing the lab I’m unable to clean up and delete the cgroup that was created. I’m using the LF pre-built Ubuntu 18.04 on Vmware Workstation 15 Player. I’ve completed the lab successfully, but now I get this.

  1. student@ubuntu:/sys/fs/cgroup/freezer$ ll
  2. total 0
  3. dr-xr-xr-x 4 root root 0 Sep 8 07:45 ./
  4. drwxr-xr-x 15 root root 380 Sep 8 07:17 ../
  5. -rw-r--r-- 1 root root 0 Sep 8 07:44 cgroup.clone_children
  6. -rw-r--r-- 1 root root 0 Sep 8 09:40 cgroup.procs
  7. -r--r--r-- 1 root root 0 Sep 8 07:44 cgroup.sane_behavior
  8. drwxr-xr-x 2 root root 0 Sep 8 07:45 mycgroup/
  9. -rw-r--r-- 1 root root 0 Sep 8 07:44 notify_on_release
  10. -rw-r--r-- 1 root root 0 Sep 8 07:44 release_agent
  11. -rw-r--r-- 1 root root 0 Sep 8 07:44 tasks
  12. drwxr-xr-x 5 root root 0 Sep 8 07:44 user/
  13. student@ubuntu:/sys/fs/cgroup/freezer$ sudo rm -r mycgroup
  14. rm: cannot remove 'mycgroup/cgroup.procs': Operation not permitted
  15. rm: cannot remove 'mycgroup/freezer.self_freezing': Operation not permitted
  16. rm: cannot remove 'mycgroup/tasks': Operation not permitted
  17. rm: cannot remove 'mycgroup/freezer.parent_freezing': Operation not permitted
  18. rm: cannot remove 'mycgroup/freezer.state': Operation not permitted
  19. rm: cannot remove 'mycgroup/notify_on_release': Operation not permitted
  20. rm: cannot remove 'mycgroup/cgroup.clone_children': Operation not permitted
  21. student@ubuntu:/sys/fs/cgroup/freezer$

How do you clean up after this lab? Thanks.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Hi @ldt,

    Where you able to successfully thaw the process as described by the lab guide? After successfully freezing and thawing that second terminal, where you able to terminate the terminal's process?
    Ensure that no process is managed by any of the files in mycgroup/, specifically ensure that mycgroup/tasks is empty, while all other files should be empty or include a 0.
    Then try:

    1. student@ubuntu:/sys/fs/cgroup/freezer$ sudo cd mycgroup/
    2. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo rm *
    3. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo cd ..
    4. student@ubuntu:/sys/fs/cgroup/freezer$ sudo rmdir mycgroup

    If unsuccessful, try adding -f to sudo rm -f *.

    Regards,
    -Chris

  • Posts: 8

    Hi @chrispokorni,

    Thanks for your help. As I expected, after shutting down and restarting Ubuntu, mycgroup was gone. It is not permanent. But I was sure this was the answer to my problem since I had not killed the second terminal process. So I have repeated the lab and I am still unable to delete mycgroup.

    1. student@ubuntu:/sys/fs/cgroup/freezer$ sudo mkdir mycgroup
    2. student@ubuntu:/sys/fs/cgroup/freezer$ cd mycgroup
    3. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ ls
    4. cgroup.clone_children cgroup.procs freezer.parent_freezing freezer.self_freezing freezer.state notify_on_release tasks
    5. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat tasks
    6. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ ps -ef |grep bash
    7. student 3143 3134 0 08:47 pts/0 00:00:00 bash
    8. student 3356 3143 0 08:50 pts/0 00:00:00 grep --color=auto bash
    9. (open a new terminal)
    10. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ ps -ef |grep bash
    11. student 3143 3134 0 08:47 pts/0 00:00:00 bash
    12. student 3368 3134 0 08:50 pts/1 00:00:00 bash
    13. student 3377 3143 0 08:50 pts/0 00:00:00 grep --color=auto bash
    14. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat tasks
    15. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo sh -c "echo 3368 >> tasks"
    16. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat tasks
    17. 3368
    18. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo sh -c "echo FROZEN > freezer.state"
    19. (teminal 3368 is frozen)
    20. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo sh -c "echo THAWED > freezer.state"
    21. (teminal 3368 is thawed)
    22. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo kill -9 3368
    23. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ ps -ef |grep bash
    24. student 3143 3134 0 08:47 pts/0 00:00:00 bash
    25. student 3422 3143 0 08:55 pts/0 00:00:00 grep --color=auto bash
    26. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat tasks
    27. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat cgroup.clone_children
    28. 0
    29. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat cgroup.procs
    30. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat freezer.parent_freezing
    31. 0
    32. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat freezer.self_freezing
    33. 0
    34. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat freezer.state
    35. THAWED
    36. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cat notify_on_release
    37. 0
    38. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo rm *
    39. rm: cannot remove 'cgroup.clone_children': Operation not permitted
    40. rm: cannot remove 'cgroup.procs': Operation not permitted
    41. rm: cannot remove 'freezer.parent_freezing': Operation not permitted
    42. rm: cannot remove 'freezer.self_freezing': Operation not permitted
    43. rm: cannot remove 'freezer.state': Operation not permitted
    44. rm: cannot remove 'notify_on_release': Operation not permitted
    45. rm: cannot remove 'tasks': Operation not permitted
    46. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo rm -f *
    47. rm: cannot remove 'cgroup.clone_children': Operation not permitted
    48. rm: cannot remove 'cgroup.procs': Operation not permitted
    49. rm: cannot remove 'freezer.parent_freezing': Operation not permitted
    50. rm: cannot remove 'freezer.self_freezing': Operation not permitted
    51. rm: cannot remove 'freezer.state': Operation not permitted
    52. rm: cannot remove 'notify_on_release': Operation not permitted
    53. rm: cannot remove 'tasks': Operation not permitted
    54. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$

    For some reason I'm not getting the same result you do.

    Thanks,
    ldt

  • Can you try to only remove the mycgroup/ directory after you terminated the second shell process, skipping commands from lines (1-3)? Similar to this:

    student@ubuntu:~$ sudo rmdir /sys/fs/cgroup/freezer/mycgroup/

    Regards,
    -Chris

  • Posts: 8

    OK. So rmdir works but rm * doesn't.

    1. student@ubuntu:/sys/fs/cgroup/freezer$ sudo mkdir mycgroup
    2. student@ubuntu:/sys/fs/cgroup/freezer$ cd mycgroup
    3. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo rm *
    4. rm: cannot remove 'cgroup.clone_children': Operation not permitted
    5. rm: cannot remove 'cgroup.procs': Operation not permitted
    6. rm: cannot remove 'freezer.parent_freezing': Operation not permitted
    7. rm: cannot remove 'freezer.self_freezing': Operation not permitted
    8. rm: cannot remove 'freezer.state': Operation not permitted
    9. rm: cannot remove 'notify_on_release': Operation not permitted
    10. rm: cannot remove 'tasks': Operation not permitted
    11. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ sudo rm -f *
    12. rm: cannot remove 'cgroup.clone_children': Operation not permitted
    13. rm: cannot remove 'cgroup.procs': Operation not permitted
    14. rm: cannot remove 'freezer.parent_freezing': Operation not permitted
    15. rm: cannot remove 'freezer.self_freezing': Operation not permitted
    16. rm: cannot remove 'freezer.state': Operation not permitted
    17. rm: cannot remove 'notify_on_release': Operation not permitted
    18. rm: cannot remove 'tasks': Operation not permitted
    19. student@ubuntu:/sys/fs/cgroup/freezer/mycgroup$ cd ..
    20. student@ubuntu:/sys/fs/cgroup/freezer$ sudo rmdir mycgroup
    21. student@ubuntu:/sys/fs/cgroup/freezer$ ll
    22. total 0
    23. dr-xr-xr-x 3 root root 0 Sep 11 14:14 ./
    24. drwxr-xr-x 15 root root 380 Sep 11 14:11 ../
    25. -rw-r--r-- 1 root root 0 Sep 11 14:13 cgroup.clone_children
    26. -rw-r--r-- 1 root root 0 Sep 11 14:14 cgroup.procs
    27. -r--r--r-- 1 root root 0 Sep 11 14:13 cgroup.sane_behavior
    28. -rw-r--r-- 1 root root 0 Sep 11 14:13 notify_on_release
    29. -rw-r--r-- 1 root root 0 Sep 11 14:13 release_agent
    30. -rw-r--r-- 1 root root 0 Sep 11 14:13 tasks
    31. drwxr-xr-x 5 root root 0 Sep 11 14:13 user/
    32. student@ubuntu:/sys/fs/cgroup/freezer$

    I didn't even do the lab exercise here. I just created the directory and then tried to delete it. I was surprised first of all to find that mkdir not only creates a directory, but some how mysteriously creates content in it as well. Just as mysterious is that it can't be deleted in the normal way. I suppose that only seems strange to a novice, but at least I have a working solution to the problem. Thanks for your help.
    ldt

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training