pages tagged debianThinking Aloudhttp://www.jrichards.ca/tags/debian/Thinking Aloudikiwiki2013-01-04T04:09:14ZBluetooth file transfer on Debian, ObexFShttp://www.jrichards.ca/posts/bluetooth-file-transfer-on-debian-obexfs/2013-01-04T04:09:14Z2012-06-12T06:01:22Z
<p>I have been trying to get more and more of my home directory into a version control system. The simple reason behind this is that I use a few different computers and remembering what is where problem is really quite annoying. Following this quest, I wanted to be able to put my most important home files onto my phone in a git controlled manner so that I would have a copy there should I need it. Since all the machines I'm working on have bluetooth. Having a bluetooth technique to do the file transferring seems like an ideal solution.</p>
<p><a href="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-logo1.jpg"><img src="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-logo1.jpg" alt="" title="bluetooth-logo" width="132" height="180" class="alignleft size-full wp-image-377" /></a>
But I wanted a little more than just file transfer I wanted to actually be able to do the file transferring and updating of my files using git. So what I really wanted was to be able to mount my phones sd card over bluetooth. This as it turns out can be accomplished with a little help from <a href="http://dev.zuckschwerdt.org/openobex/wiki">openobex (obexfs)</a> (spoiler: this mounting does not actually give you a regular file system mount, but rather a mount with some file transfer (ftp) abilities, but not enough to support git).</p>
<p>To start you need to have an application on your phone that is operating an obex ftp service. I installed <a href="http://www.medieval.it/blueftp-android/menu-id-68.html">Bluetooth File Transfer</a> on my HTC Desire Z running <a href="http://www.cyanogenmod.com/">Cyanogenmod 7</a> that said I think this app would work for any android phone running a reasonably recent android system. This application will start up an obex ftp service running on port/channel 30 that you can connect to. The application has little documentation that I could find but, in my experience I just needed to start the application. To verify that you're obex ftp service is running you can go to Menu->More->Settings->Sharing Service(FTP) and verify that it is enabled and configure the folder that is being shared. I can not recommend enabling the Security prompt as that caused problems for me later in the process.</p>
<p>Okay, so now the phone is ready and listening time to connect to it using the Debian GNU/Linux machine. If you're just going to send a file or two and you I would recommend sticking with <a href="http://library.gnome.org/users/gnome-bluetooth/stable/gnome-bluetooth-applet.html.en">Bluetooth-Applet</a>, it is pretty easy to use and in my experience works easily for sending. I didn't manage to get browsing the device working, but that's probably just me.</p>
<p>If you wanted as I did to actually mount the sdcard over bluetooth, you need to hit the command line. Unfortunately, apparently pretty much all the documentation that is out there on the internet was documenting the way to do things with the <a href="http://blog.projectnibble.org/2010/08/08/how-ubuntus-broken-bluetooth-support-came-to-be/">bluetooth stack pre version 4, and version 4 changes how a lot of things are done, it was confusing, although at times entertaining</a>.</p>
<p>Now then, here's the howto. You need to have obexfs installed.</p>
<p>First thing is to verify that the debian system is paired with the phone. I did this using the bluetooth-applet (looks that up elsewhere if need be)
Then make the phone discoverable and run
<code>~$ hcitool scan </code></p>
<p>Which should return your mac address and the name of the device. Keep the mac address you're doing to need that. Mac Address is of the form XX:XX:XX:XX:XX:XX, but all Xs are replaced with numbers of characters.</p>
<p>Then run
<code>sdptool browse XX:XX:XX:XX:XX:XX</code>
Somewhere in the output you should see a listing that say "Service Name: OBEX FTP" If you don't make sure that the Bluetooth File transfer Application is running on the phone and try again. Note the Channel number, in my case it is 30.</p>
<p>Okay now we're ready to attempt to mount the sdcard over bluetooth.</p>
<p>You'll need an empty directory to do the mounting so
<code>~$ mkdir bluetooth </code>
then
<code>~$ sudo obexfs -bXX:XX:XX:XX:XX:XX -B30 bluetooth</code>
Now, the good news, you've mounted the phone!<br />
<code>~$ sudo ls bluetooth</code>
should show you the contents of the mounted folder. And you can copy things in and delete them. it works very well.
Now the bad news. You need to be root (or sudo) to do these things. This could likely be remedied by making this an entry in /etc/fstab that allows users to do the mounting. But I never made it that far.
Now the really bad news (for me) when I went to git clone my repository into the mounted folder (even as root) the process only manager to pass the folder structure across before it died. Likely because it was trying to do a file operation that isn't supported by obexfs.</p>
<p>Which brings me to my conclusion, that at the end of the day, we still really have an ftp service here. And that brings with it a bunch of restrictions, rsync isn't going to work here, just like it doesn't work for any ftp service, bluetooth or otherwise. And not knowing the working of git perhaps I could have known from the start that it wouldn't work here either but alas I did not. I feel a bit like a man trying to walk to the moon at this point, but perhaps my journey will help someone else make their more reasonable journey.</p>
<p>PS: If you need to do some debugging I would recommend installing obexftp which had some more useful output for me.</p>
Making Bell Internet Stick U727 Work under Debian (Squeeze) Linuxhttp://www.jrichards.ca/posts/making-bell-internet-stick-u727-work-under-debian-squeeze-linux/2013-01-04T04:09:14Z2010-09-12T15:02:41Z
<p><a href="http://www.jrichards.ca/wp-content/uploads/2010/09/bellu727.jpg"><img src="http://www.jrichards.ca/wp-content/uploads/2010/09/bellu727.jpg" alt="" title="bellu727" width="226" height="410" class="alignleft size-full wp-image-471" /></a>I got a mobile internet stick from Bell so that I could have a little internet on the go. And... it works really quite well. The model I got was the Bell U727 made by Novatel. It worked right away under Windows (as expected) but I was really hoping to get it working under Debian Linux as that's my preferred working environment. And so my adventures began... A friend had said that he had got a similar stick working using <a href="http://docs.kde.org/stable/en/kdenetwork/kppp/index.html">KPPP</a>. So that seemed like a good place to start.</p>
<p>After much futzing around with KPPP, I abandoned it on the strength of some <a href="http://www.digitalhome.ca/forum/showthread.php?t=96856">forum encouragement that wvdial is the way to go</a> being the way to go and if you're going to mess around you may as well mess around on the command line.</p>
<h2>How I made WvDial work!</h2>
<p>You need to update the /etc/wvdial.conf file to read as below. Provided that your modem is indeed located at /dev/ttyUSB0, easiest way to find out if that is the case. unplug is, from the command line run "ls /dev/tty*" then plug it in and run the same command and see if what has changed, the new address is new stick. (A lot of people on the Ubuntu forums have mentioned that this device gets mounted as a memory stick and that the mounted memory stick needs to be ejected first, this wasn't the case for me running Debian.)</p>
<p>Here are the settings for the working /etc/wvdial.conf<br />
<code>[Dialer Defaults]</p>
<p>Modem = /dev/ttyUSB0
Username = ''
Password = ''
Phone = #777
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Dial Command = ATDT
Abort on No Dialtone = on
Carrier Check = on
Auto Reconnect = on
Check Def Route = on
Auto DNS = on
Idle Seconds = 0
Stupid Mode = on
Dial Attempts = 1
Ask Password = off</code></p>
<p>then you'll need to close up that file and... at the command line type</p>
<p><code>~$ wvdial</code></p>
<p>Generally I get some output that looks like</p>
<p><code>--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sun Feb 28 09:19:56 2010
--> Pid of pppd: 28980
--> Using interface ppp0
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> local IP address 70.28.210.69
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> remote IP address 68.182.192.100
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> primary DNS address 204.174.120.46
--> pppd: 0[02]n�
--> Q [10]�P [01]
--> secondary DNS address 204.174.120.45
--> pppd: 0[02]n�
--> Q [10]�P [01]</code></p>
<p>and then if I check my connections by typing at the command line</p>
<p><code>sudo ifconfig</code></p>
<p>I see a new entry, ppp0 and there is a small amount of traffic running on it.</p>
<h2>Gotchas</h2>
<p>One possible gotcha I found is that if you attempt this while my wireless is on (not even connected, but just on) it still connects fine but my browser doesn't connect to the internet. The solution for me was to switch the wireless off then run wvdial. I've only had to do this on 1/3 machines that I've set up my Bell internet stick for.</p>
<h2>U727 Performance</h2>
<p>An interesting side note, is that another friend of mine was visiting a fairly remote part of BC and tried a newer model side by side with the U727 and found that the newer model (Sorry I don't know the model). The newer model was unable to maintain a service signal but the U727 worked without problem. I guess the external antenna really does improve reception!</p>
<p>I've used the stick in a number of remote areas where the reception is really quite weak. 1 or two bars on a cell phone and had reasonably good success. Sometimes it is quite slow, but in general it has been perfectly adequate for what I need and in places that aren't remote (one bar of reception areas) its relatively zippy.</p>
Getting Bluetooth Keyboard Working on my Debian eeePChttp://www.jrichards.ca/posts/getting-bluetooth-keyboard-working-on-my-debian-eeepc/2012-07-12T03:52:13Z2010-06-26T15:12:17Z
<p><a href="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-logo1.jpg"><img src="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-logo1.jpg" alt="" title="bluetooth-logo" width="132" height="180" class="alignright size-full wp-image-377" /></a>
Simple problem. I have a bluetooth keyboard, I want to use it at work (Thinkpad T61) and home (eeePC 1001P), both machines running Debian (<a href="http://www.jrichards.ca/2010/06/bluetooth-keyboard-debian-1001P#details">hardware and OS details</a>). I want to find a good way to get this keyboard connected and running full time. Here goes.</p>
<h2>Bluetooth Doesn't Seem To Be Working At All!</h2>
<p>First I install <a href="http://blueman-project.org/">blueman</a>. Start it up, most everything is disabled (greyed out). Ok, why is that?</p>
<p>hmm... maybe hcitool will tell me something different
<code>$ <strong>hcitool scan</strong>
Device is not available: No such device</code></p>
<p>ok... I guess that means there is no device available, check the startup via
<code>$ <strong>dmesg | grep Blue</strong></code>
lots of Bluetooth entries there.</p>
<p>next check the bluetooth kernel module is loaded
<code>$ <strong>lsmod | grep blue</strong>
bluetooth 41795 6 sco,bnep,rfcomm,l2cap
rfkill 13012 4 bluetooth,cfg80211</code></p>
<p>Looks like the module is loaded. Time to Google my error message
<a href="http://forum.soft32.com/linux/Bluetooth-ftopict440233.html">http://forum.soft32.com/linux/Bluetooth-ftopict440233.html</a>
Provides a hint that I need to install the userspace package, in Debian this means
<code>$ <strong>sudo aptitude install bluetooth</strong></code>
that installed a bunch of packages. Trying my tests again
<code>$ <strong>hcitool scan</strong>
(same result)</code>
Blueman (same result)</p>
<p><code>$ <strong>/etc/init.d/bluetooth restart</strong></code>
(maybe it'll help... nope)
Hmmm.. sort of feels like the bluetooth adaptor is turned off. The 1001P doesn't really have a hardware switch that I can see for turning bluetooth on.</p>
<p>Further Googling is talking making me feel like I should really have an entry in the output of lsusb that says something pretty clear about bluetooth, and I'm not seeing that. This really makes me think it isn't on.</p>
<p>I know I shouldn't have to... but I''ll try a reboot to get a fresh dmesg to look at and this laptop has been in and out of suspend a lot, I see that has fouled others up in that past. Nope that didn't help.</p>
<h2>eeePC Gotcha: Bluetooth is Controlled in the BIOS</h2>
<p>Okay, Got a tip from a site that bluetooth on the 1001P can only be controlled via the bios (are you serious!?!) So I boot into the bios and sure enough under Advanced -> Onboard Settings (I think) there is Onboard Bluetooth and it is disabled. Enable that, save and exit. Reboot.</p>
<p><code>$ <strong>lsusb</strong> </code>
now has an extra line in it... promising.
<code>Bus 005 Device 002: ID 0b05:1788 ASUSTek Computer, Inc.</code></p>
<h2>Bluetooth is Working, Now for the Keyboard</h2>
<p>Straight for the throat, starting blueman, YES we have an adapater. Double checking with hcitool.
<code>$ <strong>hcitool scan</strong>
Scanning....</code>
alright!!</p>
<p>Now just to get the keyboard working. Put the keyboard into discovery mode.
<a href="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-keyboard.jpg"><img src="http://www.jrichards.ca/wp-content/uploads/2010/06/bluetooth-keyboard.jpg" alt="" title="Bluetooth Keyboard" width="480" height="240" class="alignnone size-full wp-image-375" /></a>
Into Blueman, and searching for the device. It shows up! Good sign. Attempt to pair with the device. My secret code is requested. I enter it. "1111" (the usual) and I go to the keyboard type "1111" Enter. Looks like we're paired. Uh oh it looks like it disconnected. Hmm... reconnect, which works, and then click on the trust icon. Still connected good, good. Start typing, it's working!! (I'm sure this could all be done from the command line with hcitool as well, I'm not exactly sure how.)</p>
<p>Awesome.</p>
<h2>Testing, The Use Cases</h2>
<p>Now the two remaining tests. At work I'm doing some frustrating hack using
<code>hidd --connect MAC ADDRES GOES HERE </code>
and if I leave the computer for 10-20 minutes the keyboard dies. It totally sucks. Secondarily, if I restart the computer the keyboard isn't connected. Both of these things didn't weren't a problem in the past, but they are now. So let's see if the problem is the same here.</p>
<ol>
<li>Coming back the next morning and it is still working!!</li>
<li>Suspending and restoring and it is still working.</li>
<li>And it even works (with a minor delay after a reboot) in the gdm screen. </li>
</ol>
<p>Hurray!! Complete Success.</p>
<p>Bonus: killing the Blueman applet doesn't kill the connection, I suspected this would be true but just wanted to confirm.</p>
<h2>Bluetooth Files</h2>
<p>I previously had attempted to edit a bunch of files in the /etc/bluetooth/<em> and /etc/default/bluetooth, but none of those files appear changed in this case and the keyboard is working fine. Being curious I snooped around and found that the specific device information related to the connection with my keyboard can be found in /var/lib/bluetooth/</em> but looking at a few of the files. I can see that they are definitely not meant to be editted by hand. AKA leave it to the tools in this case blueman. I'm sure hcitool also refers to and edits these files although I have not confirmed that.</p>
<h2 id="details">Hardware and Operating System Details</h2>
<p></p>
<ul>
<li>Keyboard : Microsoft Wireless Entertainment Keyboard 7000</li>
<li>Debian squeeze (pre stable release) </li>
<li>Linux Kernel Linux 2.6.32-3-amd64</li>
<li>And of course my <a href="http://www.jrichards.ca/2010/03/my-new-eeepc-1001p/">eeePc 1001P</a></li>
</ul>
<p>Now to see if I can get it working on my work computer! Thinkpad T61.</p>
Storing Passwords with GPG and Vimhttp://www.jrichards.ca/posts/storing-passwords-with-gpg-and-vim/2012-07-12T03:52:13Z2009-06-11T05:48:52Z
<p>
Too many passwords these days. Way too many. I've been keeping passwords on kitchen recipe cards ever since the passwords that get handed out at work started to become completely cryptic and beyond my ability to remember them. Which may seem like a pretty insecure way to keep passwords. But, if the bad guys are actually sitting at my desk, I figure I may have bigger problems.
</p>
<p>
Finally, I've decided to take the risk of actually storing my passwords on my computer. I'm not real jazzed about the idea, seeing as how if the hackers get into my machine and then into my password file then I'll really have given them the keys to the castle. But, with way too many passwords, what is the average hacker to do.
</p>
<p>
I work on mostly Debian/Gnu linux systems these days (hurray free software!!). So if you're working on some other operating system this may be completely irrelevant to you. So, for myself and others here's how I've attempted to secure my passwords.
</p>
<h2>Enter GPG</h2>
<p>
GPG is some state of the art encryption techniques are often used to sending encrypted emails. But I found a few people who have used them for encrypting password files. So, this is the technique that I've chosen to follow. To get started you need a private key. At the terminal command line run
</p>
<p><code>gpg --gen-key</code></p>
<p>
I used the defaults for the questions it asked and then entered my details and non-forgettable, non-write-downable passphrase. <a href="http://www.madboa.com/geek/gpg-quickstart/#keyintro">More specific detail on getting started with GPG</a>. Seems too simple, yeah, to me too. That provides a private key with which we can encrypt files. And you can encrypt whatever you would like, but it requires remembering a bunch of command line stuff that I would rather not try and recall, ( <a href="http://www.madboa.com/geek/gpg-quickstart/#personal">more about encrypting files for personal use from the command line here</a>). Note: Once the password file is encrypted it's not necessary to encrypt it by hand again.
</p>
<p>
So I created a new file called memories.txt and then encrypted it by typing on the command line
</p>
<p><code>gpg --encrypt --recipient 'Jeff Richards' memories.txt</code></p>
<p>
This produces a file called memories.txt.gpg. Now the original memories.txt can be deleted. Great! now how to add passwords, view them easily and re-encrypt the file as needed.
</p>
<h2>Vim and GPG plugin - Making Encryption Easier</h2>
<p>At this point, ideally I'd have an encrypted file that I can open with my passphrase, and then read, write and close in an encrypted fashion. Enter vim plus the gpg plugin. Turns out someone has handily figured all this out. NOTE: the standard Debian install comes with vim-tiny. which doesn't support plugins so the first step is to install vim proper (package name: vim).
</p>
<p>
Once that's installed, next step is to install the <a href="http://vim.wikia.com/wiki/Edit_gpg_encrypted_files">gpg plugin file</a>.</p>
<ul>
<li>Grab the <a href="http://vim.wikia.com/wiki/Edit_gpg_encrypted_files">gpg plugin code</a> and save it into a called gpg.vim. </li>
<li>Copy gpg.vim into the /home/your-username/.vim/plugin/ directory</li>
<li>If the directories .vim/plugin/ doesn't exist, create it!</li>
</ul>
<p>And... that's it! try and open the encrypted file with vim, in my case
</p>
<p><code>vim memories.txt.gpg</code></p>
<p>
Enter the passphrase and your in, add and subtract and the file is encrypted when you exit the program.
</p>
<p>
My reading of the vim plugin seems to indicate that there won't be any temp files created or saved anywhere. If anyone has any tips as to why if/how this is a terrible/insecure way to keep passwords, please let me know!
</p>
Installing New Fonts (ttf) in Debian for the your Personal Usehttp://www.jrichards.ca/posts/installing-new-fonts-ttf-in-debian-for-the-your-personal-use/2013-01-04T04:09:14Z2008-12-24T01:38:22Z
<p>Installing fonts into Debian for a single user is easy. Here it is in 3 steps</p>
<h2>Step 1 - The .fonts File Folder</h2>
<p>Looks into your home directory. We're looking for a hidden folder</p>
<blockquote>~/.fonts</blockquote>
<p>If you already have this folder then you can go to step 3, if not...</p>
<h2>Step 2 - Making the .fonts File Folder</h2>
<p>Open up your terminal go to your home folder and make the the .fonts file folder (this can also be done in the file manager of your choice)</p>
<blockquote>mkdir ~/.fonts</blockquote>
<p>you can check to see if it is there using</p>
<blockquote>ls -a ~</blockquote>
<p>See it there? Good! Time for ...</p>
<h2>Step 3 - Copying your font files (.ttf) into the .fonts file folder</h2>
<p>This can be done either on the command line or in your file manager of choice.</p>
<h2>You're Done</h2>
<p>That's it! If you open up an application that let's you choose your font, you should see your newly installed font. I can attest this works in OpenOffice and in GIMP.</p>
<p>As an example, <a href="http://www.ecofont.eu/ecofont_en.html">try installing ecofont</a> and save the world/your money by using less ink on your print outs.</p>
Samba Permission Denied Messagehttp://www.jrichards.ca/posts/samba-permission-denied-message/2012-07-12T03:52:13Z2007-03-28T22:13:22Z
<p>I run smbclient -L <hostname>
I see all the shares but when I try to actually get a directory listing I get a permission denied error. Grrr..</p>
<p>The solution from [url=http://gentoo-wiki.com/HOWTO_Setup_Samba]http://gentoo-wiki.com/HOWTO_Setup_Samba[/url]
I get a Permision denied message trying to access a Windows 2000, XP, 2003: Make sure you have Guest account enabled on Windows machines and Guest have sharing permissions over the shares. Sometimes this is not trivial due to the permissions editing of a carpet is not shown by default in some Windows systems. If it is enabled, right click on the share, pick up the Permissions section and add Guest user with the appropriate rights (probably full control full control can be security risk. "Modify" provides read/write and create/delete without the more dangerous abilities).</p>
<p>And now I can the website backed up. yay</p>
ATI Drivers and kernel 2.6.20http://www.jrichards.ca/posts/ati-drivers-and-kernel-2-6-20/2012-07-12T03:52:13Z2007-03-24T00:18:39Z
<p>You can't make the required kernel module with the sources from ATI and to get your driver up and running. Ugh... how long did it take to find that out.</p>
<p>However you can install the .deb files that you can get from ATI
cd /usr/src/
tar xjf fglrx-tar-bzr
cd /usr/src/modules/fglrx</p>
<p>then get the patch from [url=http://darcs.frugalware.org/repos/frugalware-current/source/x11-extra/fglrx/fglrx-2.6.20.patch]http://darcs.frugalware.org/repos/frugalware-current/source/x11-extra/fglrx/fglrx-2.6.20.patch[/url]</p>
<p>run the patch using the command
patch < /path/to/fglrx-2.6.20.patch</p>
<p>and then compile the modules using following steps of 4.1c here
[url=http://www.stanchina.net/~flavio/debian/fglrx-installer.html]http://www.stanchina.net/~flavio/debian/fglrx-installer.html[/url]</p>
<p>Lord bless the smart people that figured all this out!</p>
glxgears frameratehttp://www.jrichards.ca/posts/glxgears-framerate/2012-07-12T03:52:13Z2007-03-24T00:15:45Z
<p>From
[url=http://www.readingboy.com/]http://www.readingboy.com/[/url]</p>
<p>glxgears</p>
<p>You see people using the program to test the framerate (FPS) of their ATI cards. trying to spot imporvements... well the newest version. requires this switch</p>
<p>$ glxgears -iacknowledgethatthistoolisnotabenchmark</p>
<p>to output the fps.</p>
<p>Haha, you gotta love when people are that careful.</p>
Getting the Extra Laptop Buttons Workinghttp://www.jrichards.ca/posts/getting-the-extra-laptop-buttons-working/2012-07-12T03:52:13Z2007-03-22T16:42:28Z
<p>So I wanted the laptop volume buttons to work...</p>
<p>Turns out it is easy. In Gnome go to Desktop --> Preferences --> Keyboard Shortcuts</p>
<p>Then find the function you want to control, click on it, and then click on the laptop button that you want to control it.</p>
<p>And now it works. yaya.</p>
WE have soundhttp://www.jrichards.ca/posts/we-have-sound/2012-07-12T03:52:13Z2007-03-14T02:57:55Z
<p>Gah Finally after reading what seems like hundreds of help lists and all that I finally found the problem with my Gateway 7515 laptop sound. Sound card is an ATI IXP card with built in modem.</p>
<p>To make a long story short all that I needed to do was go to the alasmixer and mute the External Amplifier.</p>
<p>Bango, it worked.</p>
<p>Now if only the ocean glider I am working on would come to the surface and call home...</p>