ZSH /etc/zsh/zshrc - function definition file not found

I installed zsh and oh-my-zsh across multiple users, and I saw a post about symlinking /root/.zshrc and /root/.oh-my-zsh with $HOME path variable so all users would have the same config files.

ln -s $HOME/.oh-my-zsh /root/.oh-my-zsh
ln -s $HOME/.zshrc /root/.zshrc

I thought of deleting zsh along with oh-my-zsh for all users and start fresh since I had not configured any of the users .zshrc to the extend I wanted to keep them.

I was a bit hasty with deleting some files, and I think I accidently deleted something that wasn't part of the apt zsh installation. Since I had a lot of errors after installing zsh again on my root user.

Now I have installed zsh as my normal user jonas and I went into root and when I try to su jonas it says /etc/zsh/zshrc:112: compinit: function definition file not found.

I can go into zsh shell, but it has no features. Everything is white, even though I have set up my .zshrc file.

I noticed in my etc/passwd that the jonas user used zsh so I changed it to bash.

Inside the jonas user, it seems like the system knows about zsh but is missing something. I can go into zsh but it just has no features.

however this is a bit confusing

jonas@L480:/etc/zsh$ zsh
/etc/zsh/zshrc:112: compinit: function definition file not found
L480% echo $SHELL
/bin/bash
jonas@L480:/$ zsh
/etc/zsh/zshrc:112: compinit: function definition file not found
L480% pwd
/
L480% bash
jonas@L480:/$ 

I have tried uninstalling with sudo apt-get --purge remove zsh and installing agian with sudo apt install zsh but the issue persists. zsh does have some default functionality like the suggestion navigation.

when zsh as root I get

L480 jonas # zsh
/etc/zsh/zshrc:112: compinit: function definition file not found
/home/jonas/.oh-my-zsh/oh-my-zsh.sh:69: compinit: function definition file not found
/home/jonas/.oh-my-zsh/lib/completion.zsh:76: bashcompinit: function definition file not found
/home/jonas/.oh-my-zsh/lib/directories.zsh:32: command not found: compdef
/home/jonas/.oh-my-zsh/lib/termsupport.zsh:109: add-zsh-hook: function definition file not found
/home/jonas/.oh-my-zsh/lib/termsupport.zsh:110: add-zsh-hook: function definition file not found
/home/jonas/.oh-my-zsh/lib/theme-and-appearance.zsh:2: colors: function definition file not found
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:19: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:89: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:104: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:109: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:119: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:129: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:138: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:144: command not found: compdef
/home/jonas/.oh-my-zsh/plugins/git/git.plugin.zsh:229: is-at-least: function definition file not found

This is my etc/zsh/zshrc file

# /etc/zsh/zshrc: system-wide .zshrc file for zsh(1).
#
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
# Global Order: zshenv, zprofile, zshrc, zlogin
READNULLCMD=${PAGER:-/usr/bin/pager}
export FPATH="/usr/local/share/zsh/functions:$FPATH"
# An array to note missing features to ease diagnosis in case of problems.
typeset -ga debian_missing_features
if [[ -z "${DEBIAN_PREVENT_KEYBOARD_CHANGES-}" ]] && [[ "$TERM" != 'emacs' ]]
then typeset -A key key=( BackSpace "${terminfo[kbs]}" Home "${terminfo[khome]}" End "${terminfo[kend]}" Insert "${terminfo[kich1]}" Delete "${terminfo[kdch1]}" Up "${terminfo[kcuu1]}" Down "${terminfo[kcud1]}" Left "${terminfo[kcub1]}" Right "${terminfo[kcuf1]}" PageUp "${terminfo[kpp]}" PageDown "${terminfo[knp]}" ) function bind2maps () { local i sequence widget local -a maps while [[ "$1" != "--" ]]; do maps+=( "$1" ) shift done shift sequence="${key[$1]}" widget="$2" [[ -z "$sequence" ]] && return 1 for i in "${maps[@]}"; do bindkey -M "$i" "$sequence" "$widget" done } bind2maps emacs -- BackSpace backward-delete-char bind2maps viins -- BackSpace vi-backward-delete-char bind2maps vicmd -- BackSpace vi-backward-char bind2maps emacs -- Home beginning-of-line bind2maps viins vicmd -- Home vi-beginning-of-line bind2maps emacs -- End end-of-line bind2maps viins vicmd -- End vi-end-of-line bind2maps emacs viins -- Insert overwrite-mode bind2maps vicmd -- Insert vi-insert bind2maps emacs -- Delete delete-char bind2maps viins vicmd -- Delete vi-delete-char bind2maps emacs viins vicmd -- Up up-line-or-history bind2maps emacs viins vicmd -- Down down-line-or-history bind2maps emacs -- Left backward-char bind2maps viins vicmd -- Left vi-backward-char bind2maps emacs -- Right forward-char bind2maps viins vicmd -- Right vi-forward-char # Make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then function zle-line-init () { emulate -L zsh printf '%s' ${terminfo[smkx]} } function zle-line-finish () { emulate -L zsh printf '%s' ${terminfo[rmkx]} } zle -N zle-line-init zle -N zle-line-finish else for i in {s,r}mkx; do (( ${+terminfo[$i]} )) || debian_missing_features+=($i) done unset i fi unfunction bind2maps
fi # [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && [[ "$TERM" != 'emacs' ]]
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \ /usr/local/bin \ /usr/sbin \ /usr/bin \ /sbin \ /bin \ /usr/X11R6/bin
(( ${+aliases[run-help]} )) && unalias run-help
autoload -Uz run-help
# If you don't want compinit called here, place the line
# skip_global_compinit=1
# in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofile
if [[ -z "$skip_global_compinit" ]]; then autoload -U compinit compinit
fi
2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like