Skip to content

Commit d409174

Browse files
Merge pull request #1518 from ggiguash/fix_journald_config
USHIFT-976: Override journald configuration rather than editing the system files
2 parents b4e7571 + dc5edfc commit d409174

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

docs/config/microshift-starter.ks

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ if ! subscription-manager status >& /dev/null ; then
5353
fi
5454

5555
# Configure systemd journal service to persist logs between boots and limit their size to 1G
56-
mkdir -p /var/log/journal/
57-
sed -i 's/.*Storage=.*/Storage=auto/g' /etc/systemd/journald.conf
58-
sed -i 's/.*SystemMaxUse=.*/SystemMaxUse=1G/g' /etc/systemd/journald.conf
59-
sed -i 's/.*RuntimeMaxUse=.*/RuntimeMaxUse=1G/g' /etc/systemd/journald.conf
56+
sudo mkdir -p /etc/systemd/journald.conf.d
57+
cat <<EOF | sudo tee /etc/systemd/journald.conf.d/microshift.conf &>/dev/null
58+
[Journal]
59+
Storage=persistent
60+
SystemMaxUse=1G
61+
RuntimeMaxUse=1G
62+
EOF
6063

6164
%end

docs/greenboot.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Serviceability of Edge Devices is often limited or non-existent, which makes it
66
challenging to troubleshoot device problems following a failed software or
7-
operating system upgrade.
7+
operating system upgrade.
88

99
To mitigate these problems, MicroShift uses [greenboot](https://github.com/fedora-iot/greenboot),
1010
the Generic Health Check Framework for `systemd` on `rpm-ostree` based systems.
@@ -105,8 +105,11 @@ and setting limits on the maximal journal data size.
105105

106106
Run the following commands to configure the journal data persistency and limits.
107107
```bash
108-
sudo mkdir -p /var/log/journal/
109-
sudo sed -i 's/.*Storage=.*/Storage=auto/g' /etc/systemd/journald.conf
110-
sudo sed -i 's/.*SystemMaxUse=.*/SystemMaxUse=1G/g' /etc/systemd/journald.conf
111-
sudo sed -i 's/.*RuntimeMaxUse=.*/RuntimeMaxUse=1G/g' /etc/systemd/journald.conf
108+
sudo mkdir -p /etc/systemd/journald.conf.d
109+
cat <<EOF | sudo tee /etc/systemd/journald.conf.d/microshift.conf &>/dev/null
110+
[Journal]
111+
Storage=persistent
112+
SystemMaxUse=1G
113+
RuntimeMaxUse=1G
114+
EOF
112115
```

scripts/image-builder/config/kickstart.ks.template

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ network --bootproto=dhcp --device=link --activate --onboot=on
1313
# For example, a 20GB disk would be partitioned in the following way:
1414
#
1515
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
16-
# sda 8:0 0 20G 0 disk
16+
# sda 8:0 0 20G 0 disk
1717
# ├─sda1 8:1 0 200M 0 part /boot/efi
1818
# ├─sda1 8:1 0 800M 0 part /boot
19-
# └─sda2 8:2 0 19G 0 part
19+
# └─sda2 8:2 0 19G 0 part
2020
# └─rhel-root 253:0 0 10G 0 lvm /sysroot
2121
#
2222
zerombr
@@ -66,10 +66,13 @@ firewall-offline-cmd --zone=trusted --add-source=169.254.169.1
6666
echo -e 'export KUBECONFIG=/var/lib/microshift/resources/kubeadmin/kubeconfig' >> /root/.profile
6767

6868
# Configure systemd journal service to persist logs between boots and limit their size to 1G
69-
mkdir -p /var/log/journal/
70-
sed -i 's/.*Storage=.*/Storage=auto/g' /etc/systemd/journald.conf
71-
sed -i 's/.*SystemMaxUse=.*/SystemMaxUse=1G/g' /etc/systemd/journald.conf
72-
sed -i 's/.*RuntimeMaxUse=.*/RuntimeMaxUse=1G/g' /etc/systemd/journald.conf
69+
sudo mkdir -p /etc/systemd/journald.conf.d
70+
cat <<EOF | sudo tee /etc/systemd/journald.conf.d/microshift.conf &>/dev/null
71+
[Journal]
72+
Storage=persistent
73+
SystemMaxUse=1G
74+
RuntimeMaxUse=1G
75+
EOF
7376

7477
# Make sure all the Ethernet network interfaces are connected automatically
7578
for uuid in $(nmcli -f uuid,type,autoconnect connection | awk '$2 == "ethernet" && $3 == "no" {print $1}') ; do

0 commit comments

Comments
 (0)