1

I'm using bash on Ubuntu on Windows since approx 1 year without issues. This week, my Windows 10 got updated automatically and I noticed the day after that all my bash was kind of broken and can't figure out why. Normally, when I was opening it, some commands ran automatically to facilitate my daily tasks. Here's the script content that I added to my bashrc;

# Next lines of command are needed for the "history" command that I added in 
my bash
# so I can get a history of commands that I sent.
export HISTTIMEFORMAT="%d/%m/%y %T "

# Adding ssh-key to my keychain each time the terminal is open 
# Next lines are my variables declarations
datestring="Today is $(date)"
welcomestring="Welcome in your VIDERI-ready shell"
firstactionstring="* Adding ssh-key to your keyring..."
# Begin ssh-key adding script
echo "Setting up shell environment..."
sleep 1
clear
echo "Shell environment has been setup successfully"
sleep 1
clear
printf "%*s" $COLUMNS | tr " " "*"
printf "%*s\n" $(((${#welcomestring}+$COLUMNS) / 2)) "$welcomestring"
printf "%*s" $COLUMNS | tr " " "*"
# wanted to add bold effect to Videri string in the welcome string but dont 
know how to do it within
# a "printf" command
# echo -e "******* Welcome in your \e[1mVideri\e[0m-ready shell ********"
printf "%*s\n" $(((${#datestring}+$COLUMNS) / 2)) "$datestring"
echo ""
echo "$firstactionstring"
./xvx.exp

# Asking for a host each time the terminal is launched
./ask_host.sh

where xvx.exp is:

#!/usr/bin/expect
set timeout 20
set passphrase "**HIDDEN**"
spawn "./keyadding.sh"
expect "Enter passphrase for /mnt/c/HIDDEN/HIDDEN_id_rsa:"
send "$passphrase\r";
interact

and keyadding.sh:

#!/bin/bash
ssh-add /mnt/c/HIDDEN/HIDDEN_id_rsa
exit 0

So when I opened my terminal the day after the Win 10 update, I get;

 * keychain 2.8.1 ~ http://www.funtoo.org
 * Starting ssh-agent...
 * Warning: can't find id_rsa; skipping

jpbegin@JPB-LENOVO:~$

Which I find pretty strange cause theres no command in my bashrc to awake the agent.

So the day after I noticed the issue I had the idea to try updating the "system" in case it's a bug from keychain but I always get following errors when trying to use apt-get upgrade/update;

jpbegin@JPB-LENOVO:~$ sudo apt-get upgrade
[sudo] password for jpbegin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
curl distro-info-data libcurl3-gnutls libgnutls-openssl27 libgnutls30 
libicu55 libmysqlclient20 libpam-systemd libsystemd0 libudev1 mysql-common 
systemd
systemd-sysv udev wget
15 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,163 kB/14.8 MB of archives.
After this operation, 44.0 kB disk space will be freed.
Do you want to continue? [Y/n] y
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd-
sysv amd64 229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpam-
systemd amd64 229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libsystemd0 
amd64 229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
Err:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd 
amd64 229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
Err:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 udev amd64 
229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
Err:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libudev1 
amd64 229-4ubuntu20
404  Not Found [IP: 91.189.88.162 80]
E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd-sysv_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libpam-systemd_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libsystemd0_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/udev_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libudev1_229-
4ubuntu20_amd64.deb 404  Not Found [IP: 91.189.88.162 80]

E: Unable to fetch some archives, try running apt-get update or apt-get --
fix-missing.
jpbegin@JPB-LENOVO:~$

The day I noticed the issue, I had to run Ubuntu on a VM to redo partitioning of a "Linux SD card". At the SAME TIME, I opened the bash on Ubuntu and then I noticed the issue. Unfortunately, I'm not skilled enough to establish if it's related or not.


Edit from Answer Reply:

@derHugo heres the sources:

jpbegin@JPB-LENOVO:~$ cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe 
multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted 
universe multiverse
deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted 
universe multiverse
deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial 
stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu 
xenial stable

Now it's working (apt-get) so I guess they had issues with their servers

@user68186 I downloaded it from the Windows store after having see your comment but it seems to be another shell. The one that I'm using came from this procedure; https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/ but thats good, I mean I can use the one from the Windows store and redo all my setup. Was just curious to understand what happened since it may help a lot my comprehension.


UPDATE 2017-11-06 @ 14:34 EST: So I been able to get "apt-get" commands working again without any actions. But I noticed that whatever terminal (first Ubuntu on Windows terminal that I installed, the second one from the Windows store and Cygwin) I use now, I can't get eval ssh-agent to work. I always get errors like:

Cygwin:

AzureAD+Jean-PhilippeBegin@JPB-LENOVO ~
$ eval ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-uQWXAWbVAif4/agent.16828; export SSH_AUTH_SOCK;
SSH_AGENT_PID=19756; export SSH_AGENT_PID;
echo Agent pid 19756;

Ubuntu on Windows (from the windows store)

jpbegin@JPB-LENOVO:~$ eval ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-BWICekqIcWkE/agent.16; export SSH_AUTH_SOCK;
SSH_AGENT_PID=17; export SSH_AGENT_PID;
echo Agent pid 17;

I also noticed that each time I run eval ssh-agent, I'll see an instance running in the Windows Task manager. I doubt this is normal but correct me if I'm wrong.

UPDATE 2017-11-06 @ 14:52 EST: I also noticed that there's no id_rsa file anymore on my .ssh folder but can't figure out why.

When I tried to use ssh-add /path/of/key/key I was always getting Could not open a connection to your authentication agent. Solution was here: https://stackoverflow.com/a/17695338 but it seems like the whole agent is still not behaving like it was before.

  • Do you have internet connection in the bash shell? And please add your /etc/apt/sources.list to your question – derHugo Nov 3 '17 at 16:06
  • The ssh-agent is started in your keyadding.sh when you do ssh-add – derHugo Nov 3 '17 at 16:10
  • If you have been using the beta version of WSL. After Windows Fall Creator's fall update WSL you have to install WSL again from Windows Store. blogs.msdn.microsoft.com/commandline/2017/10/11/… – user68186 Nov 3 '17 at 16:12
  • @derHugo yes I do, I think the apt-get commands were not working because of some issues on the sources servers cause it happened to work later on and you're right about the agent starting... – Jean-Philippe Bégin Nov 3 '17 at 16:43
  • Run sudo apt update to fix APT, and check that ~/.ssh/id_rsa exists. It doesn't look like it does. – Kaz Wolfe Nov 6 '17 at 19:44

Your Answer

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

Browse other questions tagged or ask your own question.