Non-alphanumeric key

Hi all!

I know this isn’t strictly a Manjaro-only question, but I have a bit of a conundrum here, so I’m taking a chance.

I’ve done this a while ago, but everything seemed to be working. Today, I saw that it isn’t really. Or at least, if it is, then I don’t know how or why.

I tried adding some environment variables to /etc/environment, if this isn’t the right place, I’ll happily change it, but I put it there, so that the variables would be available to anyone using the computer. (It’s only me, but I did it this way to learn something new, to use in the future should it b e neccessary.) I used an if to check if it’s root or not, and assign the variables if it’s not.

This morning, after the update, I wanted to make sure there are no errors on boot. So, I did:

journalctl --boot --priority=3

as root.

And it gave me some HDD errors, that was caused by a faulty cable but I don’t know how to clear S.M.A.R.T. errors, or even if they can be cleared. However, I also received:

$ journalctl --boot --priority=3

[...]
pam_env(systemd-user:session): non-alphanumeric key 'if [[ $UID -eq 1000 ]];' in /etc/environment', ignoring
[...]

So it looks too me, like my if in /etc/enviroment isn’t correct.

The if statement:

## Some environment variables by Mirdarthos
if [[ $UID -eq 1000 ]];
then
# a Custom editor for visudo
SUDO_EDITOR="/usr/bin/micro"
[...]
fi

My questions are:

  • Am I doing the check if not root correct?
    • If not, how should I change it?
    • If so, what is causing the error?
  • Anything else I need to be aware of?

I know we always say to include an inxi output here, so here is mine, althoough I have no idea what use it could possibly be:

$ inxi --admin --verbosity=7 --filter --no-host --width
System:
Kernel: 5.15.12-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
root=UUID=9a26c8d0-43f4-44ad-a7d3-861d6f6cdbfa rw quiet apparmor=1
security=apparmor resume=UUID=1b3f894f-5481-4241-ace5-c129a0cdb412
udev.log_priority=3
Console: pty pts/2 DM: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
Type: Desktop System: Gigabyte product: Z370 HD3 v: N/A serial: N/A
Mobo: Gigabyte model: Z370 HD3-CF v: x.x serial: N/A
UEFI: American Megatrends v: F5 date: 10/30/2017
Battery:
Message: No system battery data found. Is one present?
Memory:
RAM: total: 15.58 GiB used: 4.08 GiB (26.2%)
Array-1: capacity: 64 GiB slots: 4 EC: None max-module-size: 16 GiB
note: est.
Device-1: ChannelA-DIMM0 size: No Module Installed
Device-2: ChannelA-DIMM1 size: No Module Installed
Device-3: ChannelB-DIMM0 size: 8 GiB speed: 2133 MT/s type: DDR4
detail: synchronous unbuffered (unregistered) bus-width: 64 bits
total: 64 bits manufacturer: G.Skill part-no: F4-3000C16-8GSXKB
serial: N/A
Device-4: ChannelB-DIMM1 size: 8 GiB speed: 2133 MT/s type: DDR4
detail: synchronous unbuffered (unregistered) bus-width: 64 bits
total: 64 bits manufacturer: G.Skill part-no: F4-3000C16-8GSXKB
serial: N/A
CPU:
Info: model: Intel Core i7-8700 socket: LGA1151 (U3E1) note: check bits: 64
type: MT MCP arch: Coffee Lake family: 6 model-id: 0x9E (158)
stepping: 0xA (10) microcode: 0xEA
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
L3: 12 MiB desc: 1x12 MiB
Speed (MHz): avg: 4447 high: 4502 min/max: 800/4600 base/boost: 4300/8300
scaling: driver: intel_pstate governor: performance volts: 1.1 V
ext-clock: 100 MHz cores: 1: 4502 2: 4431 3: 4315 4: 4469 5: 4461 6: 4498
7: 4398 8: 4423 9: 4473 10: 4470 11: 4500 12: 4425 bogomips: 76831
Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_perfmon
art avx avx2 bmi1 bmi2 bts clflush clflushopt cmov constant_tsc cpuid
cpuid_fault cx16 cx8 de ds_cpl dtes64 dtherm dts ept ept_ad erms est f16c
flexpriority flush_l1d fma fpu fsgsbase fxsr ht hwp hwp_act_window hwp_epp
hwp_notify ibpb ibrs ida intel_pt invpcid invpcid_single lahf_lm lm mca
mce md_clear mmx monitor movbe mpx msr mtrr nonstop_tsc nopl nx pae pat
pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts
rdrand rdseed rdtscp rep_good sdbg sep smap smep smx ss ssbd sse sse2
sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust
tsc_deadline_timer vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt
xsaves xtopology xtpr
Vulnerabilities:
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf
mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
IBRS_FW, STIBP: conditional, RSB filling
Type: srbds mitigation: Microcode
Type: tsx_async_abort mitigation: TSX disabled
Graphics:
Device-1: NVIDIA GM206 [GeForce GTX 960] vendor: Gigabyte driver: nvidia
v: 495.44 alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:1401
class-ID: 0300
Display: server: X.org 1.21.1.2 compositor: kwin_x11 driver:
loaded: nvidia tty: 252x45
Message: Advanced graphics data unavailable in console for root.
Audio:
Device-1: Intel 200 Series PCH HD Audio vendor: Gigabyte
driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a2f0
class-ID: 0403
Device-2: NVIDIA GM206 High Definition Audio vendor: Gigabyte
driver: snd_hda_intel v: kernel bus-ID: 01:00.1 chip-ID: 10de:0fba
class-ID: 0403
Sound Server-1: ALSA v: k5.15.12-1-MANJARO running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: yes
Sound Server-4: PipeWire v: 0.3.42 running: yes
Network:
Device-1: Intel Ethernet I219-V vendor: Gigabyte driver: e1000e v: kernel
port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15b8 class-ID: 0200
IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac: <filter>
IP v4: <filter> type: dynamic noprefixroute scope: global
broadcast: <filter>
IP v6: <filter> type: noprefixroute scope: link
WAN IP: <filter>
Bluetooth:
Message: No bluetooth data found.
Logical:
Message: No logical block device data found.
RAID:
Message: No RAID data found.
Drives:
Local Storage: total: 8.41 TiB used: 2.81 TiB (33.4%)
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 960 EVO 250GB
size: 232.89 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: <filter> rev: 3B7QCXE7 temp: 31.9 C scheme: GPT
SMART: yes health: PASSED on: 141d 15h cycles: 1,674
read-units: 39,455,047 [20.2 TB] written-units: 26,392,307 [13.5 TB]
ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST5000VX0011-1T317X
family: Surveillance size: 4.55 TiB block-size: physical: 4096 B
logical: 512 B sata: 3.1 speed: 6.0 Gb/s type: HDD rpm: 7200
serial: <filter> rev: VN02 temp: 37 C scheme: GPT
SMART: yes state: enabled health: PASSED on: 343d 21h cycles: 1055
read: 53.06 TiB written: 13.07 TiB Pre-Fail: attribute: Spin_Retry_Count
value: 100 worst: 100 threshold: 97
ID-3: /dev/sdb maj-min: 8:16 vendor: Seagate model: ST4000DM000-1F2168
family: Desktop HDD.15 size: 3.64 TiB block-size: physical: 4096 B
logical: 512 B sata: 3.1 speed: 6.0 Gb/s type: HDD rpm: 5900
serial: <filter> rev: CC54 temp: 33 C scheme: GPT
SMART: yes state: enabled health: PASSED on: 2y 254d 19h cycles: 1987
read: 55.85 TiB written: 37.06 TiB Old-Age: UDMA CRC errors: 13567
alert: Bad cable/connection? Pre-Fail: end-to-end: 99 threshold: 99
alert: FAILING_NOW attribute: Spin_Retry_Count value: 100 worst: 100
threshold: 97
Message: No optical or floppy data found.
Partition:
ID-1: / raw-size: 224.58 GiB size: 220.06 GiB (97.99%)
used: 124.26 GiB (56.5%) fs: ext4 block-size: 4096 B dev: /dev/nvme0n1p2
maj-min: 259:2 label: N/A uuid: 9a26c8d0-43f4-44ad-a7d3-861d6f6cdbfa
ID-2: /boot/efi raw-size: 500 MiB size: 499 MiB (99.80%)
used: 312 KiB (0.1%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p3
maj-min: 259:3 label: N/A uuid: D563-DAB7
ID-3: /mnt/5TB raw-size: 4.55 TiB size: 4.51 TiB (99.19%)
used: 2.69 TiB (59.7%) fs: ext4 block-size: 4096 B dev: /dev/sda1
maj-min: 8:1 label: 5TB uuid: 953836d8-e355-4c6d-ac1a-0914b8414f50
Swap:
Kernel: swappiness: 10 (default 60) cache-pressure: 75 (default 100)
ID-1: swap-1 type: partition size: 7.81 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/nvme0n1p1 maj-min: 259:1 label: N/A
uuid: 1b3f894f-5481-4241-ace5-c129a0cdb412
Unmounted:
ID-1: /dev/sdb1 maj-min: 8:17 size: 3.64 TiB fs: ext4 label: 4TB
uuid: c47c5a52-db30-4aef-bcbc-af35b7b021fd
USB:
Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0
speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
Device-1: 1-3:2 info: Corsair CORSAIR K68 RGB Mechanical Gaming Keyboard
type: Keyboard,HID driver: usbfs interfaces: 2 rev: 2.0 speed: 12 Mb/s
power: 500mA chip-ID: 1b1c:1b4f class-ID: 0300 serial: <filter>
Device-2: 1-7:3 info: ROCCAT Kone EMP type: Mouse,Keyboard
driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s
power: 500mA chip-ID: 1e7d:2e24 class-ID: 0300
Device-3: 1-10:4 info: Samsung M267x 287x Series type: Printer
driver: usblp interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 2mA
chip-ID: 04e8:3461 class-ID: 0701 serial: <filter>
Hub-2: 2-0:1 info: Super-speed hub ports: 10 rev: 3.0 speed: 5 Gb/s
chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
System Temperatures: cpu: 27.8 C mobo: 16.8 C
Fan Speeds (RPM): N/A
Info:
Processes: 356 Uptime: 35m wakeups: 0 Init: systemd v: 250 tool: systemctl
Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: 1955 apt: 0 pacman: 1909
lib: 481 flatpak: 46 Shell: Zsh (sudo) v: 5.8 running-in: pty pts/2
inxi: 3.3.11

/etc/environment can only contain variable assignments, no scripting. If you do a pacman -Fx /etc/environment you’ll see that file is owned by the package pam. The particular man page is pam_env.

This assumes bash. What I’ve done for ages is add this line to /etc/bash.bashrc. I think it came from my SuSE days, and I’ve kept using it. When I create a new system I just have to copy this one file over and use sed to add the one line to the end of the system file.

[ -f /etc/bash.bashrc.local ] && source /etc/bash.bashrc.local

And then create /etc/bash.bashrc.local where system-wide changes go. The goal is to make as few changes to installed files as possible. I always backup a file before modifying (add .install), and in many cases there are special directories for user overrides.

Just one more item, here is the arch wiki page for Environment_variables.

2 Likes

Thank you @stargazer!

I’ve removed the if statement part, keeping only the exports, and the error disappeared. So I’ll implement the rest of your suggestion as well.

Edit:

Thanks again @stargazer, just implemented this and it works!

$ cat /etc/environment 
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.