Automatic deletion of Printer.cfg

Issue Explanation:

I am experiencing an issue where my printer.cfg file is being reset when I update Klipper. I do not want this to happen. Will turning off the write permissions for the printer.cfg file solve this problem?

The printer.cfg file is being deleted, but the old one is kept. I do not want to keep doing this manually. If anyone knowledgeable could help with this, I would really appreciate it. Thank you.

Hello @rkutun !

How do you update Klipper?

Hello @EddyMI3D !

In the settings section, updates can be performed through the update option. Additionally, in the Mainsail interface, there is also an update option available in the Machine menu. Updates can be done from there as well.

This must be a (strange) misconfiguration or local issue on your side.

  1. I’m not aware of any similar reports
  2. If this was a systematic problem, this place would be full of such reports

Please provide a klippy.log as initially requested anyway

Ekran görĂŒntĂŒsĂŒ 2024-08-27 105341

The screenshot here shows the records of the printer.cfg file. I want to prevent these records from being created and ensure that the contents of the printer.cfg file are not deleted.

Ekran görĂŒntĂŒsĂŒ 2024-08-27 105646

When the machine shuts down while the printer.cfg file is open, its contents are deleted, and the file is also cleared when there is an update to Klipper. As a result, I encounter the error shown in the second image I uploaded. I need to rewrite the contents of the printer.cfg file to fix this. Is there a way to resolve this issue?

These are backups of the printer.cfg that are created by Klipper automatically.

And again:

@Sineos
What should I check in the klippy.log file? Can you help me?

Just attach it here

1 Like

