Laptop upgraded to Debian Stretch

I decided to take the plunge and update my laptop to the latest Debian release as I was still running Jessie.

My desktop PC has been running Stretch since it was released but it was a clean install on a new hard drive so didn’t have the possibility of a failed upgrade.

Full upgrade using the apt-get dist-upgrade option went relatively smoothly bar a couple of dependency issues which I resolved by removing the affending packages as they were not that important (just KDE libraries). All in it took about 2.5 hours to finish the upgrade, including reading/research and backing up important files. Backups are good!

I followed (or at least read) the instructions from Debian upgrade guide but the basics are:

Make sure your current system is up to date

1
2
apt-get update
apt-get upgrade

(if there are upgrades available)

1
apt-get clean

(optional, just clears out downloaded files used to install/upgrade)

Change your apt sources file (/etc/apt/sources.list) to point to new release. Change all instances of jessie in the sources.list file to stretch, save then rerun apt-get update to update the new release files.

Run apt-get upgrade  again to upgrade any installed packages (this may throw up list of files no longer needed as well). After these are upgraded you can run the dist-upgrade command to upgrade to the latest release.

1
apt-get dist-upgrade

Once this is finished you are now running the latest release which you can test by looking at the content of the file /etc/debian_version which in my case is now 9.2. you can check the kernel version as well by running uname -a from the terminal which gives me

Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux

This is just a quick and dirty run through of the basic process i would suggest you read the full upgrade instructions from the Debian website guide to upgrading to fully understand the issues you may have (oh and make a backup if you have important data on the drive). Backups are good!

Adding a Samba/NAS share to Linux system for access by Plex*

Originally posted on phunkymunkys.com on 15/10/2016. Original Post.


This is a post to help me remember how to do this as I will probably forget by the time I need to do this again.

I have a NAS (Buffalo 2TB) on which I keep my music, movies and other media ripped from CD, DVD or bought online** so as to be able to access it from which ever of the 3 computers (Desktop, Laptop and Raspberry Pi) in the house I am using.

The issue I was having is that Plex doesn’t work with the share on the NAS directly, on Windows it is fairly easy to fix you just map the drive to folder(s) required, for instance on my Windows install I have the movies(films) mapped to the F drive, my music (MP3) mapped to the M drive and the TV shows mapped to the T drive.

On my Linux installs which I use more than the Windows install I was having the issue that Plex would only see local files on the PC not the NAS files.

To map the drive on Linux you use the mount command to “attach” the NAS shares to a folder/location on the local PC.

First create a folder to mount the share to:

As root (or use sudo)

1
mkdir /mnt/nas

This creates the folder/location nas under the mnt directory

The mount command can be tested using the command line

1
mount -t cifs //ip-address-of-nas/share /mnt/nas -o username=nobody

This should mount the NAS share to /mnt/nas and if you go to /mnt/nas you should be able to see the folders/files there now.

Now it is a bit of a pain to remember to do this all the time so you can automate it by adding an entry to the fstab file (/etc/fstab), this file mounts all the relevant filesystems on boot.

Rather than put username and password details directly in fstab it is a good idea to put these into another file so you can change permissions to restrict who can view the details.

Create a file anywhere you like, I put it in /etc and call it what you like i.e nasdetails. To create file

1
touch /etc/nasdetails

Edit the file

1
nano /etc/nasdetails

The file should contain two lines

username=nobody

password=PASSWORD

Obviously change PASSWORD to your nas password then save file and change permissions so only root can read

1
chmod 400 /etc/nasdetails

now you can edit the fstab file

1
nano /etc/fstab

Add the following to it

1
//ip-of-nas/share /mnt/nas cifs uid=1000,gid=1000,credentials=/etc/nasdetails  0 0

Save file.

you can reload the fstab using

1
mount -a

You should now be able to browse to /mnt/nas and see the files on the nas as if they were local.

You can now add any media folders to Plex*.

* Will probably help with other programs as well.

**Don’t pirate stuff folks 😉

Two (Minor) Issues Solved Today

Originally posted on phunkymunkys.com  on 19/02/2014. Original Post . Edited for spelling and grammar only.


Background info: My home desktop PC is running Slackware 14.0 with the Xfce desktop.

Issue 1

When I fired up the computer today there were no window decorations (window borders, title bars, those little buttons you use to maximise/minimise and close windows) and I could not drag or adjust windows. This has happened before and it seems to be an issue with the xfwm4 (the Xfce window manager) not starting properly. There are a couple of ways to sort this but I use the easiest way which is to fire up a terminal window and type xfwm4 and press enter and this brings back all the window decorations.

Issue 2

Unable to delete files from external harddrive using file manager. This is something that I had noticed before but it wasn’t really an issue that I was bothered about since I usually delete stuff from the command line. The basic problem is that if I was trying to delete a file through Thunar (the file manager used by Xfce) either by selecting the file and pressing delete or by right clicking the file and selecting the Delete option I was presented with a dialog stating “Unable to find or create Trash directory”. After searching the internet I found out that my external harddrive didn’t have a Trash directory for my user (UID 1000 hence Trash-1000). To remedy this I recreated the required trash directory and hierarchy.

1
mkdir /freeagent/.Trash-1000
1
mkdir /freeagent/.Trash-1000/files
1
mkdir /freeagent/.Trash-1000/info
1
mkdir /freeagent/.Trash-1000/expunged

After this deletion of files worked as expected.

Setting up OwnCloud on Slackware 14.0 (part 3 – Encryption using SSL)

Originally posted on phunkymunkys.com on 02/12/2013. Original Post.

Information in this post may be out of date or inaccurate due to the age of the original posted content this is posted here for my historical record only.  Original post continues below.


This is a follow on post from Setting up ownCloud on Slackware 14.0 (part 1 – the server) and Setting up ownCloud on Slackware 14.0 (part 2 – the client). If you have completed these first two then you have a fully functional ownCloud install that allows you to synchronise your files across multiple devices.

In this 3rd part I am setting up SSL to allow secured connections using an HTTPS URL.

First thing to do is to get the SSL certificate for use. If you are doing this on a professional site/server you will probably need to purchase an official certificate from a CA (certificate Authority) , but as I am doing this on my own computer I am using a self signed certificate.

These instructions are taken from http://www.apache-ssl.org/#FAQ

Step one – create the key and request:

1
openssl req -new > new.cert.csr

Step two – remove the passphrase from the key (optional):

1
openssl rsa -in privkey.pem -out new.cert.key

Step three – convert request into signed cert:

1
openssl x509 -in new.cert.csr -out new.cert.cert -req -signkey new.cert.key -days 365

You now have three certificate files new.cert.key, new.cert.csr and new.cert.cert. These can be placed wherever is appropriate but I placed then in the /etc/httpd/ directory so the path to these is /etc/httpd/new.cert.key and so on, these paths are needed later on when they are added to the webserver configuration.

Once you have the certificates you need to make sure that your webserver can use ssl, this is done by uncommenting the mod_ssl module line in /etc/httpd/httpd.conf by removing the hash at the beginning of the line

1
#LoadModule ssl_module lib/httpd/modules/mod_ssl.so

to give

1
LoadModule ssl_module lib/httpd/modules/mod_ssl.so

The server needs to be restarted before changes will take place, I find it is usually a good idea to restart after a single change rather than do a lot of changes this way you can know which change causes errors if any. So restart apache by issuing the command

1
apachectl restart

If all is well the server will restart without issue, you can check the logs at /var/log/httpd/ to troubleshoot.

Now we need to tell the server where to find our SSL certificates and sedtup the correct port of 443, this is done in the /etc/httpd/extra/https-ssl.conf file.

The Apache-SSL directives that you need to use the resulting cert are SSLCertificateFile and SSLCertificateKeyFile directives. Search the httpd-ssl.conf file and edit it to add the paths to your previously made certificates. The required lines are:

1
SSLCertificateFile /etc/httpd/new.cert.cert

and

1
SSLCertificateKeyFile /etc/httpd/new.cert.key

Add these details to the VirtualHost section along with the ServerName, ServerAdmin, error logs etc and turn on the ssl engine, your VirtualHost section should start similar to this (parts removed for clarity)

<VirtualHost _default_:443>
DocumentRoot "/srv/httpd/htdocs"
ServerName 127.0.0.1:443
ServerAdmin your_email_address_here
ErrorLog "/var/log/httpd/error_log"
TransferLog "/var/log/httpd/access_log"

SSLEngine on

SSLCertificateFile "/etc/httpd/new.cert.cert"
SSLCertificateKeyFile "/etc/httpd/new.cert.key"
.
.
.
.
</VirtualHost>

This part sets up the server to respond to secure (https) traffic by using the created certificates. Again once this done you need to restart the server as done previously.

If all has gone well you now need to setup the ownCloud client to connect using https. This is done through the client setup as in the previous post (Setting up ownCloud on Slackware 14.0 (part 2 – the client)). Make sure you use https:// in front of the url or you will not be able to access ownCloud (I forgot to change from http to https and it took me a while to work out why my previously working install was no longer working).

Setting up ownCloud on Slackware 14.0 (part 2 – the client)

Originally posted on phunkymunkys.com on 02/12/2013. Original Post.

Information in this post may be out of date due to age of original post content this is posted here for my historical record only. Original post continues below.


This a follow up article to Setting up ownCloud on Slackware 14.0 (part 1 – the server) and a prelude to Setting up ownCloud on Slackware 14.0 (part 3 – Encryption using SSL) although you could setup the SSL/HTTPS on the server before setting up the client.

Once the server is setup and you can login to ownCloud through the web browser the next thing to do is to install the ownCloud client application on any required user machines (there is also an ownCloud app available for use on Windows, MacOS and tablets/phones running Android and IOS). Installing the client application allows for users to sync their data/documents/media across all machines or devices they own.

The clients for Windows, Mac and Linux(CentOS/RHEL, Fedora, openSUSE, Ubuntu, Debian) and the source can be downloaded from owncloud.org/sync-clients.

Because there is not package provided for Slackware we can install the client from source. There are two packages required to build and install the client they are ocsync and mirall. If you are using Slackpkg+ (and you should be!!!) and have alienbobs repositories you can install through slackpkg using:

1
# slackpkg install ocsync

and

1
# slackpkg install mirall

These versions are out of date, ocsync-0.80 and mirall-1.3.0 whereas the latest versions are ocsync-0.90.4 and mirall-1.4.2, but these old version still work fine.

I tried to build the newest sources both changing and using the slackbuilds and using the build instructions but both times it failed with an error (missing a header file) and I haven’t had time to investigate more.

Using the client.

The client is accessed by entering owncloud on the command line, this brings up dialogs that allows you to enter the login details for the server and the user credentials and to choose where you want the sync folder to be.

ownCloud client setup 1

Setting up ownCloud on Slackware 14.0 (part 1 – the server)

Originally posted on phunkymunkys.com on 02/12/2013. Original Post

This information may be out of date due to the age of the original post and the new versions of ownCloud now available, I am posting this here for my own historical record.  The rest of this post is from the original post.


Disclaimer: Most of the information in this post is taken from the ownCloud website (owncloud.org) but is tweaked for use on Slackware since the ownCloud site generally only gives distro specific instructions for Debian, Fedora, CentOS, Ubuntu, openSUSE, ArchLinux, Gentoo and PCLinuxOS.

ownCloud is a Dropbox type application which is entirely under your control, it can be installed on any webserver providing it meets the requirements (ownCloud requirements)

I was talking with a friend who said he was having problems keeping all his devices (2 desktop computers, 2 laptop computers, tablet and 2 phones) in sync as the applications he used only allowed syncing to 2 or 3 devices without paying for extra licences, he uses computers a lot as tools for work but does not have the technical skills (or time) required to deal with any installation/configuration of anything not “click to install”. This got me thinking and I remembered reading about ownCloud so I decided to look into this to see if it could help.

My home system is running Slackware 14.0 with Apache and PHP5.

There are two elements to the ownCloud system the server application and the optional ownCloud client installed on the users computer(s). The server application is a single zipped download from the ownCloud website and for a Slackware installation the client application consists of two packages ocsync and mirall (these are discussed and installed in Part 2 – the client)

The Server

The ownCloud server application can be downloaded from the ownCloud website and consists of the PHP files and associated content required to run the application. All that is required to install it is to extract the downloaded files and copy them to the webserver (probably need to do this as root).

1
$ tar -xjf owncloud-5.0.13.tar.bz2

Change to root and copy to webserver:

1
# cp -r owncloud/ /var/www/htdocs/

User files are stored under the data directory which does not exist at this point so it needs to be created. (The ownCloud instructions say that the data directory will be automatically created during the post install configuration but when I tried it complained that the data directory did not exist and should be created before continuing.)

1
# mkdir /var/www/htdocs/owncloud/data

Once this is done you need to change the ownership of the apps, config and data directories to the webserver user, in this case apache.

