Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Hi Mitchell I have been looking at the man page of pam_env.conf(5) / environment(5). I've assumed pam_env to traditionally be the thing that has always been loading that file, and as such, it's documentation to be authoritative for the format of said file. The aforementioned man page states: > The /etc/environment file specifies the environment variables to be set. > The file must consist of simple NAME=VALUE pairs on separate lines. The > pam_env(8) module will read the file after the pam_env.conf file. If we assume this to be the entire specification for the format of said file, then that doesn't include comments. That said, in retrospect, it seams that may not have been the case after all. The pam_env(8) man page for example mentions that a variable can be prefixed with "export " for bash compatibility and that it won't do anything. I wouldn't be surprised if it actually did support comments and it's just not documented. I also noticed that it removes " quotes from the start and end of a value. I'm not sure what other processing it does. By the way, pam_env certainly will not expand variables the way the so-called freedesktop "standard" (or rather, systemd documentation, really), does. I don't use systemd myself, but this would certainly also affect systemd systems in some contexts / environments, assuming they also use pam_env, which most systems tend to do, as far as I know. On the other hand, based on what that document says, systemd may not handle " quotes, unlike pam_env does. So if /etc/environment is to be a subset of what bash and pam_env allow, I should put values containing a space in quotes. If /etc/environment is to be compatible with systemd and pam_env, I mustn't put such a value in quotes. And if /etc/environment is to be compatible with systemd, pam_env and bash sourcing, that means I can't put spaces and many other things in that file. I'm not sure what the best way to resolve this format mismatch is. If the file is to be bash source-able, then my change should be reverted. That'd mean it can't contain spaces and some other things. (Unless systemd adds support for quotes there, that is), and that should then probably be documented somewhere. If it is not to be bash source-able, then the parsing logic of my previous change should probably be extended to allow comments. Regards, Daniel Abrecht
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Hi Daniel, We also implemented the proposed change in Ubuntu Resolute, but according to an Ubuntu user[0], this breaks comment parsing in /etc/environment. I know you mentioned that "/etc/environment does not contain any form of quoting or escaping, nor can it contain comments" earlier in this thread. However, is there a source for this? I was trying to find a clear answer on the format specification, and all I can find is this freedesktop spec[1], which seems to suggest the opposite: > Empty lines and lines beginning with the comment character "#" are ignored. Is there some conflicting specification that states that we shouldn't ignore lines beginning with "#"? [0] https://bugs.launchpad.net/ubuntu/+source/texinfo/+bug/2125808/comments/8 [1] https://www.freedesktop.org/software/systemd/man/latest/environment.d.html#Configuration%20Format Thanks, Mitchell Augustin On Wed, Jan 28, 2026 at 3:43 PM Mitchell Augustin < [email protected]> wrote: > I submitted an MR to > https://salsa.debian.org/tex-team/texinfo/-/merge_requests/13 with the > solution proposed in this thread. > > > On Thu, Jan 22, 2026 at 9:07 AM Mitchell Augustin > wrote: > > > > > could you provide your /etc/environments file? > > > > I'm not Daniel, but if you just need a reproducer for the issue with > > sourcing, a minimal repro is to add an unquoted variable with > > semicolons in your /etc/environments, such as this: > > root@envtest:~# cat /etc/environment > > > PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" > > MY_LIST=1;2;3;4;5 > > > > and then attempt to `apt install` any program. You should then see: > > dpkg: error processing package install-info (--configure): > > installed install-info package post-installation script subprocess > > returned error exit status 127 > > > > > > Please let me know if there is any additional context I can provide > > here to further assist you in deciding how to address this bug. > > > > Thanks, > > Mitchell Augustin > > > > > > On Wed, Dec 10, 2025 at 5:13 PM Mitchell Augustin > > wrote: > > > > > > Hi all, > > > > > > This still seems to be an issue for some applications. Have there been > > > any discussions on the Debian side about adjusting the handling of > > > /etc/environment here? > > > > > > -- > > > Mitchell Augustin > > > Software Engineer - Ubuntu Partner Engineering > > > Email:[email protected] > > > Location:United States of America (Central Time) > > > > > > > > > canonical.com > > > ubuntu.com > > > > > > > > -- > > Mitchell Augustin > > Software Engineer - Ubuntu Partner Engineering > > Email:[email protected] > > Location:United States of America (Central Time) > > > > > > canonical.com > > ubuntu.com > > > > -- > Mitchell Augustin > Software Engineer - Ubuntu Partner Engineering > Email:[email protected] > [email protected] > Location:United States of America (Central Time) > > > canonical.com > ubuntu.com > -- [image: Canonical-20th-anniversary] Mitchell Augustin Software Engineer - Ubuntu Partner Engineering Email: [email protected] [email protected] Location: United States of America (Central Time) canonical.com ubuntu.com
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Control: tags -1 + pending Am 28.01.2026 um 22:43 schrieb Mitchell Augustin: Hello, I submitted an MR to https://salsa.debian.org/tex-team/texinfo/-/merge_requests/13 with the solution proposed in this thread. The MR has been merged. H. -- sigfault OpenPGP_signature.asc Description: OpenPGP digital signature
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
I submitted an MR to https://salsa.debian.org/tex-team/texinfo/-/merge_requests/13 with the solution proposed in this thread. On Thu, Jan 22, 2026 at 9:07 AM Mitchell Augustin wrote: > > > could you provide your /etc/environments file? > > I'm not Daniel, but if you just need a reproducer for the issue with > sourcing, a minimal repro is to add an unquoted variable with > semicolons in your /etc/environments, such as this: > root@envtest:~# cat /etc/environment > PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" > MY_LIST=1;2;3;4;5 > > and then attempt to `apt install` any program. You should then see: > dpkg: error processing package install-info (--configure): > installed install-info package post-installation script subprocess > returned error exit status 127 > > > Please let me know if there is any additional context I can provide > here to further assist you in deciding how to address this bug. > > Thanks, > Mitchell Augustin > > > On Wed, Dec 10, 2025 at 5:13 PM Mitchell Augustin > wrote: > > > > Hi all, > > > > This still seems to be an issue for some applications. Have there been > > any discussions on the Debian side about adjusting the handling of > > /etc/environment here? > > > > -- > > Mitchell Augustin > > Software Engineer - Ubuntu Partner Engineering > > Email:[email protected] > > Location:United States of America (Central Time) > > > > > > canonical.com > > ubuntu.com > > > > -- > Mitchell Augustin > Software Engineer - Ubuntu Partner Engineering > Email:[email protected] > Location:United States of America (Central Time) > > > canonical.com > ubuntu.com -- Mitchell Augustin Software Engineer - Ubuntu Partner Engineering Email:[email protected] [email protected] Location:United States of America (Central Time) canonical.com ubuntu.com
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
> could you provide your /etc/environments file? I'm not Daniel, but if you just need a reproducer for the issue with sourcing, a minimal repro is to add an unquoted variable with semicolons in your /etc/environments, such as this: root@envtest:~# cat /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" MY_LIST=1;2;3;4;5 and then attempt to `apt install` any program. You should then see: dpkg: error processing package install-info (--configure): installed install-info package post-installation script subprocess returned error exit status 127 Please let me know if there is any additional context I can provide here to further assist you in deciding how to address this bug. Thanks, Mitchell Augustin On Wed, Dec 10, 2025 at 5:13 PM Mitchell Augustin wrote: > > Hi all, > > This still seems to be an issue for some applications. Have there been > any discussions on the Debian side about adjusting the handling of > /etc/environment here? > > -- > Mitchell Augustin > Software Engineer - Ubuntu Partner Engineering > Email:[email protected] > Location:United States of America (Central Time) > > > canonical.com > ubuntu.com -- Mitchell Augustin Software Engineer - Ubuntu Partner Engineering Email:[email protected] Location:United States of America (Central Time) canonical.com ubuntu.com
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Hello, could you provide your /etc/environments file? Hilmar 12.12.2025 17:41:57 Daniel Abrecht : > Package: update-info-dir > Version: 6.8-6+b1 > > > After an "apt-get upgrade", I got this output: > ``` > Reading package lists... Done > Building dependency tree... Done > Reading state information... Done > Calculating upgrade... Done > 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. > 1 not fully installed or removed. > After this operation, 0 B of additional disk space will be used. > Do you want to continue? [Y/n] > Setting up install-info (6.8-6+b1) ... > /usr/sbin/update-info-dir: 4: /etc/environment: help: not found > dpkg: error processing package install-info (--configure): > installed install-info package post-installation script subprocess returned > error exit status 127 > Errors were encountered while processing: > install-info > E: Sub-process /usr/bin/dpkg returned an error code (1) > ``` > > > The script /usr/sbin/update-info-dir sources /etc/environment, but > /etc/environment is not a shell script. > Usually, this file is loaded by pam_env, from the man page PAM_ENV(7): >> Second a file (/etc/environment by default) with simple KEY=VAL pairs on >> separate lines will be read > > Please note that /etc/environment does not contain any form of quoting or > escaping, nor can it contain comments. > Because the script /usr/sbin/update-info-dir sources /etc/environment, if any > of the values contains a space, it'll try executing part of it as a command, > which is not desirable. > > Loading this file in a script correctly can be quiet tricky. I'm not sure why > it's done here at all, but I think the following should work: > ``` > exec 9<&0 while read -r env > do if [ -n "$env" ] > then export "$env" > fi; done > exec 0<&9 9<&- > ``` > > There is one more thing to consider. Some packages seam to distribute config > files stored in /etc/environment.d/. > On my system, they do not seam to get loaded, although I'm pretty sure on > distros where pam_env is built with econf support, they usually do get loaded. > I also don't know where else /etc/environment and /etc/environment.d/ may get > loaded nowadays, it's quiet possible other scripts may have similar issues. > And I think the inconsistent use of /etc/environment.d/ in debian is a bigger > issue, a decision should be made what to do about it.
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Am 07.09.2025 um 17:15 schrieb Daniel Abrecht: Hello, Please note that /etc/environment does not contain any form of quoting or escaping, nor can it contain comments. Because the script /usr/sbin/update-info-dir sources /etc/environment, if any of the values contains a space, it'll try executing part of it as a command, which is not desirable. Loading this file in a script correctly can be quiet tricky. I'm not sure why it's done here at all, but I think the following should work: ``` You may have a look at [1], when looking for the reason, why we source /etc/environment at all. Thanks for the code suggestion, I'll have a look at it. Hilmar [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536476 -- sigfault OpenPGP_signature.asc Description: OpenPGP digital signature
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Control: severity -1 important Am 11.12.2025 um 00:13 schrieb Mitchell Augustin: Hello, This still seems to be an issue for some applications. Have there been any discussions on the Debian side about adjusting the handling of /etc/environment here? Due to the wrongly named package the original submission did not reach me. And the reassignment I probably ignored, assuming that I have already the submission. I'll try to have a look. H. -- sigfault OpenPGP_signature.asc Description: OpenPGP digital signature
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Hi all, This still seems to be an issue for some applications. Have there been any discussions on the Debian side about adjusting the handling of /etc/environment here? -- Mitchell Augustin Software Engineer - Ubuntu Partner Engineering Email:[email protected] Location:United States of America (Central Time) canonical.com ubuntu.com
Bug#1114610: post-installation script failed due to incorrect processing of /etc/environment
Package: update-info-dir Version: 6.8-6+b1 After an "apt-get upgrade", I got this output: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Setting up install-info (6.8-6+b1) ... /usr/sbin/update-info-dir: 4: /etc/environment: help: not found dpkg: error processing package install-info (--configure): installed install-info package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: install-info E: Sub-process /usr/bin/dpkg returned an error code (1) ``` The script /usr/sbin/update-info-dir sources /etc/environment, but /etc/environment is not a shell script. Usually, this file is loaded by pam_env, from the man page PAM_ENV(7): Second a file (/etc/environment by default) with simple KEY=VAL pairs on separate lines will be read Please note that /etc/environment does not contain any form of quoting or escaping, nor can it contain comments. Because the script /usr/sbin/update-info-dir sources /etc/environment, if any of the values contains a space, it'll try executing part of it as a command, which is not desirable. Loading this file in a script correctly can be quiet tricky. I'm not sure why it's done here at all, but I think the following should work: ``` exec 9<&0 There is one more thing to consider. Some packages seam to distribute config files stored in /etc/environment.d/. On my system, they do not seam to get loaded, although I'm pretty sure on distros where pam_env is built with econf support, they usually do get loaded. I also don't know where else /etc/environment and /etc/environment.d/ may get loaded nowadays, it's quiet possible other scripts may have similar issues. And I think the inconsistent use of /etc/environment.d/ in debian is a bigger issue, a decision should be made what to do about it.

