Skip to content

Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")

If it still fails after you've set "root_url" to the correct value in grafana.ini, you might want to check whether you can run phantomjs from the command line.

If you get "QXcbConnection: Could not connect to display / PhantomJS has crashed", then the explanation is here: Debian Bug #817277.

To fix it, I installed xvfb (apt-get install xvfb), and edited /usr/bin/phantomjs so that the last line now looks like this:
exec "/usr/bin/xvfb-run" --server-args="-screen 0 640x480x16" "/usr/lib/phantomjs/phantomjs" "$@"

  • Twitter
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")
  • Mixx Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")
  • Bloglines Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")
  • Technorati Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")
  • Fark this: Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found")
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at YahooMyWeb
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at Furl.net
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at reddit.com
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at blinklist.com
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at Spurl.net
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at NewsVine
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at Simpy.com
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") at blogmarks
  • Bookmark Grafana PNG export on headless Debian server (phantomjs / render fails with "404 page not found") with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca

Grafana auto login

The solution described here works for me.

I did the following on the internal host where Grafana is installed:

  • Configured Apache (on port 80) as reverse proxy to Grafana (on port 3000)
  • Setup the virtualhost to add/set the required headers to login automatically as user admin

Relevant section from /etc/grafana/grafana.ini:

[auth.proxy]
enabled = true
;header_name = X-WEBAUTH-USER
;header_property = username
auto_sign_up = false

Apache config extract (you will need to enable mod_proxy, mod_proxy_http and mod_headers for this to work):

<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
RequestHeader set "X-WEBAUTH-USER" "admin"
</VirtualHost>

On a separate Apache instance exposed to more networks I did the following:

  • Configured Apache as reverse proxy to the internal instance
  • Restricted access from specific IP addresses
  • Setup a rule to redirect requests to the root of the website (and only those) to a specific dashboard

This is how the Apache config looks like (requires mod_proxy, mod_proxy_http and mod_alias; IP addresses, host names etc. changed)

<VirtualHost *:80>
ServerName sub.example.org
ServerAlias www.sub.example.org
<Location />
Require ip 192.0.2.0/24
Require ip 203.0.113.0/24
Require ip 2001:0db8:85a4::/64
Require ip 2001:0db8:85a5::/64
RedirectMatch ^/$ /dashboard/db/mydashboard
</Location>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://[2001:0db8:85a3::aaaa:8a2e:0370:7334]/
ProxyPassReverse / http://[2001:0db8:85a3::aaaa:8a2e:0370:7334]/
</VirtualHost>

Using a public IPv6 address on the internal host allows the whole thing to work with just a few firewall rules, without the need to mess with NAT or a VPN.
  • Twitter
  • Bookmark Grafana auto login at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Grafana auto login
  • Mixx Grafana auto login
  • Bloglines Grafana auto login
  • Technorati Grafana auto login
  • Fark this: Grafana auto login
  • Bookmark Grafana auto login at YahooMyWeb
  • Bookmark Grafana auto login at Furl.net
  • Bookmark Grafana auto login at reddit.com
  • Bookmark Grafana auto login at blinklist.com
  • Bookmark Grafana auto login at Spurl.net
  • Bookmark Grafana auto login at NewsVine
  • Bookmark Grafana auto login at Simpy.com
  • Bookmark Grafana auto login at blogmarks
  • Bookmark Grafana auto login with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca

How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)

  • On Raspbian, you don't need to install the 8192cu driver manually, as it comes with the distribution

  • To avoid disconnection issues, you need however to disable power management. This needs to be done in two places. First, this is what I have in /etc/modprobe.d/8192cu.conf:
    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

  • This alone did not prevent the issue. I also had to add this entry to /etc/network/interfaces:
    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    wireless-power off
    iface default inet dhcp


