• state of /etc/profile

    From Hans@21:1/5 to All on Wed Oct 16 19:10:01 2024
    This is a multi-part message in MIME format.

    Dear list,

    whilst searching for the default umask setting and reading several manuals, I came to /etc/
    profile.

    In this file, the default umask is set. So far so well.

    But I wondered, why this file is not modified during my updates. As people told, /etc/profile is
    part of the package base-files and is copied from /usr/share/base-files/profile.

    Examination of the files showed, there is a differnce between /etc/profiles and /usr/share/base-
    files/profile.

    I would have expected, that both foles are identical and /etc/profile will be renewed and
    overwritten during upgrades.

    Can someone tell me, why not? And related to this question: Does this behaviour effect other
    files, too, like bashrc bashrc_aliases and similar?

    I saw some changes to these files in /etc/skel/, so these might only affect newly added users
    (whoich I do not have). My system is really, really old, first install was Debian/Etch and then
    upgraded until today (Bookworm).

    What shall I say: Debian is running stable since this very, very long time and never failed in a
    way, I had to reinstall it.

    Thus, some configuration files might be also very old.

    However, no problem here, but just want to know, why it is as decribed above.

    Thanks for a short answer.

    Best

    Hans



    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Dear list,</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">whilst searching for the default umask setting and reading several manuals, I came to /etc/profile.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">In this file, the default umask is set. So far so well.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">But I wondered, why this file is not modified during my updates. As people told, /etc/profile is part of the package base-files and is copied from <span style="font-family:Hack;">
    /usr/share/base-files/profile.</span></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Examination of the files showed, there is a differnce between /etc/profiles and /usr/share/base-files/profile. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I would have expected, that both foles are identical and /etc/profile will be renewed and overwritten during upgrades. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Can someone tell me, why not? And related to this question: Does this behaviour effect other files, too, like bashrc bashrc_aliases and similar?</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I saw some changes to these files in /etc/skel/, so these might only affect newly added users (whoich I do not have). My system is really, really old, first install was Debian/
    Etch and then upgraded until today (Bookworm).</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">What shall I say: Debian is running stable since this very, very long time and never failed in a way, I had to reinstall it. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Thus, some configuration files might be also very old.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">However, no problem here, but just want to know, why it is as decribed above.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Thanks for a short answer.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Best </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans </p>
    <br /><br /></body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Hans on Wed Oct 16 20:00:01 2024
    On Wed, Oct 16, 2024 at 19:03:27 +0200, Hans wrote:
    But I wondered, why this file is not modified during my updates. As people told, /etc/profile is
    part of the package base-files and is copied from /usr/share/base-files/profile.

    It's not actually part of the base-files package. It's not part of *any* package.

    hobbit:~$ dpkg -S /etc/profile
    dpkg-query: no path found matching pattern /etc/profile

    You can also come at it from the other direction: run "dpkg -L base-files"
    to see the files that are part of the base-files package. You will not
    see /etc/profile in the output. You'll only see /etc/profile.d which is
    a directory.

    Examination of the files showed, there is a differnce between /etc/profiles and /usr/share/base-
    files/profile.

    The /var/lib/dpkg/info/base-files.postinst script contains code that will modify /etc/profile if the first argument is "configure" and the second argument isn't the empty string.

    I don't know what would cause those particular arguments to be passed to
    that script.

    In order for that modification to happen, the existing file's MD5 checksum
    is compared against the one found in /usr/share/base-files/.

    So... either your /etc/profile doesn't have the right MD5 checksum, or
    else nothing is calling that postinst script with the correct arguments.

    Can someone tell me, why not? And related to this question: Does this behaviour effect other
    files, too, like bashrc bashrc_aliases and similar?

    /etc/skel/.bashrc *is* part of a package:

    hobbit:~$ dpkg -S /etc/skel/.bashrc
    bash: /etc/skel/.bashrc

    So, that file will be updated normally during bash package upgrades.

    Of course, that file is only used when new user accounts are created.
    Any existing accounts will not have their ~/.bashrc files modified.

    There isn't a "bashrc_aliases" file in Debian. That's something unique
    to your setup.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Ritter@21:1/5 to Hans on Wed Oct 16 20:20:01 2024
    Hans wrote:
    But I wondered, why this file is not modified during my updates. As people told, /etc/profile is
    part of the package base-files and is copied from /usr/share/base-files/profile.

    Examination of the files showed, there is a differnce between /etc/profiles and /usr/share/base-
    files/profile.

    When you upgrade packages on an existing system, some packages
    will note that they have big changes that you will need to make
    in their config files; others will note that the defaults have
    changed.

    It is up to you to decide to make those small changes.

    I would have expected, that both foles are identical and /etc/profile will be renewed and
    overwritten during upgrades.

    If it is not necessary, that won't happen. That would change
    behavior out from underneath you.

    Witness, for example, the unhappiness when the default config
    for vim was changed so that people who relied on the system
    default config suddenly had X11 cut/paste fail.

    Can someone tell me, why not? And related to this question: Does this behaviour effect other
    files, too, like bashrc bashrc_aliases and similar?

    I saw some changes to these files in /etc/skel/, so these might only affect newly added users
    (whoich I do not have). My system is really, really old, first install was Debian/Etch and then
    upgraded until today (Bookworm).

    If it is not necessary to keep the system running, it shouldn't
    be changed without your permission. As you note, /etc/skel only
    affects newly created users.

    You might find it useful to look at the results of:

    find /etc -name "*dpkg*" -print

    to see what has been proposed in the last upgrade cycle.

    -dsr-

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Wed Oct 16 20:20:01 2024
    This is a multi-part message in MIME format.

    Hi Greg,
    The /var/lib/dpkg/info/base-files.postinst script contains code that will modify /etc/profile if the first argument is "configure" and the second argument isn't the empty string.

    I don't know what would cause those particular arguments to be passed to
    that script.

    In order for that modification to happen, the existing file's MD5 checksum
    is compared against the one found in /usr/share/base-files/.

    So... either your /etc/profile doesn't have the right MD5 checksum, or
    else nothing is calling that postinst script with the correct arguments.


    so, if that is true, what you say (or if I understood you correctly), then a reinstall or upgrade of
    the package "base-files" should overwrite /etc/profile if the md5sum is different.

    Well, it did not. I tried "apt-get --reinstall install base-files" and nothing changed.

    md5sum /etc/profile
    40f068da82e55a304d8baf245600b636 /etc/profile
    md5sum /usr/share/base-files/profile
    48a30a427d1794feb49f102b87ddce2b /usr/share/base-files/profile
    Without md5sum it can also be clearly seen, as both files got different content.

    I believe, it might be more what Dan said: Overwriting some existent special configuration
    files, might break the system of people. So they are not changed and the user/admin can later
    decide, if he wants to overwrite these files or not.

    Additionally (but can not prove it), it may be, that a missing file will be renewed during upgrade
    (did not test this!).

    Can be I am fully wrong, maybe someone knows more.

    Have fun!

    Hans




    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hi Greg, </p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; The /var/lib/dpkg/info/base-files.postinst script contains code that will</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; modify /etc/profile if the first argument is &quot;configure&quot; and the second</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; argument isn't the empty string.</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; I don't know what would cause those particular arguments to be passed to</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; that script.</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; In order for that modification to happen, the existing file's MD5 checksum</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; is compared against the one found in /usr/share/base-files/.</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; So... either your /etc/profile doesn't have the right MD5 checksum, or</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; else nothing is calling that postinst script with the correct arguments.</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; </p> <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">so, if that is true, what you say (or if I understood you correctly), then a reinstall or upgrade of the package &quot;base-files&quot; should overwrite /etc/profile if the
    md5sum is different.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Well, it did not. I tried &quot;apt-get --reinstall install base-files&quot; and nothing changed.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="color:#000000;"><span style="font-family:monospace;"><span style="background-color:#ffffff;">md5sum /etc/profile </span></span></span><br />
    40f068da82e55a304d8baf245600b636  /etc/profile </p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="color:#000000;"><span style="background-color:#ffffff;">md5sum /usr/share/base-files/profile </span></span><br />48a30a427d1794feb49f102b87ddce2b  /usr/share/base-files/
    profile </p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Without md5sum it can also be clearly seen, as both files got different content. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I&nbsp; believe, it might be more what Dan said: Overwriting some existent special configuration files, might break the system of people. So they are not changed and the user/
    admin can later decide, if he wants to overwrite these files or not. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Additionally (but can not prove it), it may be, that a missing file will be renewed during upgrade (did not test this!).</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Can be I am fully wrong, maybe someone knows more.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Have fun!</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans&nbsp; </p>
    <p>&nbsp;<p>&nbsp;</p>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Hans on Wed Oct 16 21:30:01 2024
    On Wed, Oct 16, 2024 at 20:17:11 +0200, Hans wrote:
    so, if that is true, what you say (or if I understood you correctly), then a reinstall or upgrade of
    the package "base-files" should overwrite /etc/profile if the md5sum is different.

    No. You have it backwards. It only updates /etc/profile if the MD5
    checksum is the same.

    Here's the function that gets called:


    update_to_current_default() {
    if [ -f "$2" ]; then
    md5=$(md5sum "$2" | cut -f 1 -d " ")
    if grep -q "$md5" "/usr/share/base-files/$1.md5sums"; then
    if ! cmp -s "/usr/share/base-files/$1" "$2"; then
    cp -p "/usr/share/base-files/$1" "$2"
    echo Updating $2 to current default.
    fi
    fi
    fi
    }


    If the output of md5sum /etc/profile appears in the /usr/share/base-files/profile.md5sums file, then the file is eligible for copying.

    If the output of md5sum /etc/profile is NOT in the profile.md5sums file,
    then nothing happens.

    md5sum /etc/profile
    40f068da82e55a304d8baf245600b636 /etc/profile
    md5sum /usr/share/base-files/profile
    48a30a427d1794feb49f102b87ddce2b /usr/share/base-files/profile
    Without md5sum it can also be clearly seen, as both files got different content.

    You want "cat /usr/share/base-files/profile.md5sums" probably.

    Your file does not match any of the known MD5 checksums. It has been
    modified, most likely by you. Or maybe you do not have an actual Debian
    system -- perhaps you installed a derivative and then tried to "migrate"
    it in place to Debian, or something like that.

    In any case, it doesn't match, so Debian will not overwrite it.

    If you want to merge your local /etc/profile changes into the new version
    of the base-files profile, you'll have to do it yourself. It will be
    easiest if you made a backup copy of the file before you modified it. Then
    you can use "diff -u /etc/profile.my.backup.copy /etc/profile" to see
    what you changed, and apply those changes to the new profile.

    If you don't have a backup of the original profile, you'll have to figure
    out what your changes were some other way.

    Additionally (but can not prove it), it may be, that a missing file will be renewed during upgrade
    (did not test this!).

    ... this topic is just going to KEEP drifting, isn't it.

    A MISSING conffile will not be replaced when a package is upgraded.

    This is an intentional decision by Debian, to respect the wishes of
    the local system administrator. If a conffile has been removed, Debian
    has to assume this was deliberate, and that you want it to remain gone.

    Now, /etc/profile is NOT a conffile. It's a special magic thing all unto itself, with special code to handle it.

    But in general? Missing conffiles are not replaced.

    If you want to replace a missing conffile, look at "dpkg --force-confmiss",
    or extract the .deb manually and copy the missing conffile into place
    yourself.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Crawley@21:1/5 to Greg Wooledge on Thu Oct 17 05:30:01 2024
    On 17/10/2024 02:58, Greg Wooledge wrote:
    On Wed, Oct 16, 2024 at 19:03:27 +0200, Hans wrote:
    But I wondered, why this file is not modified during my updates. As people told, /etc/profile is
    part of the package base-files and is copied from /usr/share/base-files/profile.

    It's not actually part of the base-files package. It's not part of *any* package.

    The /var/lib/dpkg/info/base-files.postinst script contains code that will modify /etc/profile if the first argument is "configure" and the second argument isn't the empty string.

    I don't know what would cause those particular arguments to be passed to
    that script.
    Just for reference, the excruciating details of how and when each maintainer script is called are here:
    https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#details-of-configuration

    "When we configure a package (this happens with dpkg --install and dpkg --configure), we first update any conffiles and then call:
    postinst configure most-recently-configured-version
    "
    So if $2 is non-empty it means an upgrade.

    A flow chart is here: https://www.debian.org/doc/debian-policy/ap-flowcharts.html

    --
    John

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)