Commit 30b0aca
authored
fix: avoid RPM lock issue (#44)
## what
This:
* Removes unnecessary `sudo` commands since the [user-data script runs
as the root
user](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts).
* Adds waiting for the RPM lock to be released.
* We've seen the following logs during an instance start-up:
```sh
user-data: RPM: error: can't create transaction lock on
/var/lib/rpm/.rpm.lock (Resource temporarily unavailable)
user-data: The downloaded packages were saved in cache until the next
successful transaction.
user-data: You can remove cached packages by executing 'yum clean
packages'.
user-data: Error: Could not run transaction.
```
* RPM database lock is being held by another process when script
attempts to run yum/dnf commands. Amazon Linux 2023 (AL2023) may perform
automatic updates or other package management tasks during boot, causing
the RPM database to be locked temporarily.
* Uses `dnf` instead of yum: Amazon Linux 2023 [uses dnf as the default
package
manager](https://docs.aws.amazon.com/linux/al2023/ug/package-management.html).
`dnf` is the successor to `yum`.
## why
* Prevents RPM lock issue and follows AWS recommended practices.
## references
* N/A
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Updated script for Tailscale installation and configuration, improving
efficiency with a retry mechanism for command execution.
- **Bug Fixes**
- Removed unnecessary `sudo` calls for a cleaner execution process.
- **Documentation**
- Enhanced readability of the `ssm_state_enabled` variable description
in the configuration file.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 585e814 commit 30b0aca
2 files changed
+41
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
10 | 38 | | |
11 | 39 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
15 | 43 | | |
16 | 44 | | |
17 | 45 | | |
18 | | - | |
| 46 | + | |
19 | 47 | | |
20 | 48 | | |
21 | | - | |
| 49 | + | |
22 | 50 | | |
23 | | - | |
| 51 | + | |
24 | 52 | | |
25 | 53 | | |
26 | 54 | | |
27 | 55 | | |
28 | 56 | | |
29 | 57 | | |
30 | 58 | | |
31 | | - | |
| 59 | + | |
32 | 60 | | |
33 | 61 | | |
34 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
0 commit comments