Sources: https://github.com/xbianonpi/xbian/issues/217, https://www.kuerbis.org/2016/03/raspberry-pi-3-kurztipps-wlan-sleep-mode-verhindern/
  • Twitter
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)
  • Mixx How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)
  • Bloglines How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)
  • Technorati How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)
  • Fark this: How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect)
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at YahooMyWeb
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at Furl.net
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at reddit.com
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at blinklist.com
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at Spurl.net
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at NewsVine
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at Simpy.com
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) at blogmarks
  • Bookmark How to solve Edimax EW-7612UAn v2 (7392:7822) power management issues on Raspberry Pi (Raspbian WiFi disconnect) with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca

Fixing gcode-sender.rb / serialport.rb "invalid byte sequence in UTF-8 (ArgumentError)"

Somehow, most of the time my Arduino-based EggBot clone outputs one byte of undetermined garbage before saying "Ready". This caused gcode-sender.rb to fail with "invalid byte sequence in UTF-8 (ArgumentError)".

Eventually I found the solution in a post by Wayne Brissette here: https://www.ruby-forum.com/topic/4409620. Basically you need to treat the string as binary instead of utf-8. This small change in the code that waits for the robot to be ready fixed the issue for me:
--- gcode-sender.rb.orig
+++ gcode-sender.rb
@@ -30,7 +30,7 @@
sp.read_timeout = 0 # Necessary for Windows.
while line = sp.gets
print line
- break if line.match(/^Ready/)
+ break if line.force_encoding("BINARY").match(/^.?Ready/)
end
File.foreach(filename) do |line|
line.chomp!

  • Twitter
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot;
  • Mixx Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot;
  • Bloglines Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot;
  • Technorati Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot;
  • Fark this: Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot;
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at YahooMyWeb
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at Furl.net
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at reddit.com
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at blinklist.com
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at Spurl.net
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at NewsVine
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at Simpy.com
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; at blogmarks
  • Bookmark Fixing gcode-sender.rb / serialport.rb &quot;invalid byte sequence in UTF-8 (ArgumentError)&quot; with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca

Accessing iPhone (iOS 10.2.1) pictures from Ubuntu

Recent changes introduced with iOS 10 prevent you from mounting an iPhone on a regular Ubuntu installation.

The PPA by Martin Salbaba used to fix the issue, but it hasn't been updated in a while, and now when I connect my iPhone (running iOS 10.2.1) the pictures are no longer accessible, although the documents are still there.

This solution worked for me (Ubuntu 16.04):

- install libimobiledevice6 + dependencies from this PPA: https://launchpad.net/~martin-salbaba/+archive/ubuntu/ppa+libimobiledevice (follow the instructions there)

- install newer libimobiledevice version according to the "recipe" by A.B. here: http://askubuntu.com/questions/598940/libimobiledevice-1-2-ios-8-support-for-ubuntu-14-04-trusty

- install ifuse according to the same method:
cd ~/src/
git clone https://github.com/libimobiledevice/ifuse.git
cd ifuse/
sudo apt-get install libfuse2 libfuse-dev
./autogen.sh
make
sudo checkinstall

You can now mount your iPhone like this:
mkdir ~/mnt
ifuse ~/mnt
I assume the same procedure would work for an iPad too.
  • Twitter
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Accessing iPhone (iOS 10.2.1) pictures from Ubuntu
  • Mixx Accessing iPhone (iOS 10.2.1) pictures from Ubuntu
  • Bloglines Accessing iPhone (iOS 10.2.1) pictures from Ubuntu
  • Technorati Accessing iPhone (iOS 10.2.1) pictures from Ubuntu
  • Fark this: Accessing iPhone (iOS 10.2.1) pictures from Ubuntu
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at YahooMyWeb
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at Furl.net
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at reddit.com
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at blinklist.com
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at Spurl.net
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at NewsVine
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at Simpy.com
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu at blogmarks
  • Bookmark Accessing iPhone (iOS 10.2.1) pictures from Ubuntu with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca