Temp Files Flashcards

1
Q

Which service manages the lifecyle of temp files

A

systemd-tempfiles-setup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does systemd-tmpfiles-setup service do?

A

create, delete, and clean up volatile and temporary files and directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

where is the config that systemd uses to manage systemd-tmpfiles-setup service located?

A

/usr/lib/systemd/system/systemd-tmpfiles-setup.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Diff between:

/usr/lib/systemd/system/systemd-tmfiles-setup.services

and files in

/usr/lib/tmpfiles.d/,
      /run/tmpfiles.d/,
      /etc/tmpfiles.d/
A

First is a config file for systemd telling it how to start and manage systemd-tmpfiles-setup

The second set of files are config files for systemd-tmpfiles-setup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are location of config files for systemd-tmpfiles-setup:

A

1) /usr/lib/tmpfiles.d/
2) /run/tmpfiles.d/
3) /etc/tmpfiles.d/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In what order are systemd-tmpfiles.setup config files evaluated?

A

1) /usr/lib/tmpfiles.d/.conf
2) /run/tmpfiles.d/
.conf
3) /etc/tmpfiles.d/*.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain tmp file cleanup process

A

timer unit

systemd-tmpfiles-clean.timer

periodically call

systemd-tmpfiles-clean.service

to do the cleaup as per configurations in:

1) /usr/lib/tmpfiles.d/
2) /etc/tmpfiles.d/
3) /run/tmpfiles.d/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the different systemd unit types?

A

1) Service Units
2) Socket Units
3) Device Units
4) Mount Units
5) Automount Units
6) Target Units (.target):
7) Timer Units (.timer):
8) Path Units (.path):
9) Slice Units (.slice):
10) Scope Units (.scope):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain:

q /tmp 1777 root root 10d
A

tmpfile config of /usr/lib/tmfiles.d/tmp.conf

says that files under /tmp will be purged after 10d if not accessed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you modify the content of

/usr/lib/tmfiles.d/tmp.conf
A

1) Copy it to following location and modify the copy. Then run the clean command.

/etc/tmfiles.d/tmp.conf
systemd-tmpfiles --clean  etc/tmfiles.d/tmp.conf
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create a new folder and define its cleanup policy

A
echo 'q /home/student/momentary 0700 root root 30s' > /etc/tmpfiles.d/momentary.conf
systemd-tmpfiles --create /etc/tmp files.d/momentary.conf
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is special about the /run folder

A

exists only in memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What command does systemd-tmpfiles-setup calls to do its job?

A
systemd-tmpfiles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Show the content of a timer unit

A
systemctl cat systemd-tmpfiles-clean.timer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How does a timer know when to invoke the service it is meant to invoke?

A

In the config file of the timer, there is a [Timer] section for this purpose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What fields are used to control when the timer will invoke the service it is supposed to control?

A

1) OnBootSec=15min
2) OnUnitActiveSec=1d

17
Q

Explain the command:

d /run/systemd/seats 0755 root root -
A

1) create dir /run/systemd/seats
2) chown root:root
3) chmod 0755
4) If directory exists, do nothing.
5) systemd-tmpfiles does not purge this directory.

18
Q

Explain the command:

D /home/student 0700 student student 1d
A

1) create dir /home/student directory
2) chown student:student
3) chmod 0700
4) If directory exists, wipe its content.
5) systemd-tmpfiles purges this directory after 1d inactivity.

19
Q

Explain the command:

L /run/fstablink - root root - /etc/fstab
A

1) create link /run/fstablink pointing to /etc/fstab
2) chown root:root
3) systemd-tmpfiles never purges this link

20
Q

OnBootSec=15min

A

Interval between system boot and first service activation

21
Q

OnUnitActiveSec=1d

A

Interval between successive timer activations

22
Q

Similarity between systemd-tmpfiles-setup and systemd-tmpfiles-clean services

A

They all use systemd-tmpfiles command to create, delete, purge.

23
Q

Diff between systemd-tmpfiles-setup and systemd-tmpfiles-clean services

A

Setup runs at boot time, clean runs according to timer.