Skip to content

Commit

Permalink
Improve /dev/log symbolic link setup to only create it if missing (#49)…
Browse files Browse the repository at this point in the history
… (#58)

This fixes cases where the symbolic link is already present in the
system, such as in the latest Ubuntu images.

If `/dev/log` already exists, the script skips the link creation to
avoid the following error message:

```
[9/14] Set /dev/log symbolic link to /run/systemd/journal/dev-log ...
ln: failed to create symbolic link '/dev/log': Permission denied
```

Issue: #49
  • Loading branch information
psaavedra authored Sep 29, 2024
1 parent de09882 commit edf80ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/container-only/.wkdev-init
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@ try_setup_setgid_subuid_files() {

try_setup_journal_dev_log() {

task_step "Set /dev/log symbolic link to /run/systemd/journal/dev-log ..."
sudo ln -sf /run/systemd/journal/dev-log /dev/log
task_step "Check if /dev/log exists, if not set symbolic link to /run/systemd/journal/dev-log ..."
echo ""

if [ ! -e /dev/log ]; then
sudo ln -s /run/systemd/journal/dev-log /dev/log
echo " -> /dev/log symbolic link created."
else
echo " -> /dev/log already exists, skipping symbolic link creation."
fi
}

try_setup_sudoers_file() {
Expand Down

0 comments on commit edf80ff

Please sign in to comment.