Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install trying to pull old file version? #15

Open
Turnwise opened this issue Mar 6, 2019 · 13 comments
Open

Install trying to pull old file version? #15

Turnwise opened this issue Mar 6, 2019 · 13 comments

Comments

@Turnwise
Copy link

Turnwise commented Mar 6, 2019

Using the command curl -sSL https://pisupp.ly/piswitchcode | sudo bash the install appears to be trying to get the older version of the piswitch code - deb9u2, when the most recent is d53ff4c I think?

The error is: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/g/git/git_2.11.0-3+deb9u2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]

@francesco-vannini
Copy link
Contributor

Hi @Turnwise , AFAICT the install script uses

git clone https://github.com/PiSupply/Pi-Supply-Switch.git

and the URL https://pisupp.ly/piswitchcode retrives the right version of install.

Could you use a browser and verify that the version of install on the master branch is the same you get?

Even just by running curl -sSL https://pisupp.ly/piswitchcode

you should get:

#!/usr/bin/env bash

#Check if script is being run as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi

if [ ! $? = 0 ]; then
exit 1
else
apt-get install -y git whiptail #Installs packages which might be missing

PiSupplySwitchDir="Pi-Supply-Switch"
if [ -d "$PiSupplySwitchDir" ]; then
whiptail --title "Installation aborted" --msgbox "$PiSupplySwitchDir already exists, please remove it and restart the installation" 8 78
exit
else
git clone https://github.com/PiSupply/Pi-Supply-Switch.git
fi

mkdir /opt/piswitch

cp $PiSupplySwitchDir/softshut.py /opt/piswitch
if [ ! -f /opt/piswitch/softshut.py ]; then
whiptail --title "Installation aborted" --msgbox "There was a problem writing the softshut.py file" 8 78
exit
fi
cp $PiSupplySwitchDir/piswitch.service /etc/systemd/system
if [ ! -f /etc/systemd/system/piswitch.service ]; then
whiptail --title "Installation aborted" --msgbox "There was a problem writing the piswitch.service file" 8 78
exit
fi

systemctl enable /etc/systemd/system/piswitch.service
whiptail --title "Installation complete" --msgbox "Pi Switch installation complete. The system will power off." 8 78
poweroff
fi

@shawaj
Copy link
Member

shawaj commented Mar 8, 2019

The mirror director URL is something to do with the pi repos.

Perhaps try sudo apt-get update and sudo apt-get upgrade too

@Turnwise
Copy link
Author

Turnwise commented Mar 9, 2019

Thanks both :)

I'm a bit of a beginner with Pi, and bash scripts etc, so bare with me please - in my day job I'm a PL-SQL developer, but we have a whole department to deal this the more tech side of setting stuff up, etc...

francesco-vannini - Yes, I tried that and compared the install script that took me to against the code I can see just clicking on the install.sh code.

All seems good until the script reaches the clone bit, then it can't find the version it's looking for - hence the 404 Not Found at that point? Thanks :)

shawaj - "The mirror director URL is something to do with the pi repos" - that sounds possible - I will try your suggestions - I did think the whiptail bit probably did that, but not sure... I'll come back on this when I get chance to try it, Thanks :)

For anyone interested - or who cares, here's the putty messages from running curl -sSL https://pisupp.ly/piswitchcode | sudo bash

pi@raspberrypi:~ $ curl -sSL https://pisupp.ly/piswitchcode | sudo bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
whiptail is already the newest version (0.52.19-1).
Suggested packages:
git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-arch git-cvs git-mediawiki git-svn
The following packages will be upgraded:
git
1 upgraded, 0 newly installed, 0 to remove and 119 not upgraded.
Need to get 3,380 kB of archives.
After this operation, 0 B of additional disk space will be used.
Err:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf git armhf 1:2.11.0-3+deb9u2
404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/g/git/git_2.11.0-3+deb9u2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Cloning into 'Pi-Supply-Switch'...
cp: cannot stat 'Pi-Supply-Switch/softshut.py': No such file or directory
pi@raspberrypi:~ $

@tvoverbeek
Copy link
Contributor

The apt-get install -y git whiptail command at the beginning of the install script fails.
Probably because your /etc/apt/sources.list is out of date. mirrordirector.raspbian.org is not used any more.
Try to replace /etc/apt/sources.list with the following:

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

