Monday, May 9, 2011

Grub managers

Recently I have been using Grub Customizer for my Grub configuration. I used to use StartUp-Manager, but parts of it didn't work in Ubuntu 10.04. Grub Customizer had more options and did what I needed.


Grub Customizer
https://launchpad.net/~danielrichter2007/+archive/grub-customizer

After following steps for adding the PPA to your system, install with:
sudo apt-get install grub-customizer
Run it by going to Applications > System Tools > Grub Customizer


StartUp-Manager

Install with:
sudo apt-get install startupmanager
Run it by going to System > Administration > StartUp-Manager

UNetbootin and USB persistence

From http://unetbootin.sourceforge.net/diskimg/readme.txt...

Go to http://unetbootin.sourceforge.net/diskimg/ and download one of the files (128mb.zip, 256mb.zip, or 512mb.zip) corresponding to the amount of persistent space you want (make sure the size of the persistent disk image is smaller than the free space you have on your USB drive).

Now extract the file "casper.rw" from the zip file to your USB drive.

Now edit D:\syslinux.cfg (assuming D:\ is where your USB drive is) and add in "persistent" at the end of the line that begins with "append", and save the file, so your syslinux.cfg should look something like this:

default unetbootin
label unetbootin
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash persistent --


For more info see https://help.ubuntu.com/community/LiveCD/Persistence

Mouse acceleration too high in Ubuntu 10.04

One day my mouse was moving waaay too fast - no idea what caused it. Changing mouse settings in System > Preferences > Mouse did not slow it down enough, so I had to find a different method.

Open the terminal and type:
xinput --list --short

Find the name of your device. Mine was Areson USB Device.

Set the constant deceleration (a value to 2 worked best for me):
xinput --set-prop "Areson USB Device" "Device Accel Constant Deceleration" 2

To run this command at startup, create a script (mouseAccel.sh):
#!/bin/sh
xinput --set-prop "Areson USB Device" "Device Accel Constant Deceleration" 2


Set permissions to make it executable:
$ chmod +x mouseAccel.sh

Add it to System -> Preferences -> Startup Applications

Samba setup in Ubuntu 10.04

Things I wanted to accomplish:
- Share files on internal Harddrives
- Share files on external USB Harddrives that are frequently disconnected

I tried NFS first, but for whatever reason, it was slow and frequently caused the PCs to freeze if shares were not unmounted prior to being disconnected. Samba has been much more forgiving.

Folder sharing
To share a folder, right-click on it and select Sharing Options. If you're not setup for sharing, it will prompt you to install some packages. Change the share name if it complains that it already exists.

External USB Harddrive sharing
Instead of sharing the actual harddrive, I created a symbolic link in my home folder to /media for USB harddrives that were frequently disconnected.

Samba is not setup to follow symbolic links by default, so this must be enabled. Add to /etc/samba/smb.conf in [global] section:
follow symlinks = yes
wide links = yes
unix extensions = no

Restart samba via the terminal:
$ sudo restart smbd
Quirks
  • Using shares-admin doesn't show shared folders...
  • Looking at smb.conf doesn't show shared folders...
  • Sometimes folders don't show as being shared in nautilus, but they are...

Sound not working in Outgun

In Ubuntu 10.04 sound was not working in Outgun. The fix that worked was one I came across when having sound issues with Skype.
  1. "...edit or create the file ~/.pulse/client.conf and add a line containing "autospawn = no" there..."
  2. Restart (maybe log out/in works?)

This fixed the sound problem but created new problems:
  • Audio controls on the keyboard no longer worked
  • Volume slider in the panel no longer worked
  • System > Prefs > Sound no longer worked

After some toying around, I found that pulseaudio could be disabled / enabled without having to restart or log out. I put together a script that disables pulseaudio, runs Outgun, and then restarts pulseaudio after the game is shut down.
 
The script doesn't entirely make sense to me. Creating the client.conf file wouldn't be necessary I would think, especially right before killing pulseaudio. But the sound fix didn't work otherwise.
 
#!/bin/bash
# create client.conf file
cd ~/.pulse
echo "autospawn = no" > client.conf
# kill pulseaudio
pulseaudio -k

# run outgun
cd ~/outgun_1.0.3_r336
./outgun

# remove client.conf file
cd ~/.pulse
rm client.conf

# restart pulseaudio
pulseaudio --start

Sunday, May 8, 2011

Some Skype sounds don't work in Ubuntu 10.04

At one point I had problems with the sounds in Skype on Ubuntu 10.04. Some worked, others did not. I could play them in VLC just fine, but not in Skype. Right now running Skype 2.2.0.25, these problems seem to have disappeared. Below is what I did previously to work around this problem.

Official Skype fix here
  1. "...edit or create the file ~/.pulse/client.conf and add a line containing "autospawn = no" there..."
  2. Restart (maybe log out/in works?)

This solved the Skype sound problem but created new problems:
  • Audio controls on the keyboard no longer worked
  • Volume slider in the panel no longer worked
  • System > Prefs > Sound no longer worked
I tried playing a dvd and some mp3s, and they worked just fine. Overall I didn't like this option because it took away a lot of the control I had over my sound. If you go this route, you can install gnome-alsamixer for sound settings. sudo apt-get install gnome-alsamixer
My workaround
  1. Don't do the fix outlined above
  2. Create bash scripts that play the desired sound using vlc or other software
  3. Go into Skype Options, Notifications, find desired sounds
  4. Disable the sound playing for each
  5. Enable the script for each
CallRingingIn.sh example script #!/bin/bash
# Incoming call, play and quit
vlc --play-and-exit /usr/share/skype/sounds/CallRingingIn.wav

