Posts tagged ‘linux’

Mobile broadband for linux

It appears that new mobile internet dongles aren’t very well supported in linux.

I had problems get the new vodafone dongle to work (ZTE K3570-Z – I bought this in January 2010, this was with quite a lot of work).

3 were the only provider who I could be sure provided a dongle that worked with linux (ZTE MF112 avaiable as of april 2011).

This worked out of the box with Lucid, with the following caveats:

i. The dongle occasionally sent out stronger signals causing my monitor to flicker. (This was very occasional every hour or so, and on a laptop)

ii. The dongle becomes quite hot (more noticeable so that with the windows only vodafone dongle).

iii. I think the connector on the dongle is slightly flimsy. I managed to break this by leaving my laptop on things. Though I was by no means being careful. I would advise using the connector provided.

Advertisements

April 5, 2011 at 11:04 pm Leave a comment

Debugging Wifi on Ubuntu Linux

To actually get ubuntu to give you some logging when connecting to wifi (you know so that you can act according to some information rather than at random):

  1. Become superuser
  2. Run killall NetworkManager
  3. Run NetworkManager –no-daemon

This will then give you output for every stage of the connection process.

Network manager is (I believe) the tool that handles the overall process of opening a wifi connection using different processes (iwlist, iwconfig, wpa_supplicant etc) to do the actual connection.

Notes

Messages of the form “supplication connection state change number -> number” are (i think) from wpa_supplicant. Someone who isn’t me should change NetworkManager so that these are written in english. For now note that the states mean the following:

0 – WPA is disconnected
1 – WPA is inactive (no enabled connections and wpa isn’t trying to connect
2 – WPA is scanning
3 – WPA is associating (a loose-form of connection)
4 – WPA is associated
5 – WPA 4-way hand shake
6 – WPA group handshake
7 – WPA completed

I was seeing a lot of 3 -> 0 state changes when I was debugging. [This was taken from the wpa_supplicant source code in src/common/defs.h]

March 7, 2009 at 5:14 pm 1 comment

Backing up one’s home directory with tar

This is something that should be fairly easy. However in practice there are some problems:

  1. Tar has a proliferation of options and can be an effort to use – at least if you are using it infrequently
  2. One’s home directory often contains large files (like perfectly legally downloaded music and videos), which you don’t really want to back up repeatedly.
  3. Some applications put rather large things in hidden directories under your home directory

There are various solutions:
(more…)

April 20, 2008 at 2:01 pm 3 comments

Fixing catastrophic mistakes with apt-get

Story for the patientDecorative Picture

I managed to utterly break a linux installation yesterday, by trying to install a single package with apt-get. Apt helpfully decided to suggest removing a number of important packages, and I absentmindedly agreed.

The lesson learned here would be that you should always press ‘n’ immediately and think whenever apt suggests removing more than a couple of packages, if I didn’t know this. I suppose the real lesson is just to be less dim, but alas this never seems to work. Another lesson is to especially be less dim when you only have a wireless internet connection and you decide to remove the things that make it work.

Anyway, I found a moderately nice way of reverting these damaging changes.

Although apt does not do any logging, it uses dpkg for installation (on debian type systems at least) and dpkg does do logging.

Looking at /var/log/dpkg.log I found that it neatly recorded all of dpkg’s operations so I was able to get a list of all the packages I had absentmindedly removed by using some crpytic shell commands:

cat /var/log/dpkg.log | grep remove | cut -d " " -s -f 4 > ~/removed-packages

I then could reinstall these with:

apt-get install `cat removed-packages`.

Hurrah for copious logging and shell textual data processing… or something like that.

Summary for the impatient:

Apt doesn’t store a log, but dpkg does and apt uses dpkg. The relevant log file is /var/log/dpkg.log. To get a list of the removed packages, and install them again you can run:

cat /var/log/dpkg.log | grep remove | cut -d " " -s -f 4 > ~/removed-packages; apt-get install `cat ~/removed-packages`

as a root user.

March 11, 2008 at 10:40 pm 1 comment

How to stop the bell ringing in bash

To stop bash from trying to ring the bell add

set bell-style none

to the /etc/inputrc file. You can also be added to a local ~/.inputrc file – but this won’t work if
you log in as root.

Also, note that this won’t stop other applications from trying to ring the
bell – for this it might be best to switch off the bell at BIOS level.

See man bash.

Other applications whose bells you might like to stop:

less: Use the -q option. This can be acheived permanently by adding alias less=”less -q” to your .bashrc file.

man: man uses the $PAGER environment variable to display man pages, or the default pager (normally less) otherwise. Therefore add export PAGER=”less -q” to your .bashrc file.

vim: By default vim rings the bell. To stop this type set vb t_vb= at the colon-line, or add it to your .vimrc file.

emacs: Set the variable ring-bell-function to a function that doesn’t do anything. (setq ring-bell-function (lambda () nil)

March 9, 2008 at 3:05 pm 1 comment

How to not break your hands when using key combinations (using *nix)

I find that trying to use both hands when entering key combinations feels slightly less inclined to cause injury than using the same hand. For example, instead of pressing control-C with only your left hand, you hold the control button with your right hand and press C with your left hand. This approach seems to limit the degree to which you need to contort your fingers. (However, I have no experience with RSI, so perhaps you shouldn’t believe what I say)

Learning to use these new fingerings takes a little mental reprogramming.

If you are going to try to be religious about this, one problem that you will face is that a keyboard only has one alt key: the alt key on the right hand side of the keyboard normally being used to insert non-ascii characters. By rebinding this alt key to have a slightly more mundane meaning you can save yourself some contortion.

This rebinding can temporarily be done using the following shell commands.

xmodmap -e "keycode 113 = Alt_L"
# Make the left hand alt key (key 113) behave like a left handed alt.
xmodmap -e "clear mod5"
#Stop any key (and particular key 113) from being used to insert non-latin characters.

To make this permament one needs to modify the .xmodmap file in one’s home directory – or create it – should it not exist. .xmodmap will be executed by xmodmap when X starts.

<pre>
keycode 113 = Alt_L
clear mod5
</pre>

Notes

See “man xmodmap”.

If you love for your native language exceeds your loathing for hand contortion, you could try rebinding a different key to act as ‘mod5’. I might recommend using the windows (super) or context menu keys for this.

You should be able to do this with the ‘add’ command – though not that this takes keysyms rather than keycodes as arguments. (This will, hopefully, make sense after consulting the manual).

On windows one can use the freeware program Sharpkeys to carry out this change. This works by setting changing a registry key.

March 9, 2008 at 2:53 pm Leave a comment


October 2017
M T W T F S S
« Nov    
 1
2345678
9101112131415
16171819202122
23242526272829
3031