Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run-postinsts: Set dependency for ldconfig to avoid boot issues #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abuzarra
Copy link
Contributor

If a package with a postsints script requires ldconfig, the package class adds a ldconfig postinst fragment to initialize it before. Systemd has its own ldconfig.service to initialize it and sometimes if both services are running at the same time in the first boot, the first one will work, but the second one will fail with the following error:

ldconfig[141]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory

This commit adds a ordering dependency between them to make sure that only one service is running at the same time.

Signed-off-by: Arturo Buzarra arturo.buzarra@digi.com

If a package with a postsints script requires ldconfig, the package class adds
a ldconfig postinst fragment to initialize it before. Systemd has its own
ldconfig.service to initialize it and sometimes if both services are running
at the same time in the first boot, the first one will work, but the second
one will fail with the following error:

    ldconfig[141]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory

This commit adds a ordering dependency between them to make sure that only one
service is running at the same time.

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
@abuzarra
Copy link
Contributor Author

Additional system logs:
ldconfig.service:


~# systemctl status ldconfig.service
x ldconfig.service - Rebuild Dynamic Linker Cache
Loaded: loaded (8;;file://lib/systemd/system/ldconfig.service/lib/systemd/system/ldconfig.service8;;; static)
Active: failed (Result: exit-code) since Wed 2022-10-19 09:21:09 UTC; 6min ago
Condition: start condition failed at Wed 2022-10-19 09:21:16 UTC; 6min ago
|- ConditionNeedsUpdate=|/etc was not met
- ConditionFileNotEmpty=|!/etc/ld.so.cache was not met
Docs: 8;;man:ldconfig(8)man:ldconfig(8)8;;
Main PID: 141 (code=exited, status=1/FAILURE)

Oct 19 09:21:05 systemd[1]: Starting Rebuild Dynamic Linker Cache...
Oct 19 09:21:09 ldconfig[141]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory
Oct 19 09:21:09 systemd[1]: ldconfig.service: Main process exited, code=exited, status=1/FAILURE
Oct 19 09:21:09 systemd[1]: ldconfig.service: Failed with result 'exit-code'.
Oct 19 09:21:09 systemd[1]: Failed to start Rebuild Dynamic Linker Cache.
Oct 19 09:21:16 systemd[1]: Rebuild Dynamic Linker Cache was skipped because all trigger condition checks failed.
~#


run-postinsts.service:


~# systemctl status run-postinsts.service -n 999999

  • run-postinsts.service - Run pending postinsts
    Loaded: loaded (8;;file:///lib/systemd/system/run-postinsts.service/lib/systemd/system/run-postinsts.service8;;; disabled; vendor preset: enabled)
    Active: active (exited) since Wed 2022-10-19 07:52:49 UTC; 3min 39s ago
    Process: 143 ExecStart=/usr/sbin/run-postinsts (code=exited, status=0/SUCCESS)
    Process: 308 ExecStartPost=/bin/systemctl --no-reload disable run-postinsts.service (code=exited, status=0/SUCCESS)
    Main PID: 143 (code=exited, status=0/SUCCESS)

Oct 19 07:52:38 systemd[1]: Starting Run pending postinsts...
Oct 19 07:52:39 run-postinsts[143]: + backend_list='rpm deb ipk'
Oct 19 07:52:39 run-postinsts[143]: + pm_installed=false
Oct 19 07:52:39 run-postinsts[143]: + for pm in $backend_list
Oct 19 07:52:39 run-postinsts[143]: + case $pm in
Oct 19 07:52:39 run-postinsts[143]: + pi_dir=/etc/rpm-postinsts
Oct 19 07:52:39 run-postinsts[143]: + '[' -d /etc/rpm-postinsts ']'
Oct 19 07:52:39 run-postinsts[143]: + break
Oct 19 07:52:39 run-postinsts[143]: + '[' -d /etc/rpm-postinsts ']'
Oct 19 07:52:39 run-postinsts[143]: + echo 'Configuring packages on first boot....'
Oct 19 07:52:39 run-postinsts[143]: Configuring packages on first boot....
Oct 19 07:52:39 run-postinsts[143]: + echo ' (This may take several minutes. Please do not power off the machine.)'
Oct 19 07:52:39 run-postinsts[143]: (This may take several minutes. Please do not power off the machine.)
Oct 19 07:52:39 run-postinsts[143]: + '[' -e /etc/default/postinst ']'
Oct 19 07:52:39 run-postinsts[143]: + . /etc/default/postinst
Oct 19 07:52:39 run-postinsts[143]: ++ POSTINST_LOGGING=1
Oct 19 07:52:39 run-postinsts[143]: ++ LOGFILE=/var/log/postinstall.log
Oct 19 07:52:39 run-postinsts[143]: + '[' 1 = 1 ']'
Oct 19 07:52:39 run-postinsts[143]: + rm -f /var/log/postinstall.log
Oct 19 07:52:39 run-postinsts[143]: + append_log='>>/var/log/postinstall.log 2>&1'
Oct 19 07:52:39 run-postinsts[143]: + remove_rcsd_link=1
Oct 19 07:52:39 run-postinsts[143]: + false
Oct 19 07:52:39 run-postinsts[143]: + exec_postinst_scriptlets
Oct 19 07:52:39 run-postinsts[160]: ++ ls /etc/rpm-postinsts
Oct 19 07:52:39 run-postinsts[143]: + for i in ls $pi_dir
Oct 19 07:52:39 run-postinsts[143]: + i=/etc/rpm-postinsts/101-libubootenv0
Oct 19 07:52:39 run-postinsts[143]: + echo 'Running postinst /etc/rpm-postinsts/101-libubootenv0...'
Oct 19 07:52:39 run-postinsts[143]: Running postinst /etc/rpm-postinsts/101-libubootenv0...
Oct 19 07:52:39 run-postinsts[143]: + '[' 1 = 1 ']'
Oct 19 07:52:39 run-postinsts[143]: + eval echo 'Running postinst /etc/rpm-postinsts/101-libubootenv0...' '>>/var/log/postinstall.log' '2>&1'
Oct 19 07:52:39 run-postinsts[143]: ++ echo Running postinst /etc/rpm-postinsts/101-libubootenv0...
Oct 19 07:52:39 run-postinsts[143]: + '[' -x /etc/rpm-postinsts/101-libubootenv0 ']'
Oct 19 07:52:39 run-postinsts[164]: + sh -c /etc/rpm-postinsts/101-libubootenv0 '>>/var/log/postinstall.log' '2>&1'
Oct 19 07:52:42 run-postinsts[165]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory
Oct 19 07:52:42 run-postinsts[143]: + rm /etc/rpm-postinsts/101-libubootenv0
Oct 19 07:52:49 run-postinsts[143]: + '[' 1 = 1 ']'
Oct 19 07:52:49 run-postinsts[143]: + remove_rcsd_link
Oct 19 07:52:49 run-postinsts[306]: ++ which update-rc.d
Oct 19 07:52:49 run-postinsts[143]: + '[' -n /usr/sbin/update-rc.d ']'
Oct 19 07:52:49 run-postinsts[143]: + update-rc.d -f run-postinsts remove
Oct 19 07:52:49 run-postinsts[307]: Removing any system startup links for run-postinsts ...
Oct 19 07:52:49 systemctl[308]: Removed /etc/systemd/system/sysinit.target.wants/run-postinsts.service.
Oct 19 07:52:49 systemd[1]: Finished Run pending postinsts.
~#


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant