데비안에서는 다음 /usr/lib/systemd/*/*.service
과 같은 일부 systemd 서비스가 설치됩니다.
/usr/lib/systemd/user/org.gnome.Evince.service
/usr/lib/systemd/user/pulseaudio.service
/usr/lib/systemd/user/gpg-agent.service
다른 서비스(실제로는 더 많음)가 있습니다./lib/systemd/*/*.service
/lib/systemd/system/networking.service
/lib/systemd/system/sddm.service
/lib/systemd/system/apache2.service
/lib/systemd/system/dm-event.service
/lib/systemd/system/ModemManager.service
폴더가 있습니다 /lib/systemd
:
/lib/systemd/network/
/lib/systemd/system/
/lib/systemd/system-generators/
/lib/systemd/system-preset/
/lib/systemd/system-shutdown/
/lib/systemd/system-sleep/
/usr/lib/systemd
:
/usr/lib/systemd/boot/
/usr/lib/systemd/catalog/
/usr/lib/systemd/scripts/
/usr/lib/systemd/system/
/usr/lib/systemd/user/
/usr/lib/systemd/user-environment-generators/
/usr/lib/systemd/user-generators/
/usr/lib/systemd/user-preset/
그렇다면 이 두 디렉토리의 차이점은 무엇입니까?시스템 문서/lib/systemd
전혀 언급되지 않았습니다.
배포판입니까, 아니면 업스트림 소프트웨어가 선택된 곳입니까? 예를 들어 아파치의 경우더반사용 /lib/systemd/system/apache2.service
,그러나 루트를 구축하다 /usr/lib/systemd/system/apache.service
(buildroot도 사용되는 것 같습니다 /lib/systemd
).
어떤 식으로든 영향을 받았나요?/usr
병합?
다들 관심만 있을 뿐이지/usr/lib/systemd/system과 /etc/systemd/system의 차이점(주제를 터치하세요.표시된 경로 Units of installed packages
는 배포판별로 다릅니다. Centos 7은 /usr/lib/systemd/system
Debian을 사용 /lib/systemd/system
하지만 Debian은 둘 다 사용합니다.
답변1
출처가 질문에 답변했으며 실제로 영향을 받았습니다./usr
병합, 바라보다 LOOKUP_PATHS_SPLIT_USR
:
src/portable/portable.c:we force looking inside of /lib/systemd/system/ for units too, as we might be compiled for a split-usr system but the image might be a legacy-usr one
/* Then, send unit file data to the parent (or/and add it to the hashmap).
* For that we use our usual unit discovery logic. Note that we force looking
* inside of /lib/systemd/system/ for units too, as we might be
* compiled for a split-usr system but the image might be a legacy-usr one. */
r = lookup_paths_init(&paths, UNIT_FILE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, where);
(가독성을 위해 주석 형식을 다시 지정함)
src/share/pathfind.c: "/lib/systemd/system"
if 플래그 추가LOOKUP_PATHS_SPLIT_USR
case UNIT_FILE_SYSTEM:
add = strv_new(
/* If you modify this you also want to modify
* systemdsystemunitpath= in systemd.pc.in! */
...
"/usr/local/lib/systemd/system",
SYSTEM_DATA_UNIT_PATH,
"/usr/lib/systemd/system",
STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
...
src/core/systemd.pc.in: /usr/lib/systemd/system
그리고/lib/systemd/system
systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:\
/run/systemd/system\:/usr/local/lib/systemd/system:${systemdsystemunitdir}\:
/usr/lib/systemd/system:/lib/systemd/system
(더 나은 가독성을 위해 형식을 변경했습니다)
제출 메시지의 출처:799b210267("경로 조회: 분할-usr 장치 디렉토리를 선택적으로 강제 검사하기 위한 플래그 추가"):
When we look into a portable service image it might contain the unit
files in split-usr directories rather than merged-usr directories as on
the host. Hence, let#s add a flag that checking all dirs can be forced.