Dietpi: Mate terminal don't accpet dietpi commands

Created on 15 May 2018  ·  9Comments  ·  Source: MichaIng/DietPi

Required Information:

  • DietPi Version : 6.8
  • Distro: Linux JAS-TT 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux

Additional Information (if applicable):

  • MATE
  • yes

Expected behaviour:

on type dietpi-config it should open config dialog

Actual behaviour:

terminal says that such command doesn't exist

Did you submit a dietpi-bugreport?

7ce78761-7953-4b7e-9b69-16c360a93cb7-0

Most helpful comment

@Fourdee @Gokujo
The desktop terminal emulators seem to not use /etc/profile(.d/*) in every case... They seem to not count as "login shells"?

Just checked and could replicate on Mate desktop:

# echo $SHELL
/bin/bash
# dietpi-config
bash: dietpi-config: command not found

Manually sourcing globals works.
source /DietPi/dietpi/func/dietpi-globals

€: In the Mate terminal settings it can be chosen to start it as login shell. Afterwards DietPi banner and globals are executed. So far I could not yet find the related settings file or place where we can pre-configure this. It's also possibly not the best solution: https://unix.stackexchange.com/questions/35320/run-xterm-with-login-shell-or-not

To enable login shell for XTerm, the following works:

root@DietPi:~# cat /etc/X11/Xresources/dietpi-loginshell
xterm*loginShell: true

Ref:

All 9 comments

@Gokujo

Thanks for the report 👍

I don't believe Mate terminal (and LXterm if I remember correctly) load .bashrc and/or /etc/profile.d/99-dietpi-login.sh. This may be a limitation with the program (or login method) itself, however, we'll flag for investigations.

REF: https://askubuntu.com/questions/566399/why-isnt-profile-sourced-when-opening-a-terminal
https://superuser.com/questions/251933/profile-is-not-sourced-on-startup

Interesting: https://github.com/Fourdee/DietPi/issues/1776
LXterm, seems to be running under sh by default, not bash?

# . /DietPi/dietpi/func/dietpi-globals
sh: 146: /DietPi/dietpi/func/dietpi-globals: Syntax error: Bad function name
 bash -c '. /DietPi/dietpi/func/dietpi-globals'
# dietpi-config
sh: 5: dietpi-config: not found
# bash
bash: /etc/profile.d/99-dietpi-login.sh: Permission denied

root@DietPi:/# whoami
root
root@DietPi:/# exit
exit
# whoami
root

###################

# bash
bash: /etc/profile.d/99-dietpi-login.sh: Permission denied

root@DietPi:/# /etc/profile.d/99-dietpi-login.sh
bash: /etc/profile.d/99-dietpi-login.sh: Permission denied

root@DietPi:/# . /DietPi/dietpi/func/dietpi-globals 
root@DietPi:~# dietpi-
dietpi-autostart      dietpi-drive_manager  dietpi-process_tool
dietpi-backup         dietpi-justboom       dietpi-services
dietpi-bugreport      dietpi-launcher       dietpi-software
dietpi-cleaner        dietpi-letsencrypt    dietpi-sync
dietpi-config         dietpi-logclear       dietpi-update
dietpi-cron           dietpi-morsecode      

@Fourdee
it says: bash: dietpi-config: Kommando nicht gefunden (command not found)

@Fourdee @Gokujo
The desktop terminal emulators seem to not use /etc/profile(.d/*) in every case... They seem to not count as "login shells"?

Just checked and could replicate on Mate desktop:

# echo $SHELL
/bin/bash
# dietpi-config
bash: dietpi-config: command not found

Manually sourcing globals works.
source /DietPi/dietpi/func/dietpi-globals

€: In the Mate terminal settings it can be chosen to start it as login shell. Afterwards DietPi banner and globals are executed. So far I could not yet find the related settings file or place where we can pre-configure this. It's also possibly not the best solution: https://unix.stackexchange.com/questions/35320/run-xterm-with-login-shell-or-not

To enable login shell for XTerm, the following works:

root@DietPi:~# cat /etc/X11/Xresources/dietpi-loginshell
xterm*loginShell: true

Ref:

@MichaIng

root@DietPi:~# cat /etc/X11/Xresources/dietpi-loginshell
xterm*loginShell: true

Couldn't get this to work with LXterm or Xterm on LXDE install, had no effect.

The only "solution" I found was to put everything back into .bashrc, then simply run bash in any of the desktop terminals. although, users can run the dietpi-launcher shortcuts from desktop to get right in there. Maybe we could have a shortcut that launches bash with .bashrc exec.

using .bashrc also fixes: https://github.com/Fourdee/DietPi/issues/1776

@MichaIng

I'll send a commit that reverts back to .bashrc, I cant see any other viable way to pull this off?
Commit sent, should be resolved with: https://github.com/Fourdee/DietPi/commit/6d20b08be0b43ee9ff4a17136ebdb4520e711352

[Desktop Entry]
Version=1.0
Name=DietPi-Terminal
Type=Application
Comment=Launches a terminal with DietPi login and global variable support
Terminal=true
Exec=bash
Icon=/var/lib/dietpi/dietpi-software/installed/desktop_icons/dietpi-icon.png
Categories=ConsoleOnly;System;
GenericName=DietPi-Terminal

Resolved for v6.9, using the new application dietpi-terminal (on desktop), which starts a bash login session with DietPi login and global variable support.

@Fourdee
I am not too happy with ~/.bashrc. Then better use /etc/bash.bashrc to enable for all users and which blocks non-interactive shells. ~/.bashrc is called by non-interactive shells as well, if I remember right, I once uncommented the cp/mv/rm security question replacements inside and suddenly found our scripts hanging on their cp/mv/rm. Although, was separately sourcing globals non needed then 🤔. Ah will do some tests tomorrow with the aim to find a final solution to fulfil all needs in this.

As /etc/bashrc.d is indeed used here and there, manually implemented and sometimes officially into distro as well, perhaps it's not the worst idea to enable this as well. This would also allow us to divide our login/globals scripts into login (just needed once every user session) and non-login (that we want to be executed within every interactive shell again). If this enhances then "accidentally" bash-completion as well, even better 😄.

But separate topic about this, will try to make all this shell topic a bid clear then, for myself as well 😉.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fourdee picture Fourdee  ·  3Comments

MichaIng picture MichaIng  ·  3Comments

Fourdee picture Fourdee  ·  3Comments

Invictaz picture Invictaz  ·  3Comments

Fourdee picture Fourdee  ·  3Comments