1
# chown -R apache:apache /var/www/htdocs/owncloud/apps
1
# chown -R apache:apache /var/www/htdocs/owncloud/config
1
# chown -R apache:apache /var/www/htdocs/owncloud/data

This should result in a similir setup as below for the /var/www/htdocs/ownCloud directory.

ownCloud directlry listing

.htaccess and AllowOverride

ownCloud uses .htaccessfiles and the mod_rewrite module so these need to be configured since we are using the Apache server. This is done by editing the Apache configuration file /etc/httpd/httpd.conf . This is done by making sure that the mod_rewrite module line is uncommented and that the AllowOveride is set to All. Once these changes are done the server needs restarted to allow the changes to take effect

1
# apachectl restart

Provided there are no error messages you are now ready to do the first configuration through the web browser.

The install is finished by going through the installation setup through your web browser at your_server_IP/owncloud. If this on your local machine it usually is localhost/owncloud

Here you can enter the admin account details and set up the database in use by entering the database user details. Once this is done you can login to your new ownCloud installation and customise the setup and add users etc.

Once you have got this installed and setup using the web interface you can go ahead and install the client for any users. The instructions for this are in the second part here Setting up ownCloud on Slackware 14.0 (part 2 – the client)

Reset root password linux

Originally posted on phunkymunkys.com on 10/01/2012. Original Article


This will work for all users although if you know the root password you can reset the user password anyway.

So I was going to use my old PC as a client for my Windows Domain Admin class but first I needed to make sure that I didn’t have any files that were important, unlikely since I hadn’t used the computer in years, but still need to check.

So I booted up the old PC and realised I couldn’t remember the passwords, oops!! After googling for the answer I found this way to reset (really delete) the root password, well any user password since they are all in the same file. BTW this computer is running Slackware Linux 12.2 (probably my favourite Slackware release)

Get a bootable distro that you can copy to disk and boot into a live environment or use one of the many rescue disks out there, I used SystemRescueCD which is really nice and easy to use and is quite easy on resources, the PC only has 640Mb of memory, so the newer Ubuntu live CD doesn’t run very fast or smooth.

Boot up the CD select an option, there are quite a few, I had to try a couple before I got one that worked, seems that there was a problem booting into a graphical environment, something wrong with the monitor settings (out of sync or refresh error, I forget which) but that doesn’t matter since I am happy using the command line. So once booted and at the prompt you need to mount the physical hard disk (remember this is running off the disk/RAM);

1
mount -t auto /dev/sda1 /mnt

Then go to the /etc directory

1
cd /mnt/temp/etc/

Edit the shadow file that holds the password information using your favourite editor such as emacs, vi, pico etc, my editor of choice is emacs

1
emacs shadow

What you need to do is locate the line that starts with root, usually the first line, and remove the encrypted password. This is the random assortment of letters between the second and third colons (:), highlighted in red below and just delete it.

root:$1$VvdL6/uZ$iQV835Rh7tgvpi2akemVt.:15080:0:::::

This leaves

root::15080:0:::::

Save the file and that’s it, just reboot, remembering to remove the CD and when you get to the login screen* just enter root as username and leave the password field empty and BOOM!! access is granted (see note below)

Last thing…remember to set a new root password.

* I couldn’t login through the GUI after I had done this I had to reboot using the liveCD and change the runlevel in the inittab file then reboot to the text login and all was well, gave myself a new password and changed the runlevel back to the GUI and rebooted and was able to login as needed.

Adding Serial Port support to Virtualbox

This post was originally posted on phunkymunkys.com on 22/09/2011  link to original post

Having got hold of a Cisco router I had to try to connect to it via my Windows XP virtual machine installed in VirtualBox. The problem I had was the COM port was not recognised in the VirtualBox settings, every time I tried to start the Windows VM it failed with an error.  One of these errors suggested checking the permissions and user groups to make sure these were correct.
Turns out I needed to add my (host) user to the correct group.

Use the command

1
ls -l /dev/ttyS*

to list the current groups for tty’s.
Output of tty configuration

As can be seen here the serial ports are all in the dialout group so using the user manager I added myself to the dialout group. Once that was done ( remember to logout and back in once you change group associations!! ) I set up the serial port in the virtualbox settings COM1, choose the Host Device option and add /dev/ttyS0 as the path.

Serial port configuration VirtualBox

Once this was done I started the Windows XP virtual machine and it now booted fine and once logged in Windows detected the new hardware and installed it automatically.

Now I am able to console into the router and all is good.