Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, February 13, 2017

Xfce - How To Execute Shell Scripts from Thunar or the Desktop

There are a few shell scripts I like to launch directly from the desktop or from Thunar - however, as of Thunar 1.6.5, this option is not enabled by default.

To enable executing scripts directly from the desktop or Thunar, you'll need to change the hidden settings. This appears to only work on Thunar 1.6.6 or higher.

1. Open a terminal and run the following command:  

xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default --create --type bool --set true

You can review the available hidden settings here. To view your current Xfce and Thunar settings, there is a Settings Editor accessible from the desktop in most distributions (or just run xfce4-settings-editor from a terminal).

Tested on Xubuntu 16.04.1(Thunar 1.6.10) - your mileage may vary.

Sunday, February 28, 2016

Fixing encrypted swap partition in Ubuntu 14.04

Having the message "the disk drive for /dev/mapper/cryptswap1 is not ready yet or present" error on your splash screen when booting? Swap partition not working despite having set it up when installing Ubuntu / Linux Mint?

There is an Ubuntu 14.04 bug in which the encrypted swap partition does not work if you chose to encrypt your disk or home directory when installing. All credit to the smart people that figured this out.

Fix is here, your mileage may vary:

1. sudo swapoff -a

2. Comment line(s) in /etc/crypttab , e.g. #cryptswap1 /dev/sda2 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

3. Reboot.

4. sudo mkswap /dev/sdXX (where XX is your intended swap partition) and copy the UUID that is produced.

5. Edit (or create) /etc/initramfs-tools/conf.d/resume and add line:
RESUME=UUID=the uuid from step 4 

6. Run the following:
sudo update-initramfs -u
sudo swapon /dev/sdXX
sudo ecryptfs-setup-swap

7. Edit /etc/crypttab (there should be a new line added below the line you commented in step #2) to change the UUID to /dev/sdXX, and add "noauto" and "offset=8".

For example:

cryptswap1 /dev/sda2 /dev/urandom swap,noauto,offset=8,cipher=aes-cbc-essiv:sha256

8. Edit /etc/fstab and add "noauto" to swap partition line, for example:

/dev/mapper/cryptswap1 none swap noauto,sw 0 0

9. Edit (or create) /etc/init/cryptswap1.conf with:

start on started mountall
script
      /sbin/cryptdisks_start cryptswap1
      /sbin/swapon /dev/mapper/cryptswap1
end script

10. Reboot. Test if swap is working with swapon -s or free -h. If you're still getting the "not ready or not present" message noted above when booting, despite the fact that your swap is working upon the boot completing, edit /etc/rc.local and add the following lines above "exit 0":

sleep 5
swapon /dev/mapper/cryptswap1

Saturday, February 27, 2016

Slackware Security Updates Desktop Notifier for xfce (sort of...)

How to (sort of) get slackware security update notifications on your xfce desktop:

1. Grab alienbob's excellent rsync_slackware_patches script, and place it in /usr/local/bin (or somewhere you prefer in your $PATH)

2. Add rsync_slackware_patches.sh to your crontab, e.g. :
10 17 * * * /usr/local/bin/rsync_slackware_patches.sh -q -r 14.1

3. Create a .forward file in /root, forwarding mail to whatever user you log in to your desktop with, e.g. user@localhost

4. Enable sendmail: chmod +x /etc/rc.d/rc.sendmail ; /etc/rc.d./rc.sendmail start

5. Install xfce4-mailwatch-plugin from slackbuilds.org

6. Add the mailwatch plugin to the desktop (right click panel, Add New Items, Mail Watcher)

7. Configure the mailwatch plugin to watch mail for yourusername@localhost (Add, Select Mailbox Type: local mbox spool, mailbox location is /var/mail/user)

When the rsync_slackware_patches cronjob runs, if any updates are found, cron will mail root. The mail will be forwarded to your desktop user account, and the mail watcher will indicate new mail. Run slackpkg update and slackpkg upgrade-all.

NOTES:

This is a hackish solution and it won't suit a lot of setups - especially if forwarding root mail isn't a viable option.

It won't notify you about updates for software installed with sbopkg or other third-party package managers. Still, it works well enough for a single-user desktop slackware install and is useful if you have a habit of not keeping a close eye on the slackware-security mailing list.

Don't leave sendmail open to the world - adjust your sendmail config and firewall accordingly.

This works for me, your mileage may vary. Tested on Slackware 14.1, 32-bit.


Thursday, January 29, 2015

Resolving 1080p playback errors on Raspberry Pi / Raspbmc / OpenELEC

If you're having issues with 1080p playback with raspbmc / OpenELEC - for me, it was garbled video or audio with no video - the issue most likely lies in the pi's boot configuration settings.

1. Check out your logs: ~/.kodi/temp/kodi.log   OR  ~/.xbmc/temp/xbmc.log

Try running tail -f yourlogfile and playing the file giving you the problem. If something like this appears:  

00:16:50 T:1257443248   ERROR: COMXCoreComponent::DecoderEventHandler OMX.broadcom.resize - OMX_ErrorInsufficientResources, insufficient resources 

You need to adjust the pi boot config.

2. Edit boot config, e.g. - sudo nano /boot/config.txt 

Change the value for gpu_mem_256 to 192. Any higher is probably going to cause other problems. If you have a B+ pi, change the value for gpu_mem_512 to a minimum of 192. It can probably be set higher safely, but 192 always worked fine for me. 

3. sudo shutdown -r now 

4. Retry playing your content! 

Friday, February 14, 2014

Editing the Places Menu Launcher in XFCE

If you recently upgraded to Linux Mint 16, you may have noticed that your Places menu no longer has links to the Videos, Documents, Downloads etc. folders.

To customize, simply create a file called .gtk-bookmarks in your home directory, with text such as the following:

file:///home/a/Documents Documents
file:///home/a/Videos Videos
file:///home/a/Downloads Downloads
file:///home/a/Pictures Pictures


You can create a shortcut to any destination.

Tested on Mint 16

EDIT March 2, 2016: Using Ubuntu 14.04 / Linux Mint 17+? Create a file called bookmarks in ~/.config/gtk-3.0 using the format noted above. If the directory doesn't exist, you can create it.

Simple PS3 Media Server Install Guide for Ubuntu

This guide is for users who wish to install the latest version of PS3 Media Server on an Ubuntu-based Linux distribution. As of this post, the current PS3 Media Server Ubuntu repository uses a custom-build of PS3 Media Server that is outdated and uses versions of video software such as ffmpeg which are deprecated. Additionally, installing from the repository with Ubuntu 13.10 (saucy-salamander) is not currently working.

Don't get me wrong, it works very well for most people  - however, some may wish to use the latest version. Here's how:

1. Download the latest version of PS3 Media Server.

2. Extract it to your desired install location (e.g. /home/user/PMS).

3. Install the required software packages (sudo apt-get install mencoder ffmpeg mplayer vlc dcraw)  (See note #2 regarding ffmpeg).

4. Install the required additional libraries libmediainfo0, mediainfo and libzen0. You can do this from the repositories but I strongly recommend grabbing the most recent versions from the MediaInfo site. If you install libmediainfo from the .deb provided at the MediaInfo site, it will automatically install libzen0 as well.

5. Run PMS.sh (either from the terminal or launching from file manager/user-created shortcut). Check the Logs tab to ensure that MediaInfo has correctly loaded (you should see something like "Loaded MediaInfoLib - v.0.7.67).

If all goes well, you should be using the latest version without issue.

NOTES:

1. If PMS fails to run altogether, you probably need to install java (sudo apt-get install default-jdk).

2. The version of ffmpeg currently in the Ubuntu repositories is deprecated and will very likely fail to work with PMS, returning errors in your PMS log. To install the latest version of ffmpeg, simply download the latest static build, extract, and copy the files (ffmpeg and ffprobe) to /usr/bin. If you wish, you can back up your current ffmpeg files from /usr/bin before doing so.

EDIT: Keep in mind that using this method will mean ffmpeg will not be "automatically updated" and you will need to repeat this step to keep ffmpeg current. This may or may not be desirable for your setup.

3. If you run PMS prior to installing libmediainfo and its associated libraries, you're gonna have a bad time. It caused terrible problems for MP4 playback on my PS3, with the PS3 convinced that the files were corrupted. A fix that seemed to work was to clear the cache and rescan the shared media folders, and then to quit and restart PMS.



Tested on Ubuntu 13.10 with PS3 Media Server 1.90.1

Saturday, January 18, 2014

How to Fix Windowless / Buttonless Windows in XFCE


If XFCE is not displaying window borders or buttons, give the following command a try:

sudo xfwm4 --replace

If this doesn't help, try this:

sudo rm -rf ~/.cache/sessions

Then restart xfce (or the system, if you prefer).

Tested on ubuntu 12.04.3

Fixing Slow Thunar in Ubuntu-based distros

If you are using XFCE on an ubuntu-based distro (e.g. Xubuntu, Linux Mint), the thunar file browser might take a very long time to load when first run. After the first run, it will probably perform normally.

To fix I found a solution online that was very simple:

Edit /usr/share/gvfs/mounts/network.mount and change the line AutoMount from true to false.

The flipside is that network drives (e.g. samba) will not auto mount. These can be accessed with the network:/// location in the left pane.

YMMV!

How to Mount and Recover an encrypted home folder in Ubuntu Linux

So you've broken your linux install and can't get at your /home folder because it's encrypted? All hope is not lost.

1. Boot an ubuntu 11.04 or higher LiveCD.

2. Open a terminal and figure out where the /home folder resides (this will most likely be /dev/sda1).

3. Mount the drive - sudo mount /dev/sda1 /mnt

4. Run sudo ecryptfs-recover-private. 

You will be prompted for your passphrase.

If all goes as planned, will provide you with a mount point (e.g. /tmp/ecryptfs.YttGfdzx)


If you wish to browse the /home directory, run your file manager as superuser from the terminal prompt - for example:

gksu thunar /tmp/ecryptfs.YttGfdzx
gksu nautilus  /tmp/ecryptfs.YttGfdzx

Saturday, February 9, 2013

How to Stop Geoclue on Ubuntu Linux (without losing the clock)

For some reason in Ubuntu 12.04 (and possibly 12.10), the tray clock package (indicator-datetime) for unity has geoclue as a dependency. In other words, if you want to ditch geoclue, you lose your clock.

Here's a workaround:

1. Add the following to your /etc/hosts file (sudo gedit /etc/hosts):

127.0.0.1       geoname-lookup.ubuntu.com
127.0.0.1       videosearch.ubuntu.com
127.0.0.1       daisy.ubuntu.com
127.0.0.1       one.ubuntu.com
127.0.0.1       musicsearch.ubuntu.com

2. Change the permissions of the geoclue libs to prevent it from executing:

sudo chmod ugo-x /usr/lib/geoclue/geoclue-master

3. Restart. No more pesky connections to Canonical servers.

Wednesday, January 2, 2013

PS3 Media Server - Firewall Setup for Ubuntu 12.04 / Linux

If you've installed PS3 Media Server in Ubuntu, and you're getting the message "No Renderers were Found" and a great big red "X" on the Status tab, give this a try. The most likely issue is your firewall is blocking your server from establishing a connection with your media playback device (e.g. your Playstation 3).

Steps:

1. Open a terminal (Ctrl-Alt-T)

2. Type the following command:
sudo ufw allow from <your_device's_ip> to any port 5001
This assumes you are using the default PS3 Media Server port of 5001. For example, if your PS3 uses the static IP 192.168.0.100, then do:
sudo ufw allow from 192.168.0.100 to any port 5001
If you aren't using static IPs on your devices but wish to open the server to any device connected to your router/subnet, you can specific a subnet mask, e.g. 192.168.0.1/24. If you're not using Ubuntu but are using iptables with your preferred linux distro, simply add an exception for port 5001, e.g.:
sudo iptables -A INPUT -s <your-device's-ip> -p tcp --dport 5001 -j ACCEPT
sudo iptables -A INPUT -s <your-device's-ip> -p udp  --dport 5001 -j ACCEPT
This ought to do the trick.

Wednesday, December 12, 2012

Ubuntu 12.04 - Hide the Recent Items in the Dash and Stop the Logging!

I really like Ubuntu 12.04. I even like the Unity Desktop (despite the general hatred it seems to attract amongst many users), it works really well on my netbook. However, Ubuntu has a lot of privacy issues, not the least of which is the integration of zeitgeist into Unity.

Here's what I did to get zeitgeist to stop logging. The "Privacy" app under System Settings never seemed to work properly, and clearing the history still left all sorts of information in the log files.

First, remove zeitgeist. I did this with synaptic. Don't remove the related libs, however, as Unity needs them. Restart the system.

Then, kill the running zeitgeist processes:

sudo killall -9 zeitgeist-fts zeitgeist-datahub zeitgeist-daemon
Then, remove the existing logs:

cd $HOME/.local/share/zeitgeist
rm activity*
You can use srm if you feel it is necessary. Restart the system.

Upon restart, Zeitgeist will recreate the log files, albeit they will be essentially empty. Now set them to read-only:

cd $HOME/.local/share/zeitgeist
sudo chmod ugo-w act*

Restart once more.

Once I did all this, the dash did not populate with recently used files, and the zeitgeist logs remained static. YMMV!