Config error
Traceback (most recent call last):
File “/home/pi/klipper/klippy/klippy.py”, line 130, in _connect
self._read_config()
File “/home/pi/klipper/klippy/klippy.py”, line 121, in _read_config
m.add_printer_objects(config)
File “/home/pi/klipper/klippy/mcu.py”, line 1016, in add_printer_objects
printer.add_object(‘mcu’, MCU(config.getsection(‘mcu’), mainsync))
File “/home/pi/klipper/klippy/mcu.py”, line 569, in init
self._serialport = config.get(‘serial’)
File “/home/pi/klipper/klippy/configfile.py”, line 57, in get
return self._get_wrapper(self.fileconfig.get, option, default,
File “/home/pi/klipper/klippy/configfile.py”, line 32, in _get_wrapper
raise error(“Option ‘%s’ in section ‘%s’ must be specified”
configparser.Error: Option ‘serial’ in section ‘mcu’ must be specified
webhooks client 547727986400: New connection
webhooks client 547727986400: Client info {‘program’: ‘Moonraker’, ‘version’: ‘v0.9.2-6-gf735c04’}

Simply attach the full and unmodified klippy.log

You just should attach the klippy.log and not post some lines out of it.
If you want help you should work together with the helping people here!
So create a new post and just drag’n’drop the klippy.log to it.
If this log is too big you can compress it with a common zip tool.

@Sineos @LifeOfBrian

Could you specify exactly which directory the file is located in?

1 Like

@EddyMI3D
Thanks

klippy.zip (1.1 MB)

“Could you check my klippy.log file?”

Generally the paths and locations seem to be according to the expectation in your setup.
There are strange error messages in the log that might point to a permission issue on Linux OS level.

Please show the output of the commands:

  • ls -al /home/pi/printer_data
  • ls -al /home/pi/printer_data/config

Use the code formatting tags here </> to copy and paste the output.

  • ‘ls -al /home/pi/printer_data’ output of the command:
drwxr-xr-x 11 pi pi  4096 Jul 20 18:44 .
drwxr-xr-x 18 pi pi  4096 Jul 22 11:20 ..
drwxr-xr-x  3 pi pi  4096 Jun 18  2023 backup
drwxr-xr-x  2 pi pi  4096 Jun 18  2023 certs
drwxr-xr-x  2 pi pi  4096 Aug 27 14:57 comms
drwxr-xr-x  3 pi pi 12288 Aug 27 08:31 config
drwxr-xr-x  2 pi pi  4096 Aug 27 14:57 database
drwxr-xr-x  3 pi pi  4096 Aug 22 10:14 gcodes
drwxr-xr-x  2 pi pi  4096 Aug 28 08:10 logs
drwxr-xr-x  2 pi pi  4096 Jul 20 18:44 misc
-rw-r--r--  1 pi pi   131 Jun 18  2023 moonraker.asvc
-rw-r--r--  1 pi pi    32 Jun 18  2023 .moonraker.uuid
drwxr-xr-x  2 pi pi  4096 Jan 20  2024 systemd

  • ls -al /home/pi/printer_data/config output of the command:
total 1360
drwxr-xr-x  3 pi pi 12288 Aug 27 08:31 .
drwxr-xr-x 11 pi pi  4096 Jul 20 18:44 ..
-rw-r--r--  1 pi pi  2842 Jan 20  2024 crowsnest.conf
-rw-r--r--  1 pi pi   179 Jul 23 10:46 KlipperScreen.conf
lrwxrwxrwx  1 pi pi    37 Jan 20  2024 mainsail.cfg -> /home/pi/mainsail-config/                          mainsail.cfg
-rw-r--r--  1 pi pi  2169 Jan 20  2024 moonraker.conf
-rw-r--r--  1 pi pi  1190 Jul 20 18:40 .moonraker.conf.bkp
-rw-r--r--  1 pi pi 11942 Jul 30 11:35 printer-20240730_132327.cfg
-rw-r--r--  1 pi pi 11938 Jul 30 13:23 printer-20240730_160403.cfg
-rw-r--r--  1 pi pi 11942 Jul 30 16:04 printer-20240730_160405.cfg
-rw-r--r--  1 pi pi 11942 Jul 30 16:04 printer-20240730_173406.cfg
-rw-r--r--  1 pi pi 11942 Jul 30 17:34 printer-20240730_173408.cfg
-rw-r--r--  1 pi pi 11942 Jul 30 17:34 printer-20240731_082406.cfg
-rw-r--r--  1 pi pi 11116 Jul 31 08:24 printer-20240731_084636.cfg
-rw-r--r--  1 pi pi 11944 Jul 31 08:46 printer-20240731_084856.cfg
-rw-r--r--  1 pi pi 11930 Jul 31 08:48 printer-20240731_090117.cfg
-rw-r--r--  1 pi pi 11883 Jul 31 09:01 printer-20240731_093107.cfg
-rw-r--r--  1 pi pi 11942 Jul 31 09:31 printer-20240731_110103.cfg
-rw-r--r--  1 pi pi 11116 Jul 31 11:01 printer-20240731_111337.cfg
-rw-r--r--  1 pi pi 11918 Jul 31 11:13 printer-20240731_134138.cfg
-rw-r--r--  1 pi pi 11104 Jul 31 13:41 printer-20240731_135516.cfg
-rw-r--r--  1 pi pi 11852 Jul 31 13:55 printer-20240731_140740.cfg
-rw-r--r--  1 pi pi 11838 Jul 31 14:07 printer-20240731_142023.cfg
-rw-r--r--  1 pi pi 11837 Jul 31 14:20 printer-20240731_142212.cfg
-rw-r--r--  1 pi pi 11070 Jul 31 14:22 printer-20240731_161759.cfg
-rw-r--r--  1 pi pi 11910 Jul 31 16:17 printer-20240731_171317.cfg
-rw-r--r--  1 pi pi 11100 Jul 31 17:13 printer-20240731_172523.cfg
-rw-r--r--  1 pi pi 11922 Jul 31 17:25 printer-20240801_083902.cfg
-rw-r--r--  1 pi pi 11907 Aug  1 08:39 printer-20240801_084455.cfg
-rw-r--r--  1 pi pi 11105 Aug  1 08:44 printer-20240801_090453.cfg
-rw-r--r--  1 pi pi 11916 Aug  1 09:04 printer-20240807_160821.cfg
-rw-r--r--  1 pi pi 11103 Aug  7 16:08 printer-20240807_162041.cfg
-rw-r--r--  1 pi pi 11874 Aug  7 16:20 printer-20240807_164540.cfg
-rw-r--r--  1 pi pi 11874 Aug  7 16:45 printer-20240807_171751.cfg
-rw-r--r--  1 pi pi 11880 Aug  7 17:17 printer-20240808_091920.cfg
-rw-r--r--  1 pi pi 11085 Aug  8 09:19 printer-20240808_093308.cfg
-rw-r--r--  1 pi pi 11872 Aug  8 09:33 printer-20240808_095815.cfg
-rw-r--r--  1 pi pi 11914 Aug  8 09:58 printer-20240808_095820.cfg
-rw-r--r--  1 pi pi 11914 Aug  8 09:58 printer-20240808_112217.cfg
-rw-r--r--  1 pi pi 11904 Aug  8 11:22 printer-20240808_112221.cfg
-rw-r--r--  1 pi pi 11904 Aug  8 11:22 printer-20240809_080641.cfg
-rw-r--r--  1 pi pi 11918 Aug  9 08:06 printer-20240809_080642.cfg
-rw-r--r--  1 pi pi 11918 Aug  9 08:06 printer-20240809_095706.cfg
-rw-r--r--  1 pi pi 11918 Aug  9 09:57 printer-20240809_095707.cfg
-rw-r--r--  1 pi pi 11918 Aug  9 09:58 printer-20240809_115547.cfg
-rw-r--r--  1 pi pi 11920 Aug  9 11:55 printer-20240809_115548.cfg
-rw-r--r--  1 pi pi 11920 Aug  9 11:56 printer-20240809_144415.cfg
-rw-r--r--  1 pi pi 11928 Aug  9 14:44 printer-20240809_144416.cfg
-rw-r--r--  1 pi pi 11928 Aug  9 14:44 printer-20240812_081858.cfg
-rw-r--r--  1 pi pi 11109 Aug 12 08:18 printer-20240812_083302.cfg
-rw-r--r--  1 pi pi 11888 Aug 12 08:33 printer-20240812_093031.cfg
-rw-r--r--  1 pi pi 11924 Aug 12 09:30 printer-20240812_100259.cfg
-rw-r--r--  1 pi pi 11107 Aug 12 10:02 printer-20240812_102528.cfg
-rw-r--r--  1 pi pi 11932 Aug 12 10:25 printer-20240813_080553.cfg
-rw-r--r--  1 pi pi 11926 Aug 13 08:05 printer-20240813_080554.cfg
-rw-r--r--  1 pi pi 11926 Aug 13 08:05 printer-20240813_162100.cfg
-rw-r--r--  1 pi pi 11930 Aug 13 16:21 printer-20240813_162101.cfg
-rw-r--r--  1 pi pi 11930 Aug 13 16:21 printer-20240813_171741.cfg
-rw-r--r--  1 pi pi 11936 Aug 13 17:17 printer-20240813_171742.cfg
-rw-r--r--  1 pi pi 11936 Aug 13 17:17 printer-20240814_081244.cfg
-rw-r--r--  1 pi pi 11113 Aug 14 08:12 printer-20240814_082929.cfg
-rw-r--r--  1 pi pi 11870 Aug 14 08:29 printer-20240814_083053.cfg
-rw-r--r--  1 pi pi 11080 Aug 14 08:30 printer-20240814_084545.cfg
-rw-r--r--  1 pi pi 11874 Aug 14 08:45 printer-20240815_083941.cfg
-rw-r--r--  1 pi pi 11932 Aug 15 08:39 printer-20240815_083942.cfg
-rw-r--r--  1 pi pi 11932 Aug 15 09:29 printer-20240815_112119.cfg
-rw-r--r--  1 pi pi 11932 Aug 15 11:21 printer-20240815_112120.cfg
-rw-r--r--  1 pi pi 11932 Aug 15 11:23 printer-20240815_140100.cfg
-rw-r--r--  1 pi pi 11940 Aug 15 14:01 printer-20240815_140101.cfg
-rw-r--r--  1 pi pi 11940 Aug 15 14:01 printer-20240815_154432.cfg
-rw-r--r--  1 pi pi 11938 Aug 15 15:44 printer-20240815_154535.cfg
-rw-r--r--  1 pi pi 11114 Aug 15 15:45 printer-20240815_161312.cfg
-rw-r--r--  1 pi pi 11938 Aug 15 16:13 printer-20240816_103839.cfg
-rw-r--r--  1 pi pi 11944 Aug 16 10:38 printer-20240816_103840.cfg
-rw-r--r--  1 pi pi 11948 Aug 16 14:17 printer-20240816_145436.cfg
-rw-r--r--  1 pi pi 11940 Aug 16 14:54 printer-20240816_154107.cfg
-rw-r--r--  1 pi pi 11942 Aug 16 15:41 printer-20240816_154108.cfg
-rw-r--r--  1 pi pi 11942 Aug 16 15:41 printer-20240819_083154.cfg
-rw-r--r--  1 pi pi 11118 Aug 19 08:31 printer-20240819_084944.cfg
-rw-r--r--  1 pi pi 11940 Aug 19 08:49 printer-20240819_101113.cfg
-rw-r--r--  1 pi pi 11940 Aug 19 10:11 printer-20240819_101114.cfg
-rw-r--r--  1 pi pi 11940 Aug 19 10:11 printer-20240819_120040.cfg
-rw-r--r--  1 pi pi 11938 Aug 19 12:04 printer-20240819_123551.cfg
-rw-r--r--  1 pi pi 11942 Aug 19 12:35 printer-20240819_123552.cfg
-rw-r--r--  1 pi pi 11942 Aug 19 12:35 printer-20240819_130519.cfg
-rw-r--r--  1 pi pi 11118 Aug 19 13:05 printer-20240819_132830.cfg
-rw-r--r--  1 pi pi 11936 Aug 19 16:05 printer-20240820_103716.cfg
-rw-r--r--  1 pi pi 11944 Aug 20 10:37 printer-20240820_103717.cfg
-rw-r--r--  1 pi pi 11944 Aug 20 10:37 printer-20240821_081833.cfg
-rw-r--r--  1 pi pi 11932 Aug 21 08:18 printer-20240821_090032.cfg
-rw-r--r--  1 pi pi 11894 Aug 21 09:00 printer-20240821_091827.cfg
-rw-r--r--  1 pi pi 11083 Aug 21 09:28 printer-20240821_094314.cfg
-rw-r--r--  1 pi pi 11886 Aug 21 09:43 printer-20240821_134615.cfg
-rw-r--r--  1 pi pi 11920 Aug 21 13:46 printer-20240821_140921.cfg
-rw-r--r--  1 pi pi 11104 Aug 21 14:09 printer-20240821_142707.cfg
-rw-r--r--  1 pi pi 11902 Aug 21 14:27 printer-20240821_151054.cfg
-rw-r--r--  1 pi pi 11936 Aug 21 15:10 printer-20240821_151056.cfg
-rw-r--r--  1 pi pi 11936 Aug 21 15:10 printer-20240822_080934.cfg
-rw-r--r--  1 pi pi 11936 Aug 22 08:09 printer-20240822_080935.cfg
-rw-r--r--  1 pi pi 11936 Aug 22 08:09 printer-20240822_090013.cfg
-rw-r--r--  1 pi pi 11112 Aug 22 09:00 printer-20240822_100223.cfg
-rw-r--r--  1 pi pi 11904 Aug 22 10:02 printer-20240822_104118.cfg
-rw-r--r--  1 pi pi 11096 Aug 22 10:41 printer-20240822_105716.cfg
-rw-r--r--  1 pi pi 11910 Aug 22 10:57 printer-20240823_145424.cfg
-rw-r--r--  1 pi pi 11930 Aug 23 14:54 printer-20240823_165705.cfg
-rw-r--r--  1 pi pi 11109 Aug 23 16:57 printer-20240823_171332.cfg
-rw-r--r--  1 pi pi 11910 Aug 23 17:13 printer-20240826_081611.cfg
-rw-r--r--  1 pi pi 11099 Aug 26 08:16 printer-20240826_103633.cfg
-rw-r--r--  1 pi pi 11914 Aug 26 10:36 printer-20240826_123329.cfg
-rw-r--r--  1 pi pi 11101 Aug 26 12:33 printer-20240826_125810.cfg
-rw-r--r--  1 pi pi 11858 Aug 26 12:58 printer-20240826_155521.cfg
-rw-r--r--  1 pi pi 11936 Aug 26 15:55 printer-20240826_155523.cfg
-rw-r--r--  1 pi pi 11936 Aug 26 15:55 printer-20240826_162516.cfg
-rw-r--r--  1 pi pi 11934 Aug 26 16:25 printer-20240826_162518.cfg
-rw-r--r--  1 pi pi 11934 Aug 26 16:25 printer-20240826_171544.cfg
-rw-r--r--  1 pi pi     0 Aug 26 17:15 printer-20240826_171545.cfg
-rw-r--r--  1 pi pi 11918 Aug 27 08:31 printer_autosave.cfg
-rw-r--r--  1 pi pi 11934 Aug 27 08:07 printer.cfg
-rw-r--r--  1 pi pi   770 Jan 20  2024 sonar.conf
drwxr-xr-x  2 pi pi  4096 Aug  1 09:21 .theme
lrwxrwxrwx  1 pi pi    56 Jan 20  2024 timelapse.cfg -> /home/pi/moonraker-timel                          apse/klipper_macro/timelapse.cfg

This is strange, indeed. The permissions are looking correct.
Please provide a step by step instruction how to reproduce the issue, e.g.

  1. Do this
  2. Open that
  3. Turn off A
  4. 


One observation, & one suggestion.
I see this file printer_autosave.cfg in your file listing
Found some information about that on Reddit - Dive into anything
That would have resulted from an interrupted file backup after a SAVE_CONFIG.

Some more Ive read is that, It may indicate sdcard maybe starting to flake out


The Suggestion I’ve read is to “hide the backup files” it can present a better view into your config folder.

If you click the gear icon in the Config Files section, you can tic the checkbox to "hide backup files". Then just let it handle the backup files on its own, and you don't have to see any of the copies it makes.

I’m not doubting your claim its erasing the config file, but its generally not touched unless your doing a save config.

If you happen to be running bed meshing and want to avoid the save_config prompt, it can be overidden in the UI