Linux – Kubuntu 16.04 with Plasma 5.5.5 – unable to change file associations

I just upgraded my laptop (Lenovo ThinkPad T540P) to the latest version of Kubuntu – 16.04 with Plasma 5.5.5.  Everything was running great until I had an issue with Ark, the archiving program that comes with KDE.  It was having an issue unzipping an archive.  It seemed to unzip the archive, but the resulting file should have been a directory and instead was being recognized by the operating system as a PDF file.  In the process of trying to get the extracted zip file open, I set Ark as an option for opening PDF files using the standard approach: right-click on file, select Properties, click on File Type Options, and then add the new option – Ark.

ark1
Step 1 – right-click a PDF file
ark2
Step 2: click on File Type Options
ark3
Step 3: adjust the Application Preference Order or add/remove applications

This didn’t solve my archive problem, but did introduce a new problem with Kubuntu 16.04.  Ark became the default program for opening PDF files, which is absolutely not what I want both because Ark can’t open PDFs and because I prefer Okular for this.  I tried a dozen times or so to change the file association using the same method I had used to add it above (right-click on a PDF, select Properties, click on File Type Options, etc.) and then deleting Ark as an option or moving it down so it isn’t the default option.  Every time I would try this, Ark would re-appear as soon as I hit “Apply” or “OK.”

Since this didn’t work when I was using the quick and easy method of right-clicking, I tried changing the file associations in System Settings.  Open up System Settings and click on “Applications”:

ark4Then click on “File Associations” and add PDF in the search bar:

ark5

I tried doing the same thing here – delete Ark as an option or moving it down in the preferred order list, and it would just reappear when I hit “Apply.”  This is definitely a bug in the new Plasma/Kubuntu version.

I knew there was another location to change these default settings – a txt file that could be edited using something like “kate,” the built in KDE text editor.  From a terminal/Konsole, type:

sudo kate /home/[user]/.local/share/applications/mimeapps.list

Once you open that file, you can see some default settings as well as my attempt to remove Ark as a program for opening PDFs:

ark6

The information in my mimeapps.list file was correct, but it was still having the same problem of Ark being called as the default program to open PDF files.

After a little searching on the internet, I found a different solution that actually worked (again, suggesting this is a bug in KDE/Plasma/Kubuntu).  Apparently, the mimeapps.list in that location is user-specific.  There is another mimeapps.list in a different location that is universal for the operating system and not user specific that is located here:

/home/[user]/.config/mimeapps.list

I opened this file using kate:

sudo kate/home/[user]/.config/mimeapps.list

And removed the Ark connection with PDF files by deleting it so the current version looks like this:

ark7

After I did this, the system settings took effect and Ark was no longer the default app called when I tried to open PDF files.  This seems like a serious bug in Plasma/Kubuntu that the developers need to fix.  It seems as though the operating system wide options are over-riding the user-specific options for the mimeapps.list, which means you cannot change the default file associations in KDE using Kubuntu 16.04.

If you run into this problem, please report it to the Kubuntu/KDE/Plasma developers.

Things to Know About Traveling to Argentina in 2016

I’m on my second day here in Buenos Aires, Argentina and am slowly figuring out how life works here.  Here are a few of the things I didn’t know about that others may find useful.

  • How to get from the airport (EZE) to Buenos Aires:
    • When you arrive at the airport in Buenos Aires (EZE), there isn’t really a way to get to Buenos Aires via train.  I’m sure there is a bus, but most people take taxis.  You have a number of options, but most of the taxis take cash only.  However, there are a few that will take a credit card. You pay in advance and they’ll drop you off at your destination.  I used WorldCar, but there is also TiendaLeon, which is highly recommended.  These are called “Remis.”  You can get one of these just after you clear customs (which is after immigration) but before you walk out into the area where non-ticketed passengers are.
  • Getting money out of an ATM:
    • I was planning on using my debit card to get cash at an ATM when I got to the airport since I arrived after the government had gotten rid of the “blue rate” for exchanging currency and everything was a standard exchange rate.  I don’t use the money changers (e.g., Travelex) as they screw you over big time (your credit/debit card company will give you a good or the best rate).  Turns out, every single ATM in the airport was out of cash.  So, that sucked.  That’s why I was glad to find the Remis (see point above) that took a credit card.  I’ve since tried three other ATMs in various locations around Buenos Aires and my debit card doesn’t work in any of them.  I needed some cash to pay for a few things and started getting desperate.  Eventually I found out about Xoom. If you’ve got a checking/savings account in the US, this is a great, cheap way to send yourself some money.  They have a lot of places where you can pick up the cash (the primary locations are “]More[: Money Transfers” or “Giros” with a fair number of locations).  This worked really well for me.
  • Buying groceries
    • Now that people actually want to use credit/debit cards because there aren’t multiple rates for everything, any time you want to use a credit/debit card, you’ll need ID.  If you’re a foreigner, that means a passport.  I went to buy some groceries my first day here without knowing that and they almost didn’t let me purchase them.  I gave them my driver’s license, since I had it with me, and they let me buy the groceries, but be prepared to show your passport whenever you use your credit card.
  • SIM cards and cellphones
    • I brought my LG G3 from Sprint (I use ting.com as my carrier).  It has dual modes, so it will work on LTE or GSM.  I used it last year in Ireland, but it takes some configuring to get it working on GSM networks.  The day I got here, I bought a SIM card from Movistar for about $3.00 US, but for some reason you can’t actually pay Movistar for service.  You have to use a Pago Facil location to pay your bill.  The closest one to me has a line that takes forever (nearly an hour).  Also, they only take cash.  So, be prepared for this.  (FYI, the latest iterations of the Android OS for the LG G3 removed the option to adjust the APN; I had to download an app to let me do this after setting the network to GSM.  Once I did that and got the settings from Muvistar’s website, I finally get internet access on my phone.)
  • Cars and Traffic
    • I’ve already almost been hit by cars multiple times.  Cars don’t yield to pedestrians.  Be very cautious!
  • Uber
    • Going to try Uber tomorrow.  I’ll post here how it goes.

Linux: LibreOffice Print Dialog Orientation “greyed out”

I really like LibreOffice, but occasionally have to deal with bugs that cause silly regressions, like this one.  For years, I have printed my LibreOffice Impress (i.e., powerpoint) slides for my students to a PDF file. The options have made this pretty simple.  Click on “Print.”

fixing greyed out print dialogue option in LibreOffice

When the Print Dialog window comes up, click on the “Options” tab.

printdialogue2On that tab, choose “Print to file.”

printdialogue3Then, back on the “General” tab, click on the drop down menu next to “Document” and choose “Handouts,” since I want the students to have room to take notes.  Then, on “Slides per page” on the “General” tab, select “3” so they have 3 slides per page.

printdialogue4Finally, how it used to work is that I would next, on the “General” tab, click “Properties” and in the drop-down menu next to “Orientation,” choose “Portrait.”  It takes a few clicks, but it gets me exactly what I want: a PDF with three slides per page and lines for notes next to it.  As of LibreOffice 5.0.3, there is a bug that adds another step to this.  The last item in the process above, clicking on the “Properties” tab and changing the orientation no longer worked.  The orientation drop down menu was greyed out, like this:

printdialogue5I tried upgrading to the latest version of LibreOffice, 5.0.4, but that didn’t fix it.  After a little googling, I finally found a solution.  In the Print Dialogue window, click on “Options.”  On that screen, choose, “Use only paper size from printer preferences.”

printdialogue6Now, go back to the “General” tab and click on “Properties.”  In the window that comes up, it’s now possible to change the orientation of the page.

printdialogue7printdialogue8As this screenshot shows, the orientation is now portrait instead of landscape:

printdialogue9This is clearly a regression in the software.  Not sure what happened, but it’s stupid and needs to be fixed.

Linux: Securely erasing a hard drive

I recently did some upgrading to my main desktop computer and my Network Attached Storage.  As a result, I ended up moving around some hard drives and have several hard drives that are no longer in machines.  I’m holding on to most of the hard drives, but some I plan on selling or giving away.  Most haven’t had particularly sensitive information on them.  Even so, there isn’t a good reason to not wipe the hard drives completely before giving them away.  Built into the basic Linux operating system (through the “coreutils” package) is a program that will securely erase hard drives.  Securely erasing hard drives means deleting all the files, then randomly writing 1s and 0s over the entire drive multiple times to make sure that it is very difficult to recover the information that was on the drive (there are still some ways to retrieve data, but only by using very expensive equipment; if you want to insure that data cannot be retrieved, you have to physically destroy the hard drive).  This is good practice if you ever plan on giving a hard drive away that you’ve used, particularly if the hard drive contained sensitive information (e.g., passwords, nude photos of a significant other, etc.).

The Linux utility is “shred.”  Here’s how you’d go about securely erasing a hard drive.  (Based on this website, though this one is very clear as well.)

(1) Connect your hard drive to your system. You could set it up as an internal hard drive, or connect it with an external connector.  Either way, it needs to be connected to your system.  (NOTE: If you’re connecting a hard drive to your system through USB, make sure the hardware you are using to connect the drive to your system can handle the size of your hard drive.  Not all USB hard drive connection hardware is suitable for large (>1 TB) drives.)  You’ll want to make sure that the hard drive is connected, but not mounted.

(2) You need to find out which drive it is (i.e., the drive letter designation).  There are a number of utilities to do this.  You could use a GUI, like KDE Partition Manger, Disks, or GParted.  You can also do this from a terminal using a command like:

fdisk -l

That will list all of your connected drives.  Your drive should have a designation like: /dev/sdx.  The “x” will likely be “a,” “b,” “c,” etc.

(3) Once you’ve got your drive connected to your system and you know what the designation is, now it’s time to shred the disk.  The basic command is:

sudo shred /dev/sdx

That will write random 1s and 0s over the entire disk three times.

(4) However, the shred utility has a number of modifiers that you may find useful.  For instance, if you tack on “-v” it will show you the progress.  This is particularly helpful if you have a very large drive, since this process can take days to complete.  You can also add “-f”, which will force permission changes to allow writing if necessary.  Adding “-u” will erase any files that are overwritten.  And you can add “-z” to add a final overwrite with zeros to hide the shredding that you did.  Thus, the command would look like this:

sudo shred -vfuz /dev/sdx

(5) Finally, if you want to be extra cautious, you can specify the number of overwrites by adding “-n X” with X being the number of times you want to overwrite random data on the drive.  This command:

sudo shred -vfuz -n 10 /dev/sdx

would overwrite random data ten (10) times, then finish with a write of all zeros (the “-z”), so it would overwrite the entire drive 11 times.  Depending on the size of your drive, that could take a very, very long time (several days or a week).  One wipe is likely sufficient; three is more than sufficient for most people.  If you’re really worried about people accessing your data, shred the drive three times, then physically destroy the drive with a hammer.