LoginSignup
3
1

systemctl edit で書き込めない

Last updated at Posted at 2023-11-08

事象

systemctl edit firewalld.serviceにて最下部に設定値を書き込み、保存すると、下記エラーが出て書き込めない。

Editing "/etc/systemd/system/firewalld.service.d/override.conf" canceled: temporary file is empty.

なお、環境は以下の通り

# cat /etc/redhat-release
CentOS Stream release 9
# uname -r
5.14.0-234.el9.x86_64

原因

よくよく編集画面を見てみると、「 Lines below this comment will be discarded」(このコメント以下の行は破棄される)とある。
「### Anything between here and the comment below will become the new contents of the file」と「### Lines below this comment will be discarded」の間に記述する必要があったため、最下部に記入した設定値が無効となって、空判定されているのだった。

### Editing /etc/systemd/system/firewalld.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

<---ここに設定を記述する--->

### Lines below this comment will be discarded

### /usr/lib/systemd/system/firewalld.service
# [Unit]
# Description=firewalld - dynamic firewall daemon
# Before=network-pre.target
# Wants=network-pre.target
# After=dbus.service
# After=polkit.service
# Conflicts=iptables.service ip6tables.service ebtables.service ipset.service nftables.service
# Documentation=man:firewalld(1)
#
# [Service]
# EnvironmentFile=-/etc/sysconfig/firewalld

参考

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1