Archive for the ‘unix/windows’ Category

Connecting to VPN (Juniper) on Ubuntu 14.04 64 bit

Wednesday, February 4th, 2015

The OU is using a VPN. You can connect with a Java applet, unfortunately, we’re still running an older version that relies on the 32 bit java version.

Instructions for working around that can be found
here.
Moreover, my home dir is encrypted, which apparently a problem (see comment about encrypted home dirs).
Solution to that one from here:
move the setuid binaries somewhere else and symlink them.
I.e.:

  • sudo mv $HOME/.juniper_networks/network_connect/ncsvc /opt/juniper-vpn/ncsvc
  • ln -s /opt/juniper-vpn/ncsvc $home/.juniper_networks/network_connect/ncsvc

This gets it working. Funnily enough, I still cannot connect directly to intranet – so what is Juniper now doing for me anyway? :)

Edit
Note that you should *ONLY* link the SUID binary. If you symlink the whole directory, it doesn’t work and Juniper crashes.
(Thanks Juniper, for that fun-filled 45 minutes of hunting the internet on why you crashed!)

Exchange + Google calendars in Thunderbird

Monday, February 2nd, 2015

Thunderbird logoPart 2 of getting set up. Obviously, I have an Exchange calendar. Obviously, people are going to be using that to gauge when I’m available. So I need to manage that calendar in a way that works.

Enter the Lightning plugin for Thunderbird! With the previously mentioned DavMail, you can get your exchange calendar in Thunderbird. Which kind of beats Microsoft’s web interface – though not by much.

I also added a Google calendar via CalDav (which works directly with Lightning). Adding and deleting events is nicely synchronized :) Adding another (big) Google calendar, however, borked the overview (appointments no longer shown), though the list above the calendar still showed correct info.

Connecting Thunderbird to an Exchange (Outlook) server

Monday, February 2nd, 2015

Thunderbird logoSo, my new employer uses Exchange servers for email (i.e. Outlook for clients). I’m not on an Outlook-supported platform, so that’s not ideal.

DavMail to the rescue! It’s a piece of software that runs under Windows, Unix and OSX. What it does: it translates the secret Exchange-Outlook mail protocol into public protocols (POP, IMAP, SMTP, CalDav, LDAP, …).
And it works quite beautifully! Though you’ll need openjdk-7-jre for it to run.

Next, you can set up Thunderbird to get your Exchange mail via DavMail (username at the OU: XXX@pwo.ou.nl). And it works beautifully!

In related news: it seems you cannot stop Thunderbird from checking an account: if you’re online, it’s trying to check that account. Annoying if you have an old account to which you no longer have access (but have a local archived copy).

WiFi op de Open Universiteit

Monday, February 2nd, 2015

OU logoEen verbinding maken met de medewerkers-wifi van de OU onder Ubuntu gebruikt de volgende settings:

  • WiFi naam: ou-medewerker
  • Security: WPA & WPA2 Enterprise
  • Authentication: Protected EAP
  • Inner authentication: MSCHAPv2
  • Username: XXX@pwo.ou.nl (met XXX = je login naam)
  • Password: je wachtwoord

Zo kom je op OU-medewerker. Om op intranet te kunnen, moet je NTLM authenticatie opzetten en configureren onder Ubuntu – zie een volgende post.

Ubuntu and WiFiMax as access point!

Tuesday, October 21st, 2014

Years ago, I bought a “WifiMAX” usb dongle that (under Windows, with the packed CD) would coax your computer into creating a wifi network to share with your Wii.

I dug it out to check if I could get that working under Unix.
The problem I ran into way back when was that the WiFi driver could not switch the USB stick to Master Mode (read: become an access point). Now, I found out
how to do that. Hooray for me!

Of course, I’m not there yet – the phone can find the network, but now it still needs to forward everything from its normal Internet connection (i.e. bridge ppp0).

To prevent failure in case of linkrot, below is a recap of the partial solution provided by the above link.

You need:
– sudo apt-get install hostapd
– sudo apt-get install isc-dhcp-server

# turn the wifi off - can also just click "Enable WiFi"
sudo nmcli nm wifi off
# deblock Wifi with rfkill
sudo rfkill unblock wlan

# bring the wifi back up & wait a bit
sudo ifconfig wlan0 10.15.0.1/24 up
sleep 1
# start the DHCP server
sudo service isc-dhcp-server restart
# start the Access Point server
sudo service hostapd restart

Remaining challenges:
– get an IP (somehow not working)
– setup WPA2 (if I try, I get authentication errors)

Edit: the main challenge is that I’m using a 3G usb modem as my internet connection. That modem does not speak IP (but ThreeGeese). So standard bridging solutions don’t work – the packets arriving at the computer are not in ThreeGeese and thus cannot be forwarded.
Pointers to investigate:
https://help.ubuntu.com/community/SharingMobileBroadband
http://ubuntuforums.org/showthread.php?t=1822957

Default brightness on Ubuntu

Saturday, October 18th, 2014

I’ve looked a bit, but there doesn’t seem to be a stable solution yet. (there’s a bug report, so it might get fixed). My solution:

  1. cat /sys/class/backlight/intel_backlight/brightness when brightness was at desired level for startup
  2. in /etc/rc.local, echo this value back to that file.

This is not portable (default is 456 now…), but hey, it works :)

Booting Ubuntu (on Z930) in “flight mode”

Wednesday, October 15th, 2014

I would prefer to boot in “flight mode” — that is, all wireless devices turned off. I know where and how to turn them on (or at least, I think I do ;-). Plus, I’d prefer to, by default, save battery. (In that respect, I need to find out how to start with the brightness turned down a bit :s).

So far, this seems a hassle – every time I turn on the laptop, I’m greeted with a prompt for a WiFi password. Adding rfkill block all in /etc/rc.local/ (as suggested on various sites) doesn’t work.

Apparently, there are two independent processes that both can switch WiFi on during boot. You read that correctly: there are two processes which are independent, each of which sets the state of WiFi on boot. (to be precise: rfkill restore and networkmanager. They both try to recreate the setting they stored from last time – which can be conflicting.)

This gives a race condition. To address, you can create two scripts in /etc/init/: one to change the saved states of these processes, and one to run before either starts.
Hope this works!

*edit* hmmmmms. After reboot, no WiFi popup…. but also no NetworkManager running. So plugging in Ethernet does not work — I need to start NetworkManager myself.

Probable cause (from stackoverflow):

The ‘start on’ section lets you know which events need to be emitted before upstart will start network-manager.
In this case it’s:
– local-filesystems
– dbus
– static-network-up
Odds are the first two have already been emitted if you have booted to a desktop.

static-network-up is emitted by the /etc/network/if-up.d/upstart script, crucially, the event will not be emitted unless every interface configured as ‘auto’ in /etc/network/interfaces is up.

Trying to fix this by adding service network-manager start to rc.local…

*edit2*: that didn’t help. I’ve played around a bit and reverted to rfkill only. For some reason, the race condition worked out in my favour the last few times – likely because I manually switched off wireless, so both processes stored all wireless states as “off” now…

Fixing brightness on the Z930

Tuesday, October 14th, 2014

(I couldn’t find if I had posted this, so here’s the deal)
Getting Ubuntu to run side-by-side on my Z930 was a major hassle – to the point I had to call in assistance (Thanks, Piotr!!).
After that, I had it running, but the brightness keys did not work. Kind of silly – the screen was at full brightness, which is less than ideal for a laptop on battery…

Took a while to fix it. Below is what I can now reconstruct that we’ve done — this includes both the tips from http://www.linlap.com/toshiba_portege_z930 and this workaround. Both are on my laptop – I don’t know if one out of two would suffice…
Below, I’ve reproduced both in case one or the other goes offline.

Tips from LinLap.com

In /etc/default/grub, add acpi_backlight=vendor at the end to GRUB_CMDLINE_LINUX_DEFAULT. Next, run update-grub (given all the problems with UEFI and having 3 bootmanagers on the system now, that’s a scary step for me).

After rebooting, this will remove the acpi_video0 from /sys/class/backlight/ leaving you just with intel_backlight and toshiba. Upon resuming with these settings the screen would be completely black with no means of making it brighter. To fix this one needs to create and add the following to /etc/pm/sleep.d/restore_brightness:

#!/bin/bash
case "$1" in
   suspend|hibernate)
      #do nothing
   ;;
   resume|thaw)
      echo 7 > /sys/class/backlight/toshiba/brightness
   ;;
   *)
      exit 1
   ;;
