0

Following the accepted answer to this question, I have adjusted the ppa entry for geogebra to the following entry:

deb [signed-by=/usr/share/keyrings/geogebra.gpg] http://www.geogebra.net/linux/ stable main

This works very well, however occasionally the file /etc/apt/sources.list.d/geogebra.list seems to get overwritten and reverted to the old version:

deb http://www.geogebra.net/linux/ stable main

When is this file overwritten? How can I prevent this, without reducing the security level (meaning: I want the particular key to be usable only for the particular ppa and software)?

I am on (K)Ubuntu 23.10.

Bruni
  • 10,542
  • Please share an example who the overwritten file looks like. Any idea when the overwritting happens? After running apt update. Please also add details on which Ubuntu release you are using. – noisefloor Dec 28 '23 at 08:52
  • @noisefloor I have adjusted the question to include the requested information. I have not yet identified when this happens, though it is not after running apt update. – Bruni Dec 28 '23 at 10:14
  • It's possible one of the packages from this repository thinks it owns that file and tries to overwrite it instead of treating it as a conffile. Usually I'd call that a packaging bug and file a bug report with the maintainers. Check the postinst files of the packages you have installed from that repo. – muru Dec 28 '23 at 12:33
  • @muru Thank you. Can you give be a pointer were to find those? – Bruni Dec 28 '23 at 13:43
  • 1
    The postinst files are in /var/lib/dpkg/info/. Maybe try something like grep geogebra.list /var/lib/dpkg/info/ -R --include='*.postinst' – muru Dec 28 '23 at 20:14

1 Answers1

2

Working around the problem:

You can make the file immutable:

sudo chattr +i /etc/apt/sources.list.d/geogebra.list

You can change the file name to geogebra-classic.list. The other file will provide a warning when using apt.

But to solve the root cause of the problem you need to check the running script on your system, crontab, custom systemd services...

Bruni
  • 10,542
GAD3R
  • 3,507
  • 1
    @Bruni Oh my bad. It is chattr +i. Yes it will work. But the clean solution is to found the script causing this problem. – GAD3R Dec 28 '23 at 13:42
  • @Bruni I am writing from a smartphone. The autocorrect make my post unreadable. – GAD3R Dec 28 '23 at 13:46
  • 1
    No problem, I adjusted the command as you intended it to be written. This will definitely help a lot. I will also contact geogebra and maybe they will adjust the intstructions. – Bruni Dec 28 '23 at 13:50
  • 1
    @Bruni This tuto may be helpful to track file changes https://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html – GAD3R Dec 28 '23 at 13:53