I have a wagrant provisioning script that tries to install Zsh if it is not available, and then change the shell to use Zsh.
There are two questions that I think I have:
Firstly, I do not believe that the shell will change to Zsh, because when I start vagrant sshto access Ubuntu VM, and after starting the ps -p $$command indicates that Bash is the shell that is running (where I would expect Zsh).
The second problem is that if it changes to the Zsh shell (regardless of what ps -p $$reports it returns), then Zsh displays a lot of errors when I run the .zshrc file, which assumes that the specified functions are missing or simply not referencing correctly.
I will break it into steps by performing a Zsh installation manually, and not through setting up a Vagrant script ...
cat /etc/shells β I do not see links to Zsh β sudo apt-get updatesudo apt-get install zsh β cat /etc/shellsβ now have /bin/zshand/usr/bin/zshwhich zsh β /usr/bin/zshzsh --version β zsh 5.0.2 (x86_64-pc-linux-gnu)chsh -s $(which zsh)source .zshrc β Lots of errors sent to stdout ~~tree /usr/share/zsh/β see below ** for output, but the notification is functionnot inside the directory 5.0.2?
I think it is more likely that Zsh does not change, because if I execute the command zsh, I get into a new shell environment, and if I run source .zshrc, I will not get errors. Also, if I run ps -p $$, now I will see that Zsh is reported as a running shell.
At the end of this question, you can find all my settings for a stroller script.
β The list of shells that I see is:
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
β output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
zsh-common
Suggested packages:
zsh-doc
The following NEW packages will be installed:
zsh zsh-common
0 upgraded, 2 newly installed, 0 to remove and 55 not upgraded.
Need to get 2,726 kB of archives.
After this operation, 11.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main zsh-common all 5.0.2-3ubuntu6 [2,119 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main zsh amd64 5.0.2-3ubuntu6 [607 kB]
Fetched 2,726 kB in 6s (420 kB/s)
Selecting previously unselected package zsh-common.
(Reading database ... 61742 files and directories currently installed.)
Preparing to unpack .../zsh-common_5.0.2-3ubuntu6_all.deb ...
Unpacking zsh-common (5.0.2-3ubuntu6) ...
Selecting previously unselected package zsh.
Preparing to unpack .../zsh_5.0.2-3ubuntu6_amd64.deb ...
Unpacking zsh (5.0.2-3ubuntu6) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up zsh-common (5.0.2-3ubuntu6) ...
Setting up zsh (5.0.2-3ubuntu6) ...
update-alternatives: using /bin/zsh5 to provide /bin/zsh (zsh) in auto mode
update-alternatives: using /bin/zsh5 to provide /bin/rzsh (rzsh) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/rzsh.1.gz because associated file /usr/share/man/man1/zsh.1.gz (of link group rzsh) doesn't exist
~~ , Zsh https://github.com/Integralist/dotfiles/blob/linux/.zshrc
autoload: command not found
zmodload: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'style' from package 'diction' (universe)
Command 'astyle' from package 'astyle' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
No command 'zstyle' found, did you mean:
Command 'astyle' from package 'astyle' (universe)
Command 'style' from package 'diction' (universe)
zstyle: command not found
bindkey: command not found
bindkey: command not found
bindkey: command not found
bindkey: command not found
bindkey: command not found
bindkey: command not found
bindkey: command not found
autoload: command not found
No command 'colors' found, did you mean:
Command 'xcolors' from package 'xcolors' (universe)
colors: command not found
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_no_bold[${(L)COLOR}]%}: bad substitution
-bash: %{$fg_bold[${(L)COLOR}]%}: bad substitution
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
unsetopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
No command 'setopt' found, did you mean:
Command 'getopt' from package 'util-linux' (main)
setopt: command not found
autoload: command not found
** tree /usr/share/zsh:
/usr/share/zsh/
βββ 5.0.2
β βββ scripts
β βββ newuser
βββ functions
β βββ Calendar
β β βββ ...
β βββ Calendar.zwc
β βββ Chpwd
β β βββ ...
β βββ Chpwd.zwc
β βββ Completion
β β βββ AIX
β β β βββ ...
β β βββ AIX.zwc
β β βββ Base
β β β βββ ...
β β βββ Base.zwc
β β βββ bashcompinit
β β βββ BSD
β β β βββ ...
β β βββ BSD.zwc
β β βββ compaudit
β β βββ compdump
β β βββ compinit
β β βββ compinstall
β β βββ Cygwin
β β β βββ ...
β β βββ Cygwin.zwc
β β βββ Darwin
β β β βββ ...
β β βββ Darwin.zwc
β β βββ Debian
β β β βββ ...
β β βββ Debian.zwc
β β βββ Linux
β β β βββ ...
β β βββ Linux.zwc
β β βββ Mandriva
β β β βββ _rebootin
β β β βββ _urpmi
β β βββ Mandriva.zwc
β β βββ openSUSE
β β β βββ ...
β β βββ openSUSE.zwc
β β βββ Redhat
β β β βββ ...
β β βββ Redhat.zwc
β β βββ Solaris
β β β βββ ...
β β βββ Solaris.zwc
β β βββ Unix
β β β βββ ...
β β βββ Unix.zwc
β β βββ X
β β β βββ ...
β β βββ X.zwc
β β βββ Zsh
β β β βββ ...
β β βββ Zsh.zwc
β βββ Completion.zwc
β βββ Exceptions
β β βββ catch
β β βββ throw
β βββ Exceptions.zwc
β βββ MIME
β β βββ ...
β βββ MIME.zwc
β βββ Misc
β β βββ ...
β βββ Misc.zwc
β βββ Newuser
β β βββ zsh-newuser-install
β βββ Newuser.zwc
β βββ Prompts
β β βββ ...
β βββ Prompts.zwc
β βββ TCP
β β βββ ...
β βββ TCP.zwc
β βββ VCS_Info
β β βββ ...
β βββ VCS_Info.zwc
β βββ Zftp
β β βββ ...
β βββ Zftp.zwc
β βββ Zle
β β βββ ...
β βββ Zle.zwc
βββ help
script
add-apt-repository ppa:pi-rho/dev
apt-get update
apt-get remove vim-tiny -y
apt-get install vim tmux git tree htop reptyr xclip -y
if ! cat /etc/shells | grep zsh; then
echo "Zsh is not available, so we'll install it now"
apt-get install zsh -y
fi
sed -i 's/kernel.yama.ptrace_scope = 1/kernel.yama.ptrace_scope = 0/' /etc/sysctl.d/10-ptrace.conf
sysctl -p /etc/sysctl.d/10-ptrace.conf
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
dotfiles_location=/home/vagrant/dotfiles
git clone https://github.com/Integralist/dotfiles.git $dotfiles_location
cd $dotfiles_location && git fetch && git checkout linux
shopt -s extglob
mv !(.|..|.git|README.md) ..
cd ../ && rm -rf dotfiles
chsh -s $(which zsh)
source .zshrc