esac
exit 0

chmod +x /etc/pm/sleep.d/restore_brightness

That’s it from LinLap.

Bug workaround

Create the file /usr/share/X11/xorg.conf.d/80-backlight.conf as:

Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
    Option "AccelMethod" "sna"
    Option "Backlight" "intel_backlight" # use your backlight that works here
    BusID "PCI:0:2:0"
EndSection

That’s the workaround. Both are on my system, and the brightness controls work.

Ubuntu 13.10 for Galaxy Greatness!

Wednesday, January 29th, 2014

I’ve just upgraded my desktop from Ubuntu 12.04 LTS to Ubuntu 13.10. I didn’t think I would – the machine started out on Ubuntu 6.10….

However, I am since almost a week (or should I write “weak”? ;-) the proud owner of a Samsung Galaxy Note III!

Frankly, I still don’t know why.
Having said that, I do want to be able to interface with this fancy new piece of equipment. Turns out that that is a pain in Ubuntu 12.04. And it works out of the box in Ubuntus from 13.04 on – but support for Ubuntu 13.04 stops after this month (i.e., in 2 days). Support for 12.10 will continue for another 3 months though (ain’t that weird).

So, up to the newest version! Annoyances:

  • No virtual desktops
  • All sorts of shopping results in the Dash

Thankfully, there are fixes as well:

  • Go to Appearance > Behavior and toggle “Enable virtual desktops”
    Start CompizConfigSettingsManager (ccsm), go to General > General Options > Desktop size and set it to your liking.
    (answers from StackExchange)
  • Open the Dash, click Filter Preferences, scroll down to Sources and disable everything except for “Applications”.
    Source of this solution.

With this, you have your trusty old Ubuntu system back under your control (don’t forget to run svn upgrade on your repos, it’s necessary), and it does interface with the Galaxy Note out of the box :)


Edit after upgrading the machine at work: Hmms, that stuff with the lenses took some more effort.
From FixUbuntu.com comes the ultimate script for preventing online connections. I’ve pasted it below. Most salient features:

  • gsettings set com.canonical.Unity.Lenses remote-content-search none
    This one-line wonder should kill any remote search.
  • echo -e "\n127.0.0.1 productsearch.ubuntu.com" | sudo tee -a /etc/hosts
    This one-line wonder prevents any connections to ubuntu’s productsearch servers.

With this, you can search from the Dash (press windows key) without any online results popping up. I prefer that – if I want online results, I’ll use the online search, thankyouverymuch.

The full script:

#!/bin/bash
 
# Figure out the version of Ubuntu that you're running
V=`/usr/bin/lsb_release -rs`
 
# The privacy problems started with 12.10, so earlier versions should do nothing
if [ $V \< 12.10 ]; then
   echo "Good news! Your version of Ubuntu doesn't invade your privacy."
 else
   # Turn off "Remote Search", so search terms in Dash don't get sent to the internet
   gsettings set com.canonical.Unity.Lenses remote-content-search none
  
   # If you're using earlier than 13.10, uninstall unity-lens-shopping
   if [ $V \< 13.10 ]; then
     sudo apt-get remove -y unity-lens-shopping
  
   # If you're using a later version, disable remote scopes
   else
     gsettings set com.canonical.Unity.Lenses disabled-scopes \
       "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope',
       'more_suggestions-populartracks.scope', 'music-musicstore.scope',
       'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope',
       'more_suggestions-skimlinks.scope']"
   fi;
  
   # Block connections to Ubuntu's ad server, just in case
   if ! grep -q productsearch.ubuntu.com /etc/hosts; then
     echo -e "\n127.0.0.1 productsearch.ubuntu.com" | sudo tee -a /etc/hosts >/dev/null
  fi
 
  echo "All done. Enjoy your privacy."
fi

Connecting Ubuntu to WPA2 PEAP networks

Thursday, December 19th, 2013

It doesn’t work out of the box, and apparently there’s a bug report for it.
From http://askubuntu.com/questions/279762/cant-connect-to-wpa2-enterprise-peap:

There is a bug report here: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1104476
A workaround is to remove the line
system-ca-cert=true
from the configuration file found in /etc/NetworkManager/system-connections/NAMEOFNETWORK