Category Archives: Ubuntu

mosquitto connection refused

Hi all, if you’ve just upgraded mosquitto server on some flavour of linux and wondered why all your mosquitto subscribers and publishers on your network have just started failing, you may have fallen foul of this:

the new mosquitto 2.0 requires a ‘listener’ be configured to the ports required, or else it will only listen to the localhost:1883.

So if all your clients start failing after, edit the configuation and add the following line to the top:

“listener 1883”

See the post here for more information: https://mosquitto.org/documentation/migrating-to-2-0/

Mythubuntu 12.04 and Radeon 9200

Hi all, I was having trouble installing Mythubuntu 12.04 on an old PC I had lying around.
Mythubuntu is based on Ubuntu 12.04 so if you’re struggling with the ATI Radeon 9200 on there these steps should help.

(Since I have a Hauppuage Nova-T 500 dual freeview pci card from old projects, and a 2tb drive from new ones, I wanted to see about recording some films!)

Basically, when booting it would come up with a garbled, black or blank screen.

If this happens during the livecd boot, preventing you from installing, when you see the logo:

Logo that appears when first booting ubuntu from livecd.

Logo that appears when first booting ubuntu from livecd.

Hit enter, and F6 for other options, select nomodeset, hit enter to enable then Escape and enter to boot.
If operating from a laptop, you might want to try noapic too.

 

In the latest grub setup – grub 2 – the boot menu is hidden, making it near impossible to access.
Might make it look pretty but is major frustrating for troubleshooting!
The script /boot/grub/grub.cfg it uses is supposed to boot in textmode if it has failed to boot, but this does not work.

The fix:

Note: you can login, type

sudo su