You need to edit /etc/apt/sources.list as root (using sudo).
Then run sudo apt-get update and sudo apt-get dist-upgrade to be sure you are up-to-date.
Then try the install again.

@francesco-vannini
Copy link
Contributor

Out of curiosity @Turnwise how did you download your Raspbian version? is this a new installation or you are adding the Pi Supply Switch to an existing project which you had been sitting there for a while?

@Turnwise
Copy link
Author

Not sure exact date - but probably around a year or so ago - the on/off switch is to attach to my Pi that is running BrewPi for me (to control temperature in a fermentation cupboard). When it's running, it's out in my shed, only connected to an arduino board that's controlling a relay board - but no screen, or keyboard connected - and I've never managed to connect to the Pi remotely to shut it down gracefully, and 9 times out of 10 it corrupts if I just switch it off, which isn't a disaster as I have a saved image I just drop back on the SD card and off we go again, but it is a bit of a pain, especially as we are out in the sticks and power cuts are more frequent than I'd like, and although usually intermittent, also tend to mean a re-install of the image....

@francesco-vannini
Copy link
Contributor

@Turnwise I'd follow @tvoverbeek advice and update the OS one way or another. Good luck and let us know how that goes.

@Turnwise
Copy link
Author

Thanks all :)

I've followed @tvoverbeek 's advice :)

I edited the sources list by navigating to it on Putty using the cd command and then edited using vi :
sudo vi sources.list
x to delete characters, i to insert - hit esc once finished inserting
the :wq to exit and save

I then ran the two updates recommended - both did a lot of work! However the dist-upgrade hit an error towards the end :

Preparing to unpack .../libapt-pkg5.0_1.4.9_armhf.deb ...
Unpacking libapt-pkg5.0:armhf (1.4.9) over (1.4.7) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libapt-pkg5.0_1.4.9_armhf.deb (--unpack):
cannot copy extracted data for './usr/lib/arm-linux-gnueabihf/libapt-pkg.so.5.0.1' to '/usr/lib/arm-linux-gnueabihf/libapt-pkg.so.5.0.1.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
/var/cache/apt/archives/libapt-pkg5.0_1.4.9_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I ran the get update script again - it found nothing new to do, and then the upgrade again, but I got the same 'compressed data is corrupt'

The curl -sSL https://pisupp.ly/piswitchcode | sudo bash now appears to do nothing at all, the cursor just moves to a new line and no action appears to be taken.

Stepping through the individual items in the install script and running individually using sudo, I get as far as cp $PiSupplySwitchDir/softshut.py /opt/piswitch - and there I encounter : cp: cannot stat 'Pi-Supply-Switch/softshut.py': No such file or directory

My Mrs has run out of patience waiting for me to finish mucking about with this tonight, so I'm gonna shut it down and come back to it another night!!

Thanks all for your continued patience and support!!!

@tvoverbeek
Copy link
Contributor

@Turnwise Smells like you SD card is full, so adding anything new fails.
What does df -h say? Should show the space available on the different file systems.
I suspect / is full.

@Turnwise
Copy link
Author

Slightly over half full??

Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 5.4G 22G 20% /
devtmpfs 458M 0 458M 0% /dev
tmpfs 462M 0 462M 0% /dev/shm
tmpfs 462M 12M 450M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 462M 0 462M 0% /sys/fs/cgroup
/dev/mmcblk0p6 68M 21M 47M 31% /boot
tmpfs 93M 0 93M 0% /run/user/1000

@tvoverbeek
Copy link
Contributor

Ok, sd card is obviously not full. I seems you have installed Raspbian using NOOBS.
I guess somehow your os installation is messed up.
The only thing I can suggest is to start from scratch and install Raspbian directly using one of the images on the downloads page: https://www.raspberrypi.org/downloads/raspbian/
and then after the initial update/upgrade install the piswitch code.

@Turnwise
Copy link
Author

I've ordered a new SD, and have downloaded the Raspbian Stretch with desktop, without NOOBS. I'll then see how that works! I'll be a week or so - the Pi was needed back for the BrewPi and is running with the old, but working image that has the BrewPi code and settings, but not the new switch.... fingers crossed there's no power cuts!

@tvoverbeek
Copy link
Contributor

@Turnwise Let us know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants