July 22, 2017

[SOLVED]Synology: "You have exceeded your emergency code limit. Please contact your system administrator"


Got stuck with "You have exceeded your emergency code limit. Please contact your system administrator" on your synology?

Me too.. ..my mobile phone wend dead taking the Google Authenticator app with it and my trusty Synology DS411+II don't wont let me to log in without 2-auth.

This blogpost suggested to add your own reset codes to google_authenticator file - it didn't work for me :(

Here is my solution - I renamed the file.

Login with your admin account via ssh.
and rename (remove) the google_authenticator file

cd /usr/syno/etc/preference/<username>/
mv google_authenticator google_authenticator_backup

and logged me with my account via web interface and got this shiny 2-auth configuration dialog.




May 2, 2017

Open canvas content as data url

Select

document.location = $0.toDataURL()

[SOLVED]Fatal error: Call to a member function setSaveParametersInSession() on a non-object

If you get "Fatal error: Call to a member function setSaveParametersInSession() on a non-object"


check if your config.xml is properly formatted and class names are between XML tags without new lines

Wrong:
<blocks>
    <some_widgets>
        <rewrite>
            <adminhtml_some_info>ClassName
            </adminhtml_some_info>
    </some_widgets>
</blocks>


OK:
<blocks>
    <some_widgets>
        <rewrite>
            <adminhtml_some_info>ClassName</adminhtml_some_info>
    </some_widgets>
</blocks>

April 6, 2017

[SOLVED] Wrong resolution on second display



If you don't see required resolution

xrandr


#add new mode
xrandr --addmode VGA-1 "1920x1080"

#activate mode via xrandr
xrandr --output VGA-1 --mode  "1920x1080"

Source: http://www.martinaulbach.net/linux/command-line-magic/59-setting-higher-screen-resolution-for-external-monitor-in-ubuntu-14-10

February 18, 2017

[SOLVED]Error response status: 6 Selenium error: no such session (Chrome selenium tests on gitlab runner)

Selenium tests with chrome on gitlab gave me this error "Error response status: 6 Selenium error: no such session". I order to fix it

Install virtual display
apt-get install -qq -y xvfb

#try to fool google-chrome to run without sandbox
mv /usr/bin/google-chrome /usr/bin/google-chrome-orig \
    && echo '#!/bin/bash' > /usr/bin/google-chrome \
    && echo '/usr/bin/google-chrome-orig --no-sandbox --disable-setuid-sandbox --allow-sandbox-debugging "$@"' >> /usr/bin/google-chrome  \
    && chmod +x /usr/bin/google-chrome

Before starting your test start virtual display
Xvfb :0 -ac +extension RANDR -screen 0 1366x768x24 &

than run your test in
xvfb-run polymer test -l chrome

Make your own or use my docker image
https://hub.docker.com/r/printminion/polymer-tester/

Example dockerfile: https://github.com/printminion/polymer-tester/blob/master/Dockerfile


Error:
(node:4444) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Installing and starting Selenium server for local browsers
Selenium server running on port 38917
Web server running on port 2000 and serving from /builds/printminion-group/canvas-editor-base
chrome 56                Tests failed: {"message":"[get(\"http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0\")] Error response status: 6 Selenium error: no such session\n  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 38 milliseconds\nBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'\nSystem i...
Test run ended in failure: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

chrome 56 (error)                    

Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

error:   cli runtime exception: Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
error:   Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
    at /usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:151:27
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:103:7)
ERROR: Build failed: exit code 1

January 10, 2017

[SOLVED]Docker API connection refused 127.0.0.1:2376

Create a file called /etc/systemd/system/docker-tcp.socket to make Docker available on a TCP socket on port 2375.

[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service

[Install]
WantedBy=sockets.target


Then enable this new socket:

systemctl enable docker-tcp.socket
systemctl stop docker
systemctl start docker-tcp.socket
systemctl start docker
Test that it's working:

docker -H tcp://127.0.0.1:2375 ps


Source: https://coreos.com/os/docs/latest/customizing-docker.html

August 1, 2016

[SOLVED] Create copy of Raspberry PI SD-Card


sudo fdisk -l

Take note of how the SD card is identified.
In my case it is /dev/sdb1.
Then:
sudo dd bs=4M if=/dev/sdb | gzip > /home/your_username/image`date +%d%m%y`.gz

This will compress the image using gzip.
To restore the backup on SD card:
sudo gzip -dc /home/your_username/image.gz | sudo dd bs=4M of=/dev/sdb

June 3, 2016

[SOLVED]Renew ssl letsencrypt certificate on bitnami server

#!/bin/bash
#renew ssl letsencrypt certificate on bitnami server
#https://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802/edit

sudo /opt/bitnami/ctlscript.sh stop apache
cd /home/user/certbot
#./certbot-auto certonly --standalone -w /opt/bitnami/apache2/conf/ -d example
.com -d www.example.com
./certbot-auto renew
sudo cp /etc/letsencrypt/live/example.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
sudo cp /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key
sudo /opt/bitnami/ctlscript.sh start apache


Gisthttps://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802