Translate

2026年4月1日水曜日

Raspberry Pi OS 上で/etc/hostsを編集しても元に戻ってしまう


Raspberry Pi OS上でsudo vi /etc/hostsで追加した定義が再起動したらもとに戻ってしまった。


でもよーく/etc/hostsをみたら、先頭に

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data
#


翻訳すると..


このシステムでは「manage_etc_hosts」がTrueに設定されています。
その結果、このファイルへの変更を持続させたい場合は、以下のいずれかを行う必要があります。
 a.) /etc/cloud/templates/hosts.debian.tmpl のマスターファイルを変更する。
 b.) /etc/cloud/cloud.cfg または user-data から cloud-config'manage_etc_hosts' の値を変更または削除する。



..ちゃんと読まないとだめだなあ..

ということで

sudo vi /etc/cloud/templates/hosts.debian.tmpl で追加分を書いて再起動したら /etc/hosts にこのテンプレートの内容が反映された..

DHCP管理下でラズパイを使うことがよくあるから、注意しないと..


0 件のコメント:

Claw EmpireをRaspberry Pi 5にセットアップする

1.前提条件 Raspberry Pi 5にRaspberry Pi OS(21 Apr 2026)がインストールされていること Raspberry Pi 5にRaspberry Pi OSをインストールし、SSHでアクセスできる状態にしておくこと Raspberry Pi 5が...