Skip to content

Commit

Permalink
Fix for DNS service being canceled (#18670)
Browse files Browse the repository at this point in the history
#### Why I did it
To fix `resolv-config.service` being cancelled:
`resolv-config.service` is started from `hostcfgd` each time there is an [update to the dns configuration or during the start of hostcfgd.
](https://github.com/sonic-net/sonic-host-services/blob/6fce4781da508709f11be595e3c7048ffd3138cb/scripts/hostcfgd#L1406) When we perform `config reload` because `hostcfgd` is restarted `resolv-config.service` is also restarted, but due to dependency of [`resolv-config.service` on `sonic.target`](https://github.com/sonic-net/sonic-buildimage/blob/ed839c65055c3cbb446ddabdc9c15b0684988139/files/image_config/resolv-config/resolv-config.service#L5)  `systemd` also tries to restart `resolv-config.service` causing cancellation of one of the instances of `resolv-config.service`. This fix removes the dependency of `resolv-config.service` on `sonic.target`

#### How I did it
By removing the `BindsTo` and `WantedBy` dependency to `sonic.target` the service is not restarted upon `config reload` by `systemd` anymore, which would solve the issue of the service being cancelled.

#### How to verify it
No occurrence of `Job for resolv-config.service canceled.` in `syslog` after this change is considered
  • Loading branch information
gpunathilell authored May 9, 2024
1 parent 4956cf3 commit d9e6256
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions files/image_config/resolv-config/resolv-config.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Description=Update DNS configuration
Requires=config-setup.service
After=config-setup.service
BindsTo=sonic.target
After=sonic.target
StartLimitIntervalSec=0

Expand All @@ -11,5 +10,3 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/resolv-config.sh start

[Install]
WantedBy=sonic.target

0 comments on commit d9e6256

Please sign in to comment.