zhhuabj

Untitled

Oct 12th, 2026
24
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.77 KB | None | 0 0
  1. 1, Test Ubuntu with the default '--disable-sysusers-log-ownership'
  2. Note: logrotate is from the debian ovn package (/bak/work/debian/ovn/debian/ovn-common.logrotate) rather than upstream ovn
  3.  
  4. cd /bak/linux/ovn
  5. git submodule update --init
  6.  
  7. cd /bak/linux/ovn/ovs
  8. make distclean || true
  9. ./boot.sh
  10. ./configure \
  11. --prefix=/usr \
  12. --localstatedir=/var \
  13. --sysconfdir=/etc \
  14. --disable-shared \
  15. --enable-static \
  16. CFLAGS="-g -O2 -fPIC"
  17. make python/ovs/dirs.py V=1
  18. make -j"$(nproc)"
  19.  
  20. cd /bak/linux/ovn
  21. make distclean || true
  22. ./boot.sh
  23. ./configure \
  24. --prefix=/usr \
  25. --localstatedir=/var \
  26. --sysconfdir=/etc \
  27. --with-log-user=root \
  28. --with-log-group=adm \
  29. --with-ovs-source="$PWD/ovs" \
  30. --with-ovs-build="$PWD/ovs"
  31. make -j"$(nproc)"
  32. make check TESTSUITEFLAGS='-j'"$(nproc)"
  33.  
  34. sudo apt install graphviz debhelper dh-autoreconf dh-python python3-all python3-sphinx libunbound-dev -y
  35. export DEB_BUILD_OPTIONS=nocheck
  36. export OVSDIR="$PWD/ovs"
  37. export EXTRA_CONFIGURE_OPTS="--with-ovs-source=$PWD/ovs --with-ovs-build=$PWD/ovs"
  38. sudo chown -R "$USER:$USER" /bak/linux/ovn
  39. sudo rm -rf debian/autoreconf.before debian/autoreconf.after
  40. dpkg-buildpackage -us -uc -b
  41.  
  42. cd ..
  43. sudo apt install openvswitch-switch -y && test -r /usr/share/openvswitch/scripts/ovs-lib
  44. sudo apt install ./ovn-common_26.09.90-1_amd64.deb ./ovn-central_26.09.90-1_amd64.deb ./ovn-host_26.09.90-1_amd64.deb ./ovn-controller-vtep_26.09.90-1_amd64.deb -y
  45. sudo DEBIAN_FRONTEND=noninteractive dpkg -i --force-confnew ovn-host_26.09.90-1_amd64.deb
  46. sudo systemctl restart ovn-host ovn-central
  47. systemctl --no-pager --full status ovn-host ovn-central
  48.  
  49. hua@y9000p:~$ cat /usr/lib/sysusers.d/ovn-sysusers.conf
  50. cat: /usr/lib/sysusers.d/ovn-sysusers.conf: No such file or directory
  51.  
  52. hua@y9000p:~$ cat /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  53. # The setgid bit makes log files created in this directory inherit adm.
  54. d /var/log/ovn 2750 root adm -
  55.  
  56. hua@y9000p:~$ ls -al /var/log/ovn/
  57. drwxr-s--- 2 root adm 4096 Oct 12 08:21 .
  58. drwxrwxr-x 24 root syslog 4096 Oct 12 06:11 ..
  59. -rw-r----- 1 root adm 1130 Oct 12 08:21 ovn-controller.log
  60. -rw-r----- 1 root adm 742 Oct 12 08:21 ovn-controller-vtep.log
  61. -rw-r----- 1 root adm 539 Oct 12 08:21 ovn-northd.log
  62. -rw-r----- 1 root adm 240 Oct 12 08:21 ovsdb-server-nb.log
  63. -rw-r----- 1 root adm 240 Oct 12 08:21 ovsdb-server-sb.log
  64.  
  65. hua@y9000p:~$ sudo /usr/share/ovn/scripts/ovn-ctl stop_controller && sudo /usr/share/ovn/scripts/ovn-ctl start_controller && sudo /usr/share/ovn/scripts/ovn-ctl status_controller
  66. * Exiting ovn-controller (1621)
  67. * Starting ovn-controller
  68. ovn-controller is running with pid 1985
  69.  
  70. hua@y9000p:~$ ls -al /var/log/ovn/
  71. drwxr-s--- 2 root adm 4096 Oct 12 08:21 .
  72. drwxrwxr-x 24 root syslog 4096 Oct 12 06:11 ..
  73. -rw-r----- 1 root adm 2465 Oct 12 08:22 ovn-controller.log
  74. -rw-r----- 1 root adm 742 Oct 12 08:21 ovn-controller-vtep.log
  75. -rw-r----- 1 root adm 539 Oct 12 08:21 ovn-northd.log
  76. -rw-r----- 1 root adm 444 Oct 12 08:21 ovsdb-server-nb.log
  77. -rw-r----- 1 root adm 447 Oct 12 08:21 ovsdb-server-sb.log
  78.  
  79. # test logrotate (/etc/logrotate.d/ovn-common is from debian package rather than upstream ovn so we created it by hand)
  80. cat << EOF | sudo tee /etc/logrotate.d/ovn-common
  81. /var/log/ovn/ovn-controller.log {
  82. su root root
  83. daily
  84. rotate 1
  85. compress
  86. missingok
  87. create 0640 root adm
  88. postrotate
  89. if [ -d /var/run/ovn ]; then
  90. for ctl in /var/run/ovn/*.ctl; do
  91. ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
  92. done
  93. fi
  94. endscript
  95. }
  96. EOF
  97.  
  98. sudo logrotate -f -v /etc/logrotate.d/ovn-common
  99. hua@y9000p:~$ ls -al /var/log/ovn/ | grep controller.log
  100. -rw-r----- 1 root adm 0 Oct 12 08:23 ovn-controller.log
  101. -rw-r----- 1 root adm 587 Oct 12 08:22 ovn-controller.log.1.gz
  102.  
  103.  
  104. 2, Test Ubuntu with '--enable-sysusers-log-ownership'
  105.  
  106. cd /bak/linux/ovn
  107. git submodule update --init
  108.  
  109. cd /bak/linux/ovn/ovs
  110. make distclean || true
  111. ./boot.sh
  112. ./configure \
  113. --prefix=/usr \
  114. --localstatedir=/var \
  115. --sysconfdir=/etc \
  116. --disable-shared \
  117. --enable-static \
  118. CFLAGS="-g -O2 -fPIC"
  119. make python/ovs/dirs.py V=1
  120. make -j"$(nproc)"
  121.  
  122. cd /bak/linux/ovn
  123. make distclean || true
  124. ./boot.sh
  125. ./configure \
  126. --prefix=/usr \
  127. --localstatedir=/var \
  128. --sysconfdir=/etc \
  129. --with-log-user=root \
  130. --with-log-group=adm \
  131. --enable-sysusers-log-ownership \
  132. --with-ovs-source="$PWD/ovs" \
  133. --with-ovs-build="$PWD/ovs"
  134. make -j"$(nproc)"
  135. make check TESTSUITEFLAGS='-j'"$(nproc)"
  136.  
  137. # add '--enable-sysusers-log-ownership' in EXTRA_CONFIGURE_OPTS when building deb package
  138. sudo apt install graphviz debhelper dh-autoreconf dh-python python3-all python3-sphinx libunbound-dev -y
  139. export DEB_BUILD_OPTIONS=nocheck
  140. export OVSDIR="$PWD/ovs"
  141. export EXTRA_CONFIGURE_OPTS="--with-ovs-source=$PWD/ovs --with-ovs-build=$PWD/ovs --enable-sysusers-log-ownership"
  142. sudo chown -R "$USER:$USER" /bak/linux/ovn
  143. sudo rm -rf debian/autoreconf.before debian/autoreconf.after
  144. dpkg-buildpackage -us -uc -b
  145.  
  146. cd ..
  147. sudo apt install openvswitch-switch -y && test -r /usr/share/openvswitch/scripts/ovs-lib
  148. sudo apt remove --purge ovn-central ovn-host ovn-controller-vtep ovn-common -y && sudo rm -rf /var/log/ovn/*
  149. sudo apt install ./ovn-common_26.09.90-1_amd64.deb ./ovn-central_26.09.90-1_amd64.deb ./ovn-host_26.09.90-1_amd64.deb ./ovn-controller-vtep_26.09.90-1_amd64.deb -y
  150. sudo DEBIAN_FRONTEND=noninteractive dpkg -i --force-confnew ovn-host_26.09.90-1_amd64.deb
  151. systemctl --no-pager --full status ovn-host ovn-central
  152.  
  153. # ovn-sysusers.conf has an empty line: '@SYSUSERS_GROUP_LINE@ -> g adm - && @SYSUSERS_USER_LINE@ -> empty' because root already exists
  154. hua@y9000p:~$ cat /root/v8-enabled/ovn/utilities/ovn-sysusers.conf
  155. g adm -
  156.  
  157. hua@y9000p:~$ nl -ba /root/v8-enabled/ovn/utilities/ovn-sysusers.conf
  158. 1 g adm -
  159. 2
  160.  
  161. hua@y9000p:~$ cat /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  162. # The setgid bit makes log files created in this directory inherit adm.
  163. d /var/log/ovn 2750 root adm -
  164.  
  165. hua@y9000p:~$ ls -al /var/log/ovn/
  166. drwxr-s--- 2 root adm 4096 Oct 12 09:14 .
  167. drwxrwxr-x 24 root syslog 4096 Oct 12 06:11 ..
  168. -rw-r----- 1 root adm 805 Oct 12 09:14 ovn-controller.log
  169. -rw-r----- 1 root adm 742 Oct 12 09:14 ovn-controller-vtep.log
  170. -rw-r----- 1 root adm 539 Oct 12 09:14 ovn-northd.log
  171. -rw-r----- 1 root adm 240 Oct 12 09:14 ovsdb-server-nb.log
  172. -rw-r----- 1 root adm 240 Oct 12 09:14 ovsdb-server-sb.log
  173.  
  174. hua@y9000p:~$ sudo /usr/share/ovn/scripts/ovn-ctl stop_controller && sudo /usr/share/ovn/scripts/ovn-ctl start_controller && sudo /usr/share/ovn/scripts/ovn-ctl status_controller
  175. * Exiting ovn-controller (940906)
  176. * Starting ovn-controller
  177. ovn-controller is running with pid 942118
  178.  
  179. hua@y9000p:~$ ls -al /var/log/ovn/
  180. drwxr-s--- 2 root adm 4096 Oct 12 09:14 .
  181. drwxrwxr-x 24 root syslog 4096 Oct 12 06:11 ..
  182. -rw-r----- 1 root adm 2994 Oct 12 09:15 ovn-controller.log
  183. -rw-r----- 1 root adm 742 Oct 12 09:14 ovn-controller-vtep.log
  184. -rw-r----- 1 root adm 1269 Oct 12 09:15 ovn-northd.log
  185. -rw-r----- 1 root adm 676 Oct 12 09:15 ovsdb-server-nb.log
  186. -rw-r----- 1 root adm 676 Oct 12 09:15 ovsdb-server-sb.log
  187.  
  188. # test logrotate (/etc/logrotate.d/ovn-common is from debian package rather than upstream ovn so we created it by hand)
  189. cat << EOF | sudo tee /etc/logrotate.d/ovn-common
  190. /var/log/ovn/ovn-controller.log {disable-sysusers-log-ownership
  191. su root root
  192. daily
  193. rotate 1
  194. compress
  195. missingok
  196. create 0640 root adm
  197. postrotate
  198. if [ -d /var/run/ovn ]; then
  199. for ctl in /var/run/ovn/*.ctl; do
  200. ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
  201. done
  202. fi
  203. endscript
  204. }
  205. EOF
  206.  
  207. sudo logrotate -f -v /etc/logrotate.d/ovn-common
  208. hua@y9000p:~$ ls -al /var/log/ovn/ | grep controller.log
  209. -rw-r----- 1 root adm 0 Oct 12 09:15 ovn-controller.log
  210. -rw-r----- 1 root adm 517 Oct 12 09:14 ovn-controller.log.1.gz
  211.  
  212.  
  213. 3, Test Fedora with the default '--disable-sysusers-log-ownership'
  214.  
  215. cd /bak/linux/ovn
  216. lxc image list images:fedora
  217. lxc launch images:fedora/44 fedora
  218. lxc file push -r /bak/linux/ovn fedora/root/
  219.  
  220. lxc shell fedora
  221. dnf install -y rpm-build make gcc gcc-c++ autoconf automake libtool systemd-rpm-macros openssl openssl-devel python3-devel git tar gzip bzip2 xz \
  222. desktop-file-utils groff graphviz checkpolicy selinux-policy-devel python3-sphinx procps-ng libcap-ng libcap-ng-devel unbound unbound-devel
  223.  
  224. cd /root/ovn/ovs
  225. rm -f Makefile config.status config.log libtool aclocal.m4
  226. rm -f config.cache config.h config.h.in stamp-h1
  227. rm -rf autom4te.cache
  228. find . -name '.deps' -type d -prune -exec rm -rf {} +
  229. find . -name '.libs' -type d -prune -exec rm -rf {} +
  230. find . -name '*.o' -o -name '*.lo' -o -name '*.la' | xargs -r rm -f
  231. ./boot.sh
  232. ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
  233. make dist
  234.  
  235. cd /root/ovn
  236. rm -f Makefile config.status config.log libtool aclocal.m4
  237. rm -f config.cache config.h config.h.in stamp-h1
  238. rm -rf autom4te.cache
  239. find . -path './ovs' -prune -o -name '.deps' -type d -prune -exec rm -rf {} +
  240. find . -path './ovs' -prune -o -name '.libs' -type d -prune -exec rm -rf {} +
  241. find . -path './ovs' -prune -o \( -name '*.o' -o -name '*.lo' -o -name '*.la' \) -print | xargs -r rm -f
  242. ./boot.sh
  243. ./configure \
  244. --prefix=/usr \
  245. --localstatedir=/var \
  246. --sysconfdir=/etc \
  247. --with-ovs-source=/root/ovn/ovs \
  248. --with-ovs-build=/root/ovn/ovs \
  249. --with-log-user=openvswitch \
  250. --with-log-group=openvswitch
  251. make rpm-fedora RPMBUILD_OPT="--without check"
  252.  
  253. find /root/ovn/rpm/rpmbuild/RPMS -type f -name '*.rpm' -print
  254. find /root/ovn/rpm/rpmbuild/SRPMS -type f -name '*.rpm' -print
  255. for rpm in /root/ovn/rpm/rpmbuild/RPMS/*/*.rpm; do
  256. echo "== $rpm =="
  257. rpm -qpl "$rpm" | grep 'ovn-tmpfiles.conf' || true
  258. done
  259. ls /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm
  260.  
  261. [root@fedora ovn]# rpm -qlp /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm | grep conf
  262. /etc/sysconfig/ovn
  263. /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  264.  
  265. [root@fedora ovn]# rpm -ql openvswitch | grep sysuser
  266. /usr/lib/sysusers.d/openvswitch.conf
  267.  
  268. dnf remove -y logrotate && rm -rf /etc/logrotate.d/ovn && dnf install -y logrotate
  269. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm
  270. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-debuginfo-26.09.90-1.fc44.x86_64.rpm
  271. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-host-*.rpm
  272. systemctl start openvswitch.service && systemctl start ovn-controller.service
  273. rpm -ql ovn | grep tmpfiles
  274. cat /usr/lib/systemd/system/ovn-controller.service
  275. cat /etc/logrotate.d/ovn
  276. systemctl list-unit-files '*ovn*'
  277. systemctl cat ovn-controller.service
  278.  
  279. [root@fedora ovn]# cat /usr/lib/sysusers.d/ovn-sysusers.conf
  280. cat: /usr/lib/sysusers.d/ovn-sysusers.conf: No such file or directory
  281.  
  282. [root@fedora ovn]# cat /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  283. # The setgid bit makes log files created in this directory inherit openvswitch.
  284. d /var/log/ovn 2750 openvswitch openvswitch -
  285.  
  286. [root@fedora ovn]# cat /usr/lib/sysusers.d/openvswitch.conf
  287. #Type Name ID GECOS Home directory Shell
  288. u openvswitch - "Open vSwitch Daemons" / /sbin/nologin
  289. g hugetlbfs -
  290. m openvswitch hugetlbfs
  291.  
  292. [root@fedora ovn]# ls -ld /var/log/ovn
  293. drwxr-s--- 2 openvswitch openvswitch 4096 Oct 12 08:05 /var/log/ovn
  294.  
  295. [root@fedora ovn]# ls -l /var/log/ovn/ovn-controller.log
  296. -rw-r----- 1 openvswitch openvswitch 89 Oct 12 08:05 /var/log/ovn/ovn-controller.log
  297.  
  298. logrotate -f /etc/logrotate.d/ovn -v
  299.  
  300. [root@fedora ovn]# ls -ld /var/log/ovn
  301. drwxr-s--- 2 openvswitch openvswitch 4096 Oct 12 08:06 /var/log/ovn
  302.  
  303. [root@fedora ovn]# ls -l /var/log/ovn/ovn-controller.log*
  304. -rw-r----- 1 openvswitch openvswitch 89 Oct 12 08:06 /var/log/ovn/ovn-controller.log
  305.  
  306.  
  307. 4, Test Fedora with the default '--enable-sysusers-log-ownership'
  308.  
  309. cd /bak/linux/ovn
  310. lxc image list images:fedora
  311. lxc launch images:fedora/44 fedora
  312. lxc file push -r /bak/linux/ovn fedora/root/
  313.  
  314. lxc shell fedora
  315. dnf install -y rpm-build make gcc gcc-c++ autoconf automake libtool systemd-rpm-macros openssl openssl-devel python3-devel git tar gzip bzip2 xz \
  316. desktop-file-utils groff graphviz checkpolicy selinux-policy-devel python3-sphinx procps-ng libcap-ng libcap-ng-devel unbound unbound-devel
  317.  
  318. cd /root/ovn/ovs
  319. rm -f Makefile config.status config.log libtool aclocal.m4
  320. rm -f config.cache config.h config.h.in stamp-h1
  321. rm -rf autom4te.cache
  322. find . -name '.deps' -type d -prune -exec rm -rf {} +
  323. find . -name '.libs' -type d -prune -exec rm -rf {} +
  324. find . -name '*.o' -o -name '*.lo' -o -name '*.la' | xargs -r rm -f
  325. ./boot.sh
  326. ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
  327. make dist
  328.  
  329. cd /root/ovn
  330. rm -f Makefile config.status config.log libtool aclocal.m4
  331. rm -f config.cache config.h config.h.in stamp-h1
  332. rm -rf autom4te.cache
  333. find . -path './ovs' -prune -o -name '.deps' -type d -prune -exec rm -rf {} +
  334. find . -path './ovs' -prune -o -name '.libs' -type d -prune -exec rm -rf {} +
  335. find . -path './ovs' -prune -o \( -name '*.o' -o -name '*.lo' -o -name '*.la' \) -print | xargs -r rm -f
  336. ./boot.sh
  337. ./configure \
  338. --prefix=/usr \
  339. --localstatedir=/var \
  340. --sysconfdir=/etc \
  341. --with-ovs-source=/root/ovn/ovs \
  342. --with-ovs-build=/root/ovn/ovs \
  343. --with-log-user=openvswitch \
  344. --with-log-group=openvswitch
  345.  
  346. # pass '--with ovn_sysusers' to enable sysusers
  347. make rpm-fedora RPMBUILD_OPT="--without check --with ovn_sysusers"
  348.  
  349. find /root/ovn/rpm/rpmbuild/RPMS -type f -name '*.rpm' -print
  350. find /root/ovn/rpm/rpmbuild/SRPMS -type f -name '*.rpm' -print
  351. for rpm in /root/ovn/rpm/rpmbuild/RPMS/*/*.rpm; do
  352. echo "== $rpm =="
  353. rpm -qpl "$rpm" | grep 'ovn-tmpfiles.conf' || true
  354. done
  355. ls /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm
  356.  
  357. [root@fedora ovn]# rpm -qlp /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm | grep conf
  358. /etc/sysconfig/ovn
  359. /usr/lib/sysusers.d/ovn-sysusers.conf
  360. /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  361.  
  362. [root@fedora ovn]# rpm -ql openvswitch | grep sysuser
  363. /usr/lib/sysusers.d/openvswitch.conf
  364.  
  365. dnf remove -y logrotate && rm -rf /etc/logrotate.d/ovn && dnf install -y logrotate
  366. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-26.09.90-1.fc44.x86_64.rpm
  367. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-debuginfo-26.09.90-1.fc44.x86_64.rpm
  368. dnf reinstall -y /root/ovn/rpm/rpmbuild/RPMS/x86_64/ovn-host-*.rpm
  369. systemctl start openvswitch.service && systemctl start ovn-controller.service
  370. rpm -ql ovn | grep tmpfiles
  371. cat /usr/lib/systemd/system/ovn-controller.service
  372. cat /etc/logrotate.d/ovn
  373. systemctl list-unit-files '*ovn*'
  374. systemctl cat ovn-controller.service
  375.  
  376. [root@fedora ovn]# cat /usr/lib/sysusers.d/ovn-sysusers.conf
  377. g openvswitch -
  378. u openvswitch -:openvswitch "OVN log user" -
  379.  
  380. [root@fedora ovn]# cat /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  381. # The setgid bit makes log files created in this directory inherit openvswitch.
  382. d /var/log/ovn 2750 openvswitch openvswitch -
  383.  
  384. [root@fedora ovn]# cat /usr/lib/sysusers.d/openvswitch.conf
  385. #Type Name ID GECOS Home directory Shell
  386. u openvswitch - "Open vSwitch Daemons" / /sbin/nologin
  387. g hugetlbfs -
  388. m openvswitch hugetlbfs
  389.  
  390. [root@fedora ovn]# ls -ld /var/log/ovn
  391. drwxr-s--- 2 openvswitch openvswitch 4096 Oct 12 08:08 /var/log/ovn
  392.  
  393. [root@fedora ovn]# ls -l /var/log/ovn/ovn-controller.log
  394. -rw-r----- 1 openvswitch openvswitch 2727 Oct 12 08:08 /var/log/ovn/ovn-controller.log
  395.  
  396. logrotate -f /etc/logrotate.d/ovn -v
  397.  
  398. [root@fedora ovn]# ls -ld /var/log/ovn
  399. drwxr-s--- 2 openvswitch openvswitch 4096 Oct 12 08:09 /var/log/ovn
  400.  
  401. [root@fedora ovn]# ls -l /var/log/ovn/ovn-controller.log
  402. -rw-r----- 1 openvswitch openvswitch 89 Oct 12 08:09 /var/log/ovn/ovn-controller.log
  403.  
  404.  
  405. 5, Test scenarios without systemd services (Direct 'make install')
  406. Note: When building directly via ./configure without arguments, both tmpfiles and sysusers default to disabled.
  407. Manual ./configure without arguments:
  408. tmpfiles=off, sysusers=off
  409. Debian dpkg-buildpackage:
  410. tmpfiles=on, sysusers=off
  411. Fedora default RPM:
  412. tmpfiles=on, sysusers=off
  413. Manual test options:
  414. --enable-tmpfiles-log-ownership
  415. --enable-sysusers-log-ownership
  416.  
  417. lxc launch images:ubuntu/24.04 noble
  418. lxc file push -r /bak/linux/ovn noble/root/
  419.  
  420. lxc exec noble bash
  421. apt update
  422. apt install -y autoconf automake bison build-essential libcap-ng-dev libssl-dev libtool pkg-config python3 python3-six libunbound-dev libunwind-dev strace
  423.  
  424. cd /root/ovn
  425. git submodule update --init
  426.  
  427. cd /root/ovn/ovs
  428. make distclean || true
  429. rm -rf /usr/lib/tmpfiles.d/ovn-tmpfiles.conf && rm -rf /usr/lib/sysusers.d/ovn-sysusers.conf
  430. ./boot.sh
  431. ./configure \
  432. --prefix=/usr \
  433. --localstatedir=/var \
  434. --sysconfdir=/etc \
  435. --disable-shared \
  436. --enable-static \
  437. CFLAGS="-g -O2 -fPIC"
  438. make -j"$(nproc)"
  439. make install
  440. ls /usr/share/openvswitch/scripts/ovs-lib
  441.  
  442. # First run --enable-sysusers-log-ownership and --enable-tmpfiles-log-ownership (ovn_chown_logdir is 'no')
  443. cd /root/ovn
  444. make distclean || true
  445. rm -rf /usr/lib/tmpfiles.d/ovn-tmpfiles.conf && rm -rf /usr/lib/sysusers.d/ovn-sysusers.conf
  446. ./boot.sh
  447. ./configure \
  448. --prefix=/usr \
  449. --localstatedir=/var \
  450. --sysconfdir=/etc \
  451. --with-log-user=root \
  452. --with-log-group=adm \
  453. --enable-sysusers-log-ownership \
  454. --enable-tmpfiles-log-ownership \
  455. --with-ovs-source="$PWD/ovs" \
  456. --with-ovs-build="$PWD/ovs"
  457. make -j"$(nproc)"
  458. make check-local TESTSUITEFLAGS='-k ovn-ctl'
  459. make install
  460.  
  461. root@noble:~/ovn# grep '^ovn_chown_logdir=' /usr/share/ovn/scripts/ovn-lib
  462. ovn_chown_logdir='no'
  463.  
  464. root@noble:~/ovn# ls /usr/lib/sysusers.d/ovn-sysusers.conf
  465. /usr/lib/sysusers.d/ovn-sysusers.conf
  466.  
  467. root@noble:~/ovn# cat /usr/lib/sysusers.d/ovn-sysusers.conf
  468. g adm -
  469.  
  470. root@noble:~/ovn# ls /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  471. /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  472.  
  473. root@noble:~/ovn# cat /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  474. # The setgid bit makes log files created in this directory inherit adm.
  475. d /var/log/ovn 2750 root adm -
  476.  
  477. systemd-tmpfiles --create --prefix=/var/log/ovn
  478. /usr/share/ovn/scripts/ovn-ctl --no-monitor start_controller
  479. root@noble:~/ovn# stat -c '%a %U:%G %n' /var/log/ovn /var/log/ovn/ovn-controller.log
  480. 2750 root:adm /var/log/ovn
  481. 640 root:adm /var/log/ovn/ovn-controller.log
  482.  
  483. /usr/share/ovn/scripts/ovn-ctl stop_controller || true
  484. rm -rf /var/log/ovn
  485. systemd-tmpfiles --create --prefix=/var/log/ovn
  486. /usr/share/ovn/scripts/ovn-ctl --no-monitor start_controller
  487. root@noble:~/ovn# stat -c '%a %U:%G %n' /var/log/ovn /var/log/ovn/ovn-controller.log
  488. 2750 root:adm /var/log/ovn
  489. 640 root:adm /var/log/ovn/ovn-controller.log
  490.  
  491. # Next run --disable-tmpfiles-log-ownership and --disable-sysusers-log-ownership (ovn_chown_logdir is 'yes')
  492. cd /root/ovn
  493. make distclean || true
  494. rm -rf /usr/lib/tmpfiles.d/ovn-tmpfiles.conf && rm -rf /usr/lib/sysusers.d/ovn-sysusers.conf
  495. ./configure \
  496. --prefix=/usr \
  497. --localstatedir=/var \
  498. --sysconfdir=/etc \
  499. --disable-tmpfiles-log-ownership \
  500. --disable-sysusers-log-ownership \
  501. --with-ovs-source="$PWD/ovs" \
  502. --with-ovs-build="$PWD/ovs"
  503. make -j"$(nproc)"
  504. make install
  505.  
  506. root@noble:~/ovn# grep '^ovn_chown_logdir=' /usr/share/ovn/scripts/ovn-lib
  507. ovn_chown_logdir='yes'
  508.  
  509. root@noble:~/ovn# ls /usr/lib/tmpfiles.d/ovn-tmpfiles.conf
  510. ls: cannot access '/usr/lib/tmpfiles.d/ovn-tmpfiles.conf': No such file or directory
  511.  
  512. root@noble:~/ovn# ls /usr/lib/sysusers.d/ovn-sysusers.conf
  513. ls: cannot access '/usr/lib/sysusers.d/ovn-sysusers.conf': No such file or directory
  514.  
  515. # Verify traditional recursive chown behavior on startup using strace
  516. test_root=/tmp/ovn-default-chown-test
  517. rm -rf "$test_root"
  518. install -d -m 0700 -o nobody -g nogroup "$test_root/log"
  519. install -d -m 0700 -o root -g root "$test_root/run-ovn"
  520. install -d -m 0700 -o root -g root "$test_root/run-ovs"
  521. install -m 0600 -o nobody -g nogroup /dev/null "$test_root/log/ovn-controller.log"
  522.  
  523. root@noble:~/ovn# stat -c '%a %U:%G %n' "$test_root/log" "$test_root/log/ovn-controller.log"
  524. 700 nobody:nogroup /tmp/ovn-default-chown-test/log
  525. 600 nobody:nogroup /tmp/ovn-default-chown-test/log/ovn-controller.log
  526.  
  527. strace -f \
  528. -e trace=chown,fchownat \
  529. -o "$test_root/chown.trace" \
  530. env \
  531. OVN_LOGDIR="$test_root/log" \
  532. OVN_RUNDIR="$test_root/run-ovn" \
  533. OVS_RUNDIR="$test_root/run-ovs" \
  534. /usr/share/ovn/scripts/ovn-ctl \
  535. --no-monitor \
  536. --ovn-user=daemon:daemon \
  537. start_controller || true
  538.  
  539. root@noble:~# test_root=/tmp/ovn-default-chown-test
  540. stat -c '%a %U:%G %n' "$test_root/log" "$test_root/log/ovn-controller.log"
  541. 700 daemon:daemon /tmp/ovn-default-chown-test/log
  542. 600 daemon:daemon /tmp/ovn-default-chown-test/log/ovn-controller.log
  543.  
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment