Nick's Tech Blog: ubuntu

Pages

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, December 17, 2014

ZFS folders on Ubuntu 14.04 LTS not mounting after reboot

Problem

On Ubuntu 14.04 LTS, I installed a ZFS ZPOOL following these instructions.

After a restarting my machine however, the zpools failed to mount. I couldn't see any apparent errors from checking the logs.

Solution


Attempt #1


Executing the following command actually mounts the zpool as desired. We could execute this script on startup (but we shouldn't have to).
zpool import -a

Attempt #2


Apparently setting/adding the following properties automatically mounts the zpool. This didn't work for me (my version of zfs).

File: /etc/default/zfs
ZFS_MOUNT='yes'
ZFS_UNMOUNT='yes'

Attempt #3


Other solutions suggest adding a sleep to the following file:

File: /etc/init/mountall.conf

I didn't even bother trying this though.

Attempt #4 (Success)


I came across the following zpool config file, and tried changing the value for zfs_autoimport_disable from 1 to 0.

File: /etc/init/zpool-import.conf
modprobe zfs zfs_autoimport_disable=0

After a restart, my zpools were imported (success!). Then, to automatically mount the zfs mounts, I had to add the following line:

File: /etc/rc.local
zfs mount -a
Not sure why this value is defaulted to 1, but changing it to 0 worked for me.

Thursday, February 28, 2013

Plex on Ubuntu > can't access home directory

Problem

After installing plex media server, I went to add some media libraries. I couldn't see any directories under my home directory.

Solution - Difficulty: Very Easy

The "plex" user account doesn't have permission to view any directories under your home directory. In addition, if there are any subdirectories it can't view, rather than show the directories it can, it shows nothing.


First of all, lets give it access to your home directory:

nick@pc:~$ ll -d ~
drwx------ 89 nick nick 28672 Feb 28 19:21 /home/nick/
nick@pc:~$ sudo chmod 755 ~
nick@pc:~$ ll -d ~
drwxr-xr-x 89 nick nick 28672 Feb 28 19:21 /home/nick/

Because I still can't add my media library plex, I'm going to "pull out" just the folders I want plex to use, into it's own home directory (using symbolic links).

nick@pc:~$ sudo mkdir /home/plex
nick@pc:~$ sudo chown plex:plex /home/plex
nick@pc:~$ sudo ln -s /home/nick/Music /home/plex/Music
nick@pc:~$ ll /home/plex
total 8
drwxr-xr-x 2 plex plex 4096 Feb 28 20:23 ./
drwxr-xr-x 5 root root 4096 Feb 28 20:22 ../
lrwxrwxrwx 1 root root   16 Feb 28 20:23 Music --> /home/nick/Music/

And there you have it. You should now be able to add "/home/plex/Music".


Additional Troubleshooting:

If you want to test what directories the "plex" user account can access, you can become the "plex" user by typing:

nick@pc:~$ sudo su plex

Navigate around, do some troubleshooting. To exit back to your own account, just type "exit".

Tuesday, August 21, 2012

Ubuntu lightdm login screen!

Problem

You want to customise your login screen.

Solution

Checkout lightdm "greeters". Below is an example of "crowd-greeter".



Instructions to install it can be found here:
http://www.iloveubuntu.net/lightdm-receives-new-experimental-3d-character-based-greeter-ubuntu-1110

I haven't found a single site which lists available greeters. Thanks go to Robert Ancell for this list of greeters:

See also:
"SO YOU WANT TO WRITE A LIGHTDM GREETER…" - http://www.mattfischer.com/blog/?p=5

Friday, August 17, 2012

Use sed to remove '^M' characters from a file

Simple stuff, this post is here more as a reference than anything.

Problem

Windows puts '^M' characters throughout text files. I want to remove them.

Solution

The following commands will strip out the '^M' characters, and put the contents into a new file, then overwrite the original file.
sed -e s/^M//g oldfile.txt > newfile.txt
mv newfile.txt oldfile.txt
To get the '^M' character, type Ctrl+V,Ctrl+M

Friday, June 15, 2012

Ubuntu > dragging windows to desktop sides not working

Problem

Basically, dragging windows to sides of the screen isn't readjusting the window size to half the screen.

(I later found out this feature was called "window grid".)

Solution

I'm reposting the solution, because it worked.

In the terminal...
  1. compiz --replace & disown
  2. (I then needed to logout and log back in, as none of my windows were responding)
  3. unity --reset
That should be it, windows now snap to half the screen, when dragged to the sides of the desktop.

See Also

Thursday, September 29, 2011

Ubuntu > Display notifications over the screensaver

I'm currently playing around with notifications, and I'm trying to "keep" notifications displayed above the screensaver, so that I can see if I've got new mail or an IM from afar, without having to unlock my pc.

Basically the opposite problem to these:
http://www.jwz.org/xscreensaver/faq.html#popup-windows
http://www.google.com/search?q=notifications+over+screensaver+ubuntu

I'm using a command similar to the following, to display messages with an infinite timeout:
Code:

$ notify-send -t 0 -i info "You've got mail" "mailbox (123)"

Currently notifications get displayed temporarily "above" the xscreensaver, but eventually xscreensaver will "raise" itself above the notification (e.g. after a minute or two).

Here are my options, as I see it currently:

1) Download the xscreensaver's source code, modify it to prevent it raising itself above the notifications, build and install it (painful... I've managed to build it from the source, but I don't know what I should be modifying.)

2) Write my own custom screensaver (not really path I want to take, when I already have a notification and screensaver framework).

Are there any other (easier) options I've missed? Can anyone help?

(There's an argument that nothing should be displayed over the top of screensavers... )

Some context:
Ubuntu 11.04
Unity
notification-daemon/natty uptodate 0.5.0-2ubuntu1 (better functionality than notify-osd - i.e. click to close, vertical stacking, customisation...)
xscreensaver/natty uptodate 5.12-0ubuntu3 (more customisable than gnome-screensaver).

See also:

The same question, posted on the ubuntu forums:
http://ubuntuforums.org/showthread.php?p=11292893#post11292893

Traceback to a thread, on customising notify-osd notifications:
http://www.webupd8.org/2011/05/configurable-notifyosd-bubbles-for.html#dsq-comment-199829486

Another alternative to notification-daemon and notify-osd is avant-window-navigator 
http://maketecheasier.com/2-ways-to-make-ubuntu-notification-more-user-friendly/2011/05/21

Unfortunately, this is the closest solution I've found to notifications whilst the screensaver is running (checkGmail lights up the scroll lock key on the keyboard).
http://ubuntuforums.org/showthread.php?t=1564412

Wednesday, September 28, 2011

Ubuntu > Compiling package/s from source

Just putting together a quick "cheatsheet" for compiling and installing a package from it's source code.

Start here: (it's all here and it's very simple...)
https://help.ubuntu.com/community/CompilingSoftware
https://help.ubuntu.com/community/CompilingEasyHowTo

Pre-requisites:
sudo apt-get install build-essential checkinstall

Optional - to assist in retrieving the source code:
sudo apt-get install cvs subversion git-core mercurial

By convention, put source code under here (extract the source if it's in a zip, tar.gz, etc):
/usr/local/src

From the root of the source code:
./configure

Resolve any missing dependencies:
sudo apt-get build-dep <package>
apt-file search <your-missing-file.h>


Build the code:
sudo make

Package the code into a *.deb:
sudo checkinstall

Install the code directly:
sudo make install

Clean up:
sudo make clean
sudo make distclean


Thats it, nothing ground breaking. Please let me know if there's anything else I've missed.

See also:
http://www.gnu.org/software/make/manual/make.html#Complex-Makefile

Monday, September 26, 2011

CFEngine > Scalar item in package_list_command => { ls } in rvalue is out of bounds (value should match pattern "?(/.*))


Problem

Whilst validating a cf-promises file, I received the following output.
$ cf-promises -f ./promises.cf
cf3> ./packages.cf:23,28: Scalar item in package_list_command => { ls } in rvalue is out of bounds (value should match pattern "?(/.*)), near token 'ls"'


The associated line is:
package_list_command => "ls -1 /your/directory"

Solution

Basically, the error is trying to tell us that the "ls" command must be fully qualified.

The associated line should read:
package_list_command => "/bin/ls -1 /your/directory"

Thursday, September 22, 2011

Ubuntu > Filter directory /usr/lib/cups/filter for printer "<yourprinter>" is not owned by root.

Problem

You receive the following error status message for a printer, once it is installed (e.g. in the "Print" window).

Filter directory /usr/lib/cups/filter for printer "" is not owned by root. 

You may also see "cups-insecure-filter". 

Solution

Execute the following commands, to change ownership back to root. 

  1. sudo chown -hR root:root /usr/lib/cups/filter/* 
  2. sudo chown -hR root:root /usr/lib/cups/backend/* 
  3. service cups restart 

Your printer should now no longer display the message. (May require closing and reopening the "Print" window). 

See also:
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/436544

Friday, September 16, 2011

Ubuntu > Install Canon Pixma MX870 i386 drivers on amd64

Problem

Canon only provide i386 drivers for the PIXMA MX870 All-In-One Printer on their Australian website.

These work fine with amd64, but just need the scripts to be tweaked to allow it (very easy to do).

Solution

Ensure you have the latest versions for the following applications:

$ apt-show-versions | grep -E "libcups2|libcupsys2|libc6|libpopt0"
e.g.
libc6/natty uptodate 2.13-0ubuntu13
libc6-dev/natty uptodate 2.13-0ubuntu13
libc6-i386/natty uptodate 2.13-0ubuntu13
libcups2/natty-security uptodate 1.4.6-5ubuntu1.4
libpopt0/natty uptodate 1.16-1


Follow these steps:
  1. Download the MX870 series IJ Printer Driver Ver. 3.30 for Linux (debian Packagearchive)
  2. Extract the cnijfilter-mx870series-3.30-1-i386-deb.tar.gz into a directory
    1. Nautilus > right-click > Extract Here
    2. Command line > tar -xvzf cnijfilter-mx870series-3.30-1-i386-deb.tar.gz -C /your/target/dir
  3. Comment out the "i686" lines in the <extracteddir>/install.sh, as per the instructions here.
  4. Update all <extracteddir>/packages/*.deb packages by running repackage.sh (see below), and removing the line beginning with "Dependency: ..." during the "vi" step.
    1. e.g. ./repackage.sh <package>.deb
  5. Run <extracteddir>/install.sh


repackage.sh
#!/bin/bash
PACKAGE=${1}
dpkg -x $PACKAGE common
dpkg --control $PACKAGE
vi DEBIAN/control
cp -a DEBIAN/ common/
dpkg -b common $PACKAGE
rm -rf common DEBIAN


See also:
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/701856/comments/20
http://ubuntuforums.org/showthread.php?t=1475336

Wednesday, September 14, 2011

Ubuntu Unity > remove Rhythmbox from the sound menu

Problem

Ubuntu 'Natty' 11.04
There's no (obvious) way to remove rhythmbox from the sound menu in unity.

Solution

According to the documents on the ubuntu wiki, rhythmbox must be removed by using gsettings. Execute the following in your console:

gsettings set com.canonical.indicator.sound blacklisted-media-players "['rhythmbox']"

See: https://wiki.ubuntu.com/SoundMenu#Music_player_integration

Install Java Plugin on Ubuntu Firefox

Current as of: 14 Sept, 2011

Versions
Ubuntu 'Natty' 11.04
Firefox 6.0.2
Sun Java6 Plugin

Add the 'universe' software source
  1. Open the "Ubuntu Software Center"
  2. In the menu, navigate to Edit > Software Sources...
  3. (Enter administrator password)
  4. Other Software > Add
  5. Enter "deb http://archive.canonical.com/ubuntu natty universe" in the apt line
  6. Click "Add Source"
  7. Check that "Canonical Partners universe" entry has been added.
  8. Click "Close"

Install the java6 plugin
Back in the "Ubuntu Software Center" window...
  1. Navigate to "Get Software" and search for "sun-java6-plugin"
  2. It should now return an entry for "sun-java6-plugin"
  3. Click "Install"

It's that simple. Once complete, you should now be able to start/restart firefox and the java plugin will be installed.

You can optionally check, that the following symbolic link has been created.
/usr/lib/mozilla/plugins/libjavaplugin.so -> /etc/alternatives/mozilla-javaplugin.so

Tuesday, August 23, 2011

Linux > tag files in a directory by directory name

Work in progress...


#!/bin/bash
#
# "tagdirs.sh"
#
# Simple script which iterates over the first level folders in a given directory,
# and tags the files in those subdirectories with the parent folder's name.
#
# Usage: ./tagdirs.sh
#
# N.B. Requires 'tracker-tag'.
#

# The folder to iterate over.
FOLDER=$1

# Check param is a directory...
if [ -d "${1}" ] ; then
echo "Processing directory '${1}'..."
else
echo "Error: bad argument. Expected a valid directory name for the first argument"
echo "Bad directory name = ${1}"
exit 1
fi

(
IFS=$'\n'
# For each directory...
for dir in $(find $FOLDER -maxdepth 1 -mindepth 1 -type d); do
# Strip directory to folder name only...
tag=${dir##*/}
# For each file in the directory...
for file in $(find $dir -maxdepth 1 -mindepth 1 -type f); do
echo "Adding tag '${tag}' to file '${file}'...";
tracker-tag --add="${tag}" "${file}"
done
done
)

exit 0

Monday, August 22, 2011

Stream content from Ubuntu to an Xbox360

Problem

I wanted to setup Ubuntu (11.04), so that I could access content from an Xbox360 using DLNA

Solution

  1. Open "Ubuntu Software Center" and install "rygel"
  2. Also install the additional "Tracker plugin" (only)
  3. Follow the steps under Helper Scripts (requires sqlite3)
Rygel can now be started from the terminal by executing "rygel".
    Movies/Pictures/Video's tagged in nautilius will be displayed (right click on the file and tag).

    See also:
    http://live.gnome.org/Rygel
    http://en.wikipedia.org/wiki/Digital_Living_Network_Alliance

    Installing Netgear WG311v3 Wireless Network Card on Ubuntu 11.04 amd64

    Problem

    The Netgear WG311v3 Wireless Network Card driver isn't automatically installed by Ubuntu 11.04.

    Solution

    1. Download and extract the custom driver from the following website.
    2. Open "Ubuntu Software Center" and install "ndiswrapper" (i.e. Windows Wireless Drivers)
    3. Open "Windows Wireless Drivers", and install the "WG311v3.INF" driver.
    4. Save and close.
    Give the system a couple of seconds, and it should recognise your wireless card. And thats it.

    See also:
    https://help.ubuntu.com/community/WifiDocs/Device/Netgear_WG311_v3