ContactOnline.sh example script #!/bin/bash
# Contact comes online, plays twice and quits
vlc --play-and-exit /usr/share/skype/sounds/ContactOnline.wav vlc --play-and-exit /usr/share/skype/sounds/ContactOnline.wav

Don't forget to change permissions so each script is executable $ chmod +x CallRingingIn.sh

Trisquel On A Sugar Toast - USB startup disk with persistence

I tried installing Sugar in Ubuntu 10.04, but according to the official wiki, there are issues. So instead I was using a live CD. This was OK, but all changes were lost after a reboot. I was pleased to find an easier and more flexible solution: a Sugar USB startup disk with persistence.

1. Download the ISO
http://wiki.sugarlabs.org/go/Trisquel_On_A_Sugar_Toast#Download
Currently Sugar 0.86.2 with the Fructose and Honey activities built on top of Trisquel 3.0 (based on Ubuntu 9.04).

2. Use Virtualbox to launch the OS.

3. Create a USB startup disk.
The official instructions say to open the terminal and type usb-creator, but that command doesn't exist. It's usb-creator-gtk.

4. Using the GUI, create the startup disk.
Insert your USB stick before or after running usb-creator-gtk, it doesn't matter. Make sure to specify how much space you want to use for saving files / settings. Creating the startup disk will take a few minutes. If there are existing files on the disk, they won't be erased.

5. Additional tweaks:
The default timeout at the main boot menu is 30 seconds. I like to change this to something smaller to speed up the boot process. Boot into your regular OS, insert the USB stick and edit /syslinux/syslinux.cfg. Find the line: TIMEOUT 300 and change it. I set mine to 20 which is 2 seconds.

6. Reboot using the USB stick.
Make any changes / updates you want. One thing I noticed was that the sound was muted by default, so make sure to turn it on. Move the mouse to a corner, then click the speaker icon in the lower right.

7. Backup the persistence file
I like to create a backup copy of the persistence file in the case that I want to revert back to my "default" settings or create another USB stick. In your OS of choice, backup the casper-rw file from the USB stick.
A final observation: delete journal entries if an application is slowing down or having issues. This was the solution when Physics started becoming very slow after a lot of shapes were added and existed somewhere offscreen.

Saturday, May 7, 2011

Getting my iPod touch to work with gtkpod

After upgrading my iPod touch to iOS 4.2.1, it didn't mount at all in Ubuntu 10.04. I found help here, and got the device to mount again.

However, gtkpod still did not detect it. Ubunut's help mentioned ifuse, but this blog provided the walkthrough I needed.

I installed ifuse:
$ sudo apt-get install ifuse
Created a folder for mounting the iPod, changed permissions:
$ sudo mkdir /mnt/ipod
$ sudo chmod 777 /mnt/ipod

Mounted the iPod
$ ifuse /mnt/ipod
And it worked! gtkpod detected my iPod touch and I was off and running.

When finished, "unmount" the ifuse mount with:
$ fusermount -u /mnt/ipod

As I didn't want to have to manually run ifuse / fusermount each time I ran gtkpod, I created a script to do this for me and saved it as gtkpod.sh:
#!/bin/bash

# mount using ifuse
ifuse /mnt/ipod

#run gtkpod
gtkpod

# unmount
fusermount -u /mnt/ipod

At a command prompt, change permissions on the file so it can be executed:
$ chmod +x gtkpod.sh
Then, you can either run the script via command line by running:
$ ./gtkpod.sh
Or, create a launcher on the desktop that runs the script (my preference).

Converting videos for iPod touch using Handbrake

I use Handbrake because:
  1. It can convert DVD, flv, avi, m4v, mp4, etc.
  2. It has an iPhone & iPod Touch preset.
  3. It supports multiple CPU cores, so conversions are quick (if you have multiple cores :)
After conversion, copy files to the iPod.
Method 1
Use gtkpod to copy / sync. Copying a 40 MB file took about 1 minute.
Method 2 (preferred)
Copy files to the iPod using Nautilus and and copy the videos to the Videos folder. Copying a 40 MB file took about 10 seconds.
The only downside to using Nautilus to copy the videos is that they don't show up in the Movie Player! So, I use iFile to locate and open the videos. Click Video Player when it asks how you want to open the file.

MP4Box for trimming m4v videos

I had some H.264 m4v videos that I wanted to trim.

I used Avidemux a while back for trimming some xvid avi videos, but trying to trim the H.264 m4v videos didn't work. The cuts would work, but the video would be slightly jerky (using Copy). Re-encoding the video did work, but the whole point was to losslessly cut the video to save time & quality.

I tried using ffmpeg to trim the videos, but I could never get the -t flag to work. I came across a few other posts of other people having the same problem.

Then I found MP4Box, and it worked. (It's part of the gpac package).

This example extracts a new file starting at 0 and ending at 267.8 seconds.
MP4Box -splitx 0:267.8 input.m4v -out output.m4v
Notable commands from the manual that might be handy later:
-split time_in_seconds
splits in files of desired maximum duration. This will remove
all MPEG-4 Systems media.

-splits size_in_kilobytes
splits in files of desired maximum size. This will remove all
MPEG-4 Systems media.

-splitx start:end
extracts a new file from specified start to end times (in sec‐
onds). This will remove all MPEG-4 Systems media. When input
file is an ISO-Media file (QT, MP4, 3GP), if no output is speci‐
fied THE INPUT FILE IS OVERWRITTEN.


-cat <src_file>
concatenates all src_file tracks to input file, creating it if
not exisiting. Media samples are added at the end of existing
compatible tracks. If no compatible track is found for a media
it is created. Up to 20 cumulated -cat operations can be used.
Syntax is the same as -add.