Category Archives: Ubuntu

Rotate Android Videos in Ubuntu

It seems that if I don’t have my phone angled just so, it will invisibly rotate my video.  The rotation at the beginning of the film is what is used throughout, so if you think you have it horizontal and it turns out your first frame was vertical the entire film is then vertical.  And you won’t realize this until you attempt playback.

There are probably a million and one ways to fix the video rotation.  Unfortunately none of those are built into the phone.  I downloaded the video onto my laptop (running Ubuntu 16.04).

Most of the advice I found was to use a program called Avidemux.  I have used it in the past to change audio or video codices or move a video into a different container/wrapper (to mkv for example), and I have found it useful enough.  However, it would appear that Avidemux is no longer present in the usual Ubuntu repositories as both apt and the Ubuntu Software Center did not find it.

I poked around and found a pretty simple command line rotation solution using ffmpeg here.  I tried the version of the command in the response, but encountered an error:

[aac @ 0x6cf380] The encoder ‘aac’ is experimental but experimental codecs are not enabled, add ‘-strict -2’ if you want to use it.

Since my phone uses aac (apparently) I needed to add the -strict -2 in order to enable an experimental encoder.  So metal!

ffmpeg -i Desktop/VID_20161008_144216.mp4 -vf “transpose=2” -strict -2 Desktop/VID_20161008_144216_rotatecc.mp4

It worked great.  The response offers some other rotation options, but of course the man page for ffmpeg is extensive.

Share

Notes from Possible cifs-utils Bug

Here follow my testing notes concerning a problem which has arisen in the way file shares are being accessed from various Ubuntu client machines.  I am listing behaviors for both the “Connect to Server” function (via Nautilus) and those involving the mount command (especially via the fstab file).

Files and folders used to be accessible and they now are not.  These notes will help determine the exact cutoff point for the failures, though sussing out those points could be exacerbated if there are multiple causes for the errors.

The test scenario is as follows.  There is an Ubuntu server (which happens to be running 10.04 though this is not critical at present).  This Ubuntu server has multiple shares.  Various files and folders within these shares contain (at least) two known effected characters:  the colon (:) and the question mark (?).

When those locations are mounted by mount (whether via fstab or no) using a 12.04 client machine the files and the folders which contain either (or both) of those characters in their respective paths are accessible as would be expected for any such file share.

(It is of interest to note that for this particular Samba configuration, the server is not using “mangled names” (mangled names = no).  Enabling mangled names would eliminate the characters in question and thus make testing irrelevant.)

Below you will find testing results for Nautilus and mount (for each character tested) as well as version information for cifs-utils (used by mount).

(I have tested Nautilus to help eliminate server issues as a concern, but as you will see there appears to be an issue with Nautilus as well.  For my purposes, I am testing with an eye toward fixing the problem with mount and fstab.  Perhaps after I have managed that I will look again at the Nautilus problem.)

Finally, I am not a developer.  I will be doing all the testing I am able and I will file the appropriate bug reports.  I would also work with developers to perform any testing as might prove useful.

From /etc/fstab:

//server/share    /media/share        cifs    guest,iocharset=utf8 0 0

Ubuntu 12.04

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders and files function as expected
    • : folders and files function as expected
  • apt-cache policy cifs-utils:
    • Installed: 2:5.1-1ubuntu2
      Candidate: 2:5.1-1ubuntu2
      Version table: 2:5.1-1ubuntu2 0
      2:5.1-1ubuntu1 0

Ubuntu 14.04.5

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.0-1ubuntu2
      Candidate: 2:6.0-1ubuntu2
      Version table: 2:6.0-1ubuntu2

Ubuntu 14.10

** 14.10 is out of service and thus I cannot download cifs-utils.

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ?
    • :
  • apt-cache policy cifs-utils:
    • Installed:
      Candidate:
      Version table:

Ubuntu 15.04

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, open but empty; files play
    • : folders show “0 items”, open but empty; files play
  • apt-cache policy cifs-utils:
    • Installed: 2:6.0-1ubuntu2
      Candidate: 2:6.0-1ubuntu2
      Version table: 2:6.0-1ubuntu2 0

Ubuntu 15.10

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.4-1ubuntu1
      Candidate: 2:6.4-1ubuntu1
      Version table: 2:6.4-1ubuntu1 0

Ubuntu 16.04.1

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.4-1ubuntu1
      Candidate: 2:6.4-1ubuntu1
      Version table: 2:6.4-1ubuntu1 500

Ubuntu 16.10

  • Connect to Server (Nautilus)
    • ? folders function as expected; files do not show at all
    • : folders show “- -“, throw error when opened; files error
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, empty folder icon when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.5-2ubuntu1
      Candidate: 2:6.5-2ubuntu1
      Version table: 2:6.5-2ubuntu1 500

And that is that.  We shall see where this takes me.  Thanks for reading.

Share

Date Display in Ubuntu

Don’t like the normal date display in Ubuntu?  It can be slightly modified using the usual methods, but if you want full customization you can do so with a tool called the dconf Editor.  It’s a part of the dconf-tools package:

sudo apt install dconf-tools

Once you have it installed you can then run the dconf Editor.  To create your own custom display for the time and date, dig down to this location:

Com –> Canonical –> Indicator –> Datetime

Change the time-format to “custom” and enter your desired pattern.  I used this:

%a %d %b %H:%M

or

| %a %d %b %Y | %H:%M |

or

| %Y-%m-%d %a | %H:%M |

Feel free to experiment with other variables.  This first configuration gives me day date month 24-hour:time.

Have fun with that.

Share

Clementine DB Error (crashes)

I was having some trouble starting Clementine this morning.  This came after I initiated a reboot.  Reboots and further attempts to start Clementine all ended in Clementine crashing.  Something was seriously misaligned.

I started it from the command line (by typing clementine and hitting Enter).  This also resulted in a crash but did give some interesting output in the Terminal.  Near the end I found this information in an error:

CREATE TABLE directories (  path TEXT NOT NULL,  subdirs INTEGER NOT NULL)

A quick search found this article which did have a viable solution.  It is a rather heavy-handed solution and I do not recommend it unless nothing else works.

Instead I modified that solution into one which didn’t delete all of my playlists and configuration changes for Clementine.  First I simply moved the entire Clementine configuration folder (similar to their deletion except I still have the files):

mv ~/.config/Clementine ~/.config/Clementine_old

Starting Clementine in the usual manner now worked.  So the theory was sound.  Now I wanted to see if I could get my database back.  I closed Clementine and ran this command:

mv ~/.config/Clemetine_old/clementine.db ~/.config/Clementine/clementine.db

When I launched Clementine again I had my database back (including all of my playlists).  Next I wanted to see if I could keep my old configuration file so I again closed Clementine and ran this command:

mv ~/.config/Clementine_old/Clementine.conf ~/.config/Clementine_old/Clementine.conf

This also worked.  So it would appear that it was perhaps not file corruption (as the article linked above suggests) but rather something more subtle and complex.  Regardless, at this point I was satisfied with the success of my fix, but my scientific curiosity was wondering about the other files.  Altogether there were six files in the Clementine configuration folder:

Clementine.conf
clementine.db
clementine.db-journal
clementine.db.bak
clementine-scope-backup.db
jamendo.db

(The clementine.db-journal file may not be present on all systems.)

I have no idea what those other four files do (well, except the jamendo.db folder which is presumably the database if one uses Jamendo through Clementine), but I tried moving each one back into the main folder one at a time (restarting Clementine between each one).  None of them had any effect.  This further supports the thought that it was a problem with file corruption.

I’m still not clear what caused the issue, but this is as far as I am willing to investigate at this time.  Hope this helps you.

Share

USB Drives Mount as Read-Only

Today Nautilus decided it just didn’t like my mounted USB devices.  At first it was a brand new 64 GB FAT32 drive, and so I figured I would just reformat it.  This didn’t change anything; Nautilus (the file browser in Ubuntu 14.04) was insisting that I had read-only permissions on the drive and would not allow me to write to it.

Apparently there is a bug (not necessarily in Nautilus because I am told this will work with other file browsers) that is pretty easily fixed.

Open your terminal and run these two commands:

mv ~/.config/nautilus ~/.config/nautilus-bak
sudo killall nautilus

The first one moves the configuration file for Nautilus (modify if you are using a different file browser) to a backup copy.  The second kills (stops, terminates) the running Nautilus session.  You will need to launch a file browser window to get Nautilus (or other) running again, but that should return your USB drives to writable.

Share

UniFi Controller and Ubuntu

I bought a UniFi wireless access point.  Expensive but supposed to be about the nicest you can get for the money.  I have high hopes.

Anyway, I was a little worried about getting it set up using their software as so much of the talk was Windows centered.  I didn’t need to worry.

This article gave me the commands I needed to install the software and run it on Ubuntu natively.

First add this repository:

deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti

Then run these commands in sequence (make sure you are up to date before you begin).

##
#

# First get the key for the repository you just added
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50

# Update your repository lists and install unifi
sudo apt-get update
sudo apt-get install unifi

# Check to see unifi is running
sudo service unifi status

##

You are supposed to be able to visit https://:8443/ but I had to add localhost to the URL, so you may want to try this instead:

https://localhost:8443

When you first visit the controller, it will walk you through a basic set up process.  That’s pretty much it.

Share

File Sizes in Ubuntu

So you may find that you would like to sort out some file size information.  Of course you can access any directory (or file) and look at its properties using the file browser (Nautilus), but you may want to dig deeper or you may want to get a broader picture.

First, from the command line you can just list out the directory contents thus:

ls -alh /path/to/directory

This will give you file sizes and the number of items in each directory in human-readable numbers (MB or GB as it were).  You might also like to see how large directories are, and you can do that like so:

du -hcs /path/to/directory

If you are not so interested in the terminal, there are a couple of good GUI applications for sizing matters.  There is Disk Usage Analyzer (baobab from the terminal) and Graphical Disk Map (gdmap from the terminal).  Both are small and both are in the repositories and can be installed easily:

sudo apt-get install gdmap

sudo apt-get install baobab

Finally, to get an overview of all disk usage, I like the terminal command df:

df -h

This will list your partitions and their usage.  These ought to cover just about any size question you might care to have answered.

 

Share

Invisible Titles in Evernote on Ubuntu 14.04 with Wine

I recently updated my version of Evernote on Ubuntu and noticed that the titles of the notes were now invisible in the title field of the reading pane.  This made it very difficult to type or especially to change a note title.  Even copying and pasting was a challenge since I couldn’t tell if I had any or all of the title selected.

I was eventually able to find a solution here.

Essentially there is a dll in Wine that was in need of some wrangling.  A dll or Dynamic Link Library is a Windows thing.  You probably don’t want to know much about them except to say they are sometimes required for applications to function as expected or perform certain tasks.

With one line of code in your terminal (don’t fear the terminal, ok?) you can fix this problem:

winetricks -q riched20

That’s it.  Run that command and when you again open Evernote you should be able to see the titles.  I mean, if it worked for me why wouldn’t it work for you?  Go for it!

What does it do?  It installs the dll (riched20.dll) into the Wine directories.  I guess Evernote needs that dll to display the titles in the title field in the reading pane.  (The -q just means don’t ask me any questions.)

Share

Encrypted Drive Recovery in Ubuntu 14.04

I found a very simple guide for recovering data from an encrypted drive in the scenario where they drive will not boot (but, obviously, where the drive is still functional).

Take a look:

How to Recover Data from an Encrypted Harddisk on Boot Failure with Ubuntu 14.04

This method may work with other related versions of Ubuntu (assuming they are using the same application for encryption).  I have not tested it, but it looks sound enough.

Let me know your experiences.  Hopefully this will help someone not lose data.

Share

Enable Hibernation in Ubuntu 14.04

If you are running Ubuntu post 10.04 (or post 11.04 if you use non-LTS releases) you may have noticed that hibernation is no longer an option.  You don’t get to choose it from your logout/shutdown options and you don’t get to choose it as an option if your battery is dying.

I’ve read some attempts at explanation, but as near as I can tell it has been disabled because they can’t get it to work consistently on every hardware.  Seems they’d rather have actions that can work on all hardware than to risk some users having unexpected crashes.

So before you attempt to enable hibernation, let’s test your hardware to see if hibernation is likely to work for you.

sudo pm-hibernate

If all goes well this terminal command should hibernate your machine and move all of your active session into a special location on your hard drive.  You will then need to power your machine on and it should come back to your hibernated session.  If that fails then your machine may not be a good candidate to enable hibernation.  If it works, give this a try.

Enabling hibernation for those machine capable of it is a simple matter of creating a configuration file with the relevant data included therein.  The file is called com.ubuntu.enable-hibernate.pkla and will live in the /var/lib/polkit-1/localauthority/50-local.d/ folder.

I used Gedit to create and save this file:

gksudo gedit /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

This will open Gedit with elevated user permissions (so do be careful).  Simply add this code directly into the file, save it, and close Gedit.  (Mouse over to use the pointy-brackets button in the box for an easier copy and paste.)

[Re-enable hibernate by default in upower]
 Identity=unix-user:*
 Action=org.freedesktop.upower.hibernate
 ResultActive=yes

[Re-enable hibernate by default in logind]
 Identity=unix-user:*
 Action=org.freedesktop.login1.hibernate
 ResultActive=yes

That’s it.  You should (after a reboot) be able to use hibernation in the various circumstances where it might be appropriate.  For me that’s really just in the Power settings, but you may have additional uses for it.

Have fun.

Share