[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: systemd-fsck?



On Wed, May 14, 2014 at 7:22 PM, Russ Allbery <rra@debian.org> wrote:
> Roger Lynn <Roger@rilynn.me.uk> writes:
>> On 13/05/14 20:30, Salvo Tomaselli wrote:
>>> In data martedì 13 maggio 2014 19:42:32, David Goodenough ha scritto:
>
>>>>> service foo <action> works across Linux distributions, with or without
>>>>> systemd, and does the right thing.
>
>>>> The big shame with service is that tab completion does not work properly.
>>>> If I use /etc/init.d/ then tab tells me what is there and spells it right.
>
>>> You should install bash-completion
>
>> Bash-completion has never worked for me from a root prompt.
>
> bash-completion is loaded from /etc/profile, which is only sourced by bash
> for a login shell.  I suspect that you're using su, which does not create
> a login shell.  In that case, only /etc/bash.bashrc is sourced, and its
> code to load bash-completion for interactive shells is commented out.  (I
> don't know why.)
>
> I just confirmed that bash-completion works properly with service as root
> if you run . /etc/profile.d/bash_completion.sh first.
>

It's not loaded from /etc/profile by default (which would probably
throw errors with other shells since all login shells source
/etc/profile). The default /etc/skel/.bashrc contains the following:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi


That is why it works for user accounts but not for root by default. As
the comment suggests you can uncomment the same code block in
/etc/bash.bashrc. It would be nice if the default /root/.bashrc
contained the same snippet. I am not sure how the initial
/root/.bashrc gets put in place or where root's default lives. I
assume it is done by d-i?

Regards,
Jordan Metzmeier


Reply to: