Saturday, 28 October 2017

Installed by Enterprise Policy chrome extensions

Chrome may have extensions installed by Enterprise Group Policy.
Windows Group policy scripts are installed here:

"%WinDir%\System32\GroupPolicyUsers"
"%WinDir%\System32\GroupPolicy"

Removing these directories will remove the group policy.
Run gpupdate /force to update the machine.

Sunday, 8 October 2017

Raspberry Pi help

Upgrading to Raspbian Stretch (Debian v9)
https://www.raspberrypi.org/blog/raspbian-stretch/

Resizing the SD card
https://dracoy.com/2016/06/26/expanding-partition-on-sd-card-for-raspberry-pi-with-noobs-pre-installed/

Determine Linux distro & version

lsb_release -a

Saturday, 7 October 2017

Raspberry PI zero loses connection to the network

My Raspberry PI zero was losing connection to the WIFI network. It was configured with a fixed IP.
daemon.log would show the following errors:

Oct  6 01:04:10 pi-pvmonitor wpa_supplicant[439]: wlan0: Associated with 00:01:02:03:04:05
Oct  6 01:04:10 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=GB
Oct  6 01:04:13 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:01:02:03:04:05 reason=0 locally_generated=1
Oct  6 01:04:13 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Oct  6 01:04:13 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=GB
Oct  6 01:04:13 pi-pvmonitor wpa_supplicant[439]: wlan0: Trying to associate with 00:01:02:03:04:05 (SSID='HomeWifi' freq=2462 MHz)
Oct  6 01:04:13 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-ASSOC-REJECT status_code=16
Oct  6 01:04:15 pi-pvmonitor wpa_supplicant[439]: wlan0: Trying to associate with 00:01:02:03:04:10 (SSID='HomeWifi' freq=2412 MHz)
Oct  6 01:04:21 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-ASSOC-REJECT status_code=16
Oct  6 01:04:21 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="HomeWifi" auth_failures=1 duration=10 reason=CONN_FAILED
Oct  6 01:04:31 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="HomeWifi"
Oct  6 01:04:31 pi-pvmonitor wpa_supplicant[439]: wlan0: Trying to associate with 00:01:02:03:04:10 (SSID='HomeWifi' freq=2462 MHz)
Oct  6 01:04:41 pi-pvmonitor wpa_supplicant[439]: wlan0: Authentication with 00:01:02:03:04:10 timed out.
Oct  6 01:04:41 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:01:02:03:04:10 reason=3 locally_generated=1
Oct  6 01:04:41 pi-pvmonitor wpa_supplicant[439]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="HomeWifi" auth_failures=2 duration=20 reason=CONN_FAILED
Oct  6 13:57:54 pi-pvmonitor systemd[1]: Starting Cleanup of Temporary Directories...
Oct  6 13:57:54 pi-pvmonitor systemd[1]: Started Cleanup of Temporary Directories.
Oct  7 11:15:34 pi-pvmonitor systemd-udevd[5270]: failed to execute '/lib/udev/mtp-probe' 'mtp-probe /sys/devices/platform/soc/20980000.usb/usb1/1-1 1 2': No such file or directory

There are two Wifi routers with the same SSID on different frequencies and you can see it trying to authenticate with both.

What is interesting is that after the wlan is disabled, no other activity occurs, it is as if the wifi adapter is powered down.

sudo iwconfig wlan0 showed that power management was on:

wlan0     IEEE 802.11bgn  ESSID:"HomeWifi"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:01:02:03:04:05
          Bit Rate=39 Mb/s   Tx-Power=31 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
          Link Quality=44/70  Signal level=-66 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:11  Invalid misc:0   Missed beacon:0


When the problem occurs it appears the wlan is disconnected and no further attempts are made to reconnect:

Oct  8 11:45:19 pi-pvmonitor wpa_supplicant[432]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Oct  8 11:45:19 pi-pvmonitor wpa_supplicant[432]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="HomeWifi" auth_failures=3 duratio$
Oct  8 11:45:19 pi-pvmonitor wpa_supplicant[432]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="HomeWifi" auth_failures=4 duratio$
Oct  8 11:45:19 pi-pvmonitor wpa_supplicant[432]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD

There are a variety of ways of fixing this problem. I shall describe each in turn:

1. Check the network is responding and restart if required.


2. [This doesn't solve the problem] Turn off power management in the /etc/network/interfaces configuration.

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    wireless-power off                                     # Stop the Wifi from powering down

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


Note: this still didn't fix the problem. After a few hours I had a problem.

3. This article shows how to configure the Pi to turn off Wifi power management at startup using systemd.

4. Reboot the Pi nightly.
The following was added to root's cron job (using sudo crontab -u root -e)

0 23 * * * /home/pi/scripts/restart-pi.sh > /dev/null

5. Restart the network nightly by running the following script using crontab.
ifconfig wlan0 down && ifconfig wlan0 up

Tuesday, 3 October 2017

Adding a shortcut to the Windows 10 start menu

Open the folder and add the shortcut:

%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs