[Bug 1861363] Re: /etc/environment.d cannot be used to add to PATH

Chai T. Rex 1861363 at bugs.launchpad.net
Fri Jan 31 02:04:37 UTC 2020


I've found out that `/etc/environment.d` is not intended for setting
environment variables for login shells. From poettering at
https://github.com/systemd/systemd/issues/12938:

    @dschepler is right. systemd-environment-d-generator gets run by
systemd --user, and thus set environment variables for the systemd per-
user service manager and their child processes only. Login shells (such
as those started via getty on the console or ssh) are not children of
systemd and hence the generators have no effect on them whatsoever.

    For login sessions use pam_env or some .profile script or similar to
set env vars... Sorry.

** Bug watch added: github.com/systemd/systemd/issues #12938
   https://github.com/systemd/systemd/issues/12938

** Changed in: systemd (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1861363

Title:
  /etc/environment.d cannot be used to add to PATH

Status in systemd package in Ubuntu:
  Invalid

Bug description:
  I've added an executable file `/etc/environment.d/60-haskell.conf`
  with the following contents:

      PATH=/opt/ghc/bin:$PATH

  According to `man environment.d`, this is a proper procedure for
  altering the PATH variable via systemd. However, it does not work on
  Ubuntu. The PATH on reboot does not include `/opt/ghc/bin`.

  This is due to `/etc/profile` incorrectly overwriting the PATH
  according to comment #10 on
  https://github.com/systemd/systemd/issues/6414.

  There is a Debian bug at https://bugs.debian.org/cgi-
  bin/bugreport.cgi?bug=869144 that was prematurely closed because on
  the Debian side **because it was a Debian issue** rather than a
  systemd issue, which seems quite nonsensical. Perhaps that issue can
  be reopened or another can be opened.

  ======

  Description:    Ubuntu 18.04.3 LTS
  Release:        18.04

  systemd:
    Installed: 237-3ubuntu10.33
    Candidate: 237-3ubuntu10.33
    Version table:
   *** 237-3ubuntu10.33 500
          500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
          100 /var/lib/dpkg/status
       237-3ubuntu10.29 500
          500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
       237-3ubuntu10 500
          500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: systemd 237-3ubuntu10.33
  ProcVersionSignature: Ubuntu 4.15.0-74.84-generic 4.15.18
  Uname: Linux 4.15.0-74-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.9
  Architecture: amd64
  Date: Wed Jan 29 19:07:31 2020
  InstallationDate: Installed on 2019-10-10 (111 days ago)
  InstallationMedia: Ubuntu-Server 18.04.3 LTS "Bionic Beaver" - Release amd64 (20190805)
  Lsusb:
   Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd 
   Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
  ProcEnviron:
   TERM=screen
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.15.0-74-generic root=UUID=111df9fc-1d42-47eb-82a6-3a80a0aba4c7 ro consoleblank=0
  SourcePackage: systemd
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 04/01/2014
  dmi.bios.vendor: SeaBIOS
  dmi.bios.version: rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org
  dmi.chassis.type: 1
  dmi.chassis.vendor: QEMU
  dmi.chassis.version: pc-i440fx-3.1
  dmi.modalias: dmi:bvnSeaBIOS:bvrrel-1.12.0-0-ga698c8995f-prebuilt.qemu.org:bd04/01/2014:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-3.1:cvnQEMU:ct1:cvrpc-i440fx-3.1:
  dmi.product.name: Standard PC (i440FX + PIIX, 1996)
  dmi.product.version: pc-i440fx-3.1
  dmi.sys.vendor: QEMU
  modified.conffile..etc.systemd.timesyncd.conf: [modified]
  mtime.conffile..etc.systemd.timesyncd.conf: 2019-10-10T02:35:05.488000

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861363/+subscriptions



More information about the foundations-bugs mailing list