and then skip typing sudo with every command below (it gets quite annoying I know!)

  1. To access the grub bootmenu, hold down shift – after all your pc’s bios and add-on cards bios screens have disappeared and until it pops up – it takes a while to appear!
  2. To access the console – textmode, insert the word text and remove ‘splash quiet’ from the kernel options,
    also insert the word nomodeset
    then press F10 or Ctrl-C to boot with the new settings.
  3. Connect to the internet, if using Wired connection you may need to connect (hopefully you connected ok during the install)

    sudo nmcli -p con up id “Wired connection 1”

    If that doesn’t work check your wireless connections names with and edit the above command appropriately

    nmcli con

  4. Install xserver-xorg-video-ati

    sudo apt-get install xserver-xorg-video-ati

    (don’t freak out when you see ‘Removing Mythubuntu-desktop’ it seems to come right in the end.

  5. Create a new link for the X server
    (Not sure why this breaks after the upgrade but it won’t work without this step!!)

    sudo ln /usr/bin/Xorg /usr/bin/X

  6. Edit the default bootmenu script
    Add nomodeset to the default grub bootmenu

    sudo nano /etc/default/grub.cfg

    Change this line near the top:

    GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
    to
    GRUB_CMDLINE_LINUX_DEFAULT=”nomodeset”
    #”quiet splash”

    The # tells it to ignore this bit, it’s a backup so that we can make it quiet again later. You’ll notice text streaming by as the system boots instead of the cute (Myth) Ubuntu …. logo

    Ctrl-X to exit, type s and Return to save

  7. Update grub

    sudo update-grub

  8. Reboot and Revel in the shinyness

    sudo reboot

I actually ran this command to to start the windows manager, (and I haven’t tried rebooting yet, shhh)

sudo start lightdm

If you have any extra trouble, comment below, check the ubuntu forums and google.
I managed to work this out on my own as I couldn’t find the answer!

 

I also created a script to set the resolution of lightdm at boot, following the guide here:
LightDM Resolution

This did not work as when I started lightdm, the resolution was set higher than I’d set in lightdm, so I don’t think this was part of the fix.
Thankfully it was within my monitors capabilities. I think I set the output name wrong.
I need to figure out the display outputs are available but couldn’t query it from the command line without x running, which seems kinda silly.

Hope this has been helpful!

Help firefox wget and ssh shell script

I’m trying to create a script to allow me to command a remote server to download a file from firefox.

There are various reasons for this, mainly todo with connection speed.

What I have at the moment is:
#/bin/sh
terminator -x ssh user@site.com wget -qc -t 3 -o ~/wget_testlog ftp://anothersite.com/file.ext \\& \& &

I want it to kick off, ask for a password to login via ssh and then go away…
I would like to be able to set the location for the download to ~/www/files/

I was planning to place this script in /usr/bin and install it in firefox using the code/link provided on this blog: Wget from firefox

Can anyone complete my solution with the correct syntax, or provide a better solution (preferably KISS)?
I’m more of hacker than an expert IMO and I know when I’m out of my depth!

Cheers,
Garreth

Network Monitoring

I’ve been searching for some simple tools to monitor my internet connection for some time, and finally I’ve found a few tools that do the trick.

If you’re looking for a console application to give you a quick heads up on the transfer speeds across a network interface have a look for ifstatus (not to be confused with the ifplugd suite) .

Ifstatus

If you’re looking for something to log and display network statistics checkout vnStat

vnstat graphvnstat graph

Minor niggle: both these programs needed compiling and required additional dependencies which I recall were GD, for the graph creator of vnStat (vnstati) and curl for the console interface of ifstatus.

If you have any other suggestions, queries or points, please leave a comment!

Fail.

Example one – forgetful screenshots

screenshot-fail

A couple of screenshots. Firstly, every now and then, people send us screenshots. They do this by sending them in word documents, which is bad enough. (Please, just send us an image file!) This example though, is quite fun.

Make sure you actually copy the screenshot in, instead of just linking it ๐Ÿ˜‰

Example 2 – Infect yourself, and pay money for the privilege

Stupid-Script-Kiddies

My second example, is of a website trying to extort money, by making you think your computer has been infected with a virus. These are nasty sites, and I hate them with a passion. They feed off of people’s fear of computers. The interesting thing here is, this computer can’t be infected in this way… it’s running ubuntu, their silly antivirus software looks very, very out-of-place!

(See my first post this month if you’re afraid of computers.)

Click on the image for the full screenshot. It is quite large. As you can see from the timestamp, I’ve been meaning to post this one for a while ๐Ÿ˜‰

p.s. Does anyone know how to force formatting in wordpress? This post took about 10 minutes of fiddling to get the images to go some-where near where I wanted them :/ If you do, please comment! If you don’t please comment. In fact, please comment, comments make my day!

Karmic notebook Theme

Finally got around to upgrading to Karmic Ubuntu, and so far Its looking good. There is a few oddities in the theme, which makes using it a bit annoying, but I guess I’ll get used to it. See the screen-shot below for what I mean, the strangeness of the interface The bar at the top, the new greying out an in of active icons all help to make the best use of this screen size. You can tell the design team are doing good work ๐Ÿ™‚

One small problem, is the lack of a clock, or logout button. For some strange reason, both didn’t make it, and hitting the power button no longer brings up the shutdown interface. I’ve been using the command ‘shutdown -h now’ in a terminal for the moment, will have to dig around, see why it isn’t there/coming up later.

Theme Problem

Quick useful sysadmin stuff

Two useful things I have found or use ๐Ÿ™‚

Firefox Awesomebar search trick

A wonderful tip, that someone sent into the ubuntu-uk podcast. (I can’t remember who, or the episode. Comment if you know and I’ll credit them here! ๐Ÿ™‚ )

You can search, in any website’s search function, using firefox’s address bar. Now, at first glance this sounds really boring and useless, but it really isn’t, at all.

First, we need to find a website to search. Let’s use launchpad’s bugs search, for Ubuntu. So, we go here:

https://bugs.launchpad.net/ubuntu/

Screenshot Firefox add search bookmarkThen, right click on the search box, and click “Add a keyword for this search”. This brings up the standard bookmark – your search keywords are stored as a bookmark. Give it a useful name, something to help you next time you go sorting through your book marks. Now, the keyword is how we use this trick. I’m going to use “bugs”, but you can use anything you want, just remember, this is the word you put before your search string in the address bar. Click Add.

Screenshot Firefox address bar search for bugsNow, all we have to do, is to search for a bug. Let’s use the classic bug 1.

Open a new tab (CTRL + T), then in the address bar type [your keyword] microsoft market share, and hit enter.

Lo and behold:

Screenshot Firefox launchpad bug 1

Testing SMTP-AUTH the fast way

Found a really handy little command line program called “swaks”. Great if you’ve ever needed to test SMTP-AUTH, and didn’t want to have to base64 the username and password yourself. Here’s a quick rundown on the command and flags I use with them. (Should be fairly obvious, comment if not!)

swaks -s [smtp-server-name-or-ip] -au [smtp-auth-user] -ap [smtp-auth-password] -f [from-address-of-testing-email]

Hit enter, and it’ll ask you the “to” email address. Type it in, and it gives you the full connection readout, just as if you were doing it with telnet (or netcat) on the command line:

<- 220 smtp.our-domain.com ESMTP
-> EHLO gemini
<- 250-smtp.our-domain.com
<- 250-AUTH LOGIN
<- 250-AUTH=LOGIN
<- 250-PIPELINING
<- 250 8BITMIME
-> AUTH LOGIN
<- 334 Z29vZCB0cnkgOikK

And so on. ๐Ÿ™‚

phpmyadmin in ubuntu now being exploited en-masse

Update: ubuntu patched this issue a couple of days after this post. If you’re reading, thanks guys! You just made my job a lot easier ๐Ÿ™‚

At some point, I might try to look at helping maintain this, and other packages like it in the ubuntu archive. No idea how, though a colleague may be able to help…

———————–

The versions of phpmyadmin in ubuntu (at least Dapper – Intrepid) are susceptible to arbitrary code execution, as the web-server’s user. A bug1 was reported on the 15th of June about this issue, and marked as high priority on the 21st.

The phpmyadmin team patched this problem in their software on May the 24th. 2

Debian patched this in their system on the 25th of June.

I tried talking to people on #ubuntu-security about this problem. They said “motu” and “we’re not interested, its in universe”. I tried talking to people in #motu, and they talked about work-arounds.

The main questions now are:

  • Please can someone work on the bug?
  • Why did it take so long between upstream report and launchpad report?
  • Why has the bug been left to the point where it is getting automatically exploited, en-masse? 3
  1. https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/387215
  2. http://www.phpmyadmin.net/home_page/security/PMASA-2009-3.php
  3. http://seclists.org/fulldisclosure/2009/Jul/0021.html

Current Cost – watt hours and pachube

This is an email i sent to JTย  so I apologise if it doesn’t make sense to y’all. Please ask questions if you don’t get me!

So we have this ‘Current Cost’ meter thing (free from Southern Electric) at the house. It’s a small wireless electricity meter. Well it’s more of a monitor or display actually but you get me….[insert pic].

Long story short, I’d noticed the RJ45 on the bottom and it’d got me wondering. A few google searches later and whammo i’d found what I needed. A bit of hardware, a bit of software (links on manyfacturers website!) and whammo….

I wired up the current cost (enegry meter) at the house to my laptop and it’s uploading to this Pachube (bless you) website:
http://www.pachube.com/feeds/2196

The graph is a bit useless atm (no history or dates on it ๐Ÿ™ ) but the program here:
http://apps.pachube.com/google_viz/
Could probs snazz it up a bit.
There seems to be a binary pattern from some device that is turning on and off at regular intervals and using ~100w… i wonder if it’s the compressor on the fridge/freezer as it goes on thru the night lol.

Graph of peak watts and temperature from current cost and excel

Graph of peak watts and temperature from current cost and excel

The long jittery spikes are the washing machine/dishwasher/tumble dryer (the last being the biggest draw lol).

One guy is even trying to record signatures for each appliance and then work out from the data which appliance is causing the spikes.
http://chrishodgins.tumblr.com/post/33810511/via-chart-apis-google-com-so-its-the-bank
The idea behind this is if you can work that out, you can make a pie chart of the biggest consumers…

I have more results than are uploaded; i created a funky excel file which Should update from the mdb created from one of the apps i’m using but atm i think the file is locked or summat :(. Made a pretty graph to! Also predicting the future temperature based on a polynominal curve or something lol.

All gd fun. Now i jus want one of these tiny minuture computers:
http://www.fit-pc.co.uk/fit-pc-slim.html
or this awesome plug pc:
http://www.pcpro.co.uk/news/258238/plug-sized-pcs-arrive-in-uk.html (sweet) (Ubuntu on a plug [ via Youtube])
to record/upload the results, although it would make more sense to use the ipcop or home server since they are always on and the current cost device is wireless. (unfortunately our model does not have internal data logging ๐Ÿ™ ). Don’t know how to work out kwh from current usage of watts every 3 seconds… i might be able to put something from averages tho. Any suggestionsย  anyone? I might just be being dumb lol.

Now all we need is the x10 plug thru devices to monitor electricty usage (by appliance) and bobs your uncle – we know exactly where the electricity is going.

IMOย  (as a soon to be Building services engineer in training) this technology should be wired into all new houses in the actuall plug sockets. Want to know which of your kids (or indeed partner) is using the most electricity? ๐Ÿ˜‰

The trickle usage these measuring devices could be designed to run on could easily be offset by a small(ish) solar pv installation too! (i’m talking around 10-30wh/day here ๐Ÿ˜‰ ).

Oh and here’s how to connect the current cost to pachube:
http://community.pachube.com/?q=node/100

On the upside i’ve also unplugged the fancy pants MPPTย  solar charge controller and hooked the install back up to the basic on/off controller, and now it’s definetly shifting amps! I was a bit worried that in full sun 53watts of panels was ONLY putting through 0.3-0.1a @11.7 (i know, discharged). Hmm gonna have to find out whats wrong with fancy pants, he wasn’t cheap! :'(