Nextcloud 12 Internal Server Errors after Login

When I upgraded from owncloud 9 to Nextcloud 11, my web interface was broken and I could not login to Nextcloud with the web interface. I was able to sync files to the server. I then upgraded to Nextcloud 12 through the command line interface. I still could not login to the web interface. The cause of the problem was that I moved the location of the webserver files from /var/www/owncloud to /var/www/nextcloud. I made the appropriate changes to my apache “sites-enabled” configuration file to redirect to the new location at /var/www/nextcloud. I was receiving “Internal Server” errors and the web interface was broken and unusable. I fixed the problem by following this thread https://help.nextcloud.com/t/solved-nc12-internal-server-error-after-login/13256 on deleting the data the in the database table oc_filecache. My steps were to:

  1. stop the apache2 webserver
  2. delete everything in “oc_filecache”
  3. restart the webserver

I used phpmyadmin to remove the contents from “oc_filecache”. I think “oc_filecache” contained information pointing to the old location of my files in the owncloud directory instead of the new nextcloud directory. Below are the steps to delete the information in “oc_filecache”.

  1. Login to phpmyadmin.
  2. Select your “nextcloud” database. Your database may have a different name that “nextcloud”
  3. Select the table “oc_filecache” listed on the far left of the page
  4. Select “Operations” from the tab at the top of the page.
  5. Select “Empty the table (TRUNCATE)”
  6. Select “Ok” to confirm you will be deleting the data in “oc_filecache”.
  7. Finished.

Rotate your Rsync Backups with rotate-backups, similar to Time Machine

I use rsync on gnome-ubuntu 15.10 to back up my data to my server running Debian 8. This creates incremental backups similar to Apples Time Machine. The backup runs every 2 hours so this creates more backups than needed at the expense of hard drive space. I used to manually delete the files from the server and would try to save a monthly backup, 8 weekly backups, 30 daily backups, and 2 weeks of every 2 hour backups. This was a time consuming process of manually selecting the files and thus I was not consistent about removing the extra backups. My backup scripts are written in python and I was going to write a script that would delete old backups that were not needed any more. Even better than writing your own script is finding one that has already been written such as https://rotate-backups.readthedocs.org/en/latest/#rotate-backups-simple-command-line-interface-for-backup-rotation. This script will automatically delete your old backups and you can configure it for many backups you want to keep.

This script is well documented and easy to use. I give it my highest recommendation.

Rename File with Current Date in Debian 8 Linux

I had a need to rename a file with the current date after running a backup script. This was done on Debian 8 Linux. The backup script would make a file name called “/mnt/backup.chadchenault.com/backup/server.cc.com.webmin/webmin.tar.gz“. I like my backup files with year-month-day at the front of the filename for easy sorting by date. My format is 2016-0422 for the date of April 04, 2016. I am using the date command to insert the current date and this is command that runs automatically after the backup command is run.

mv /mnt/backup.chadchenault.com/backup/server.cc.com.webmin/webmin.tar.gz /mnt/backup.chadchenault.com/backup/server.cc.com.webmin/$(date “+%Y-%m%d.webmin.tar.gz”)

This results in a new filename of “/mnt/backup.chadchenault.com/backup/server.cc.com.webmin/2016-0422.webmin.tar.gz

Here are an example of testing the date command from the command line.

Create a file “delete.txt”

touch delete.txt

Copy the file to a new name with current Year-MonthDay.delete.txt format

cp -v delete.txt /root/$(date “+%Y-%m%d.delete.txt”)

The output of the command on 2016-0422 was:

‘delete.txt’ -> ‘/root/2016-0422.delete.txt’

The command was run successfully.

 

MythTV Hardware Video Accleration with VDAPU

OS: Mythubuntu 14.04
Hardware: AMD E-350 APU, 8 GB DDR3 1066,AMD Radeon HD 6310 graphics

Playback of video was choppy and CPU utilization would reach 100% without hardware acceleration. I am using default radeon open source video drivers. I installed VDPAU drivers with

 sudo apt-get install mesa-vdpau-drivers
Enable VDPAU through the MythTV frontend settings:
“Utilities -> Setup -> TV Settings -> Playback -> Playback Profiles (3/8)”
I selected “VDPAU High Quality”

Reference

https://www.mythtv.org/wiki/VDPAU

Update Evolution Mail Client to 3.16.0 on Ubuntu Gnome 15.04

I updated the Evolution Email Client from 3.12 to 3.16 on Ubuntu Gnome 15.04. Version 3.16 has an archive feature I wanted to use that is not found on 3.12. I followed this blog, http://linuxpitstop.com/how-to-upgrade-evolution-email-client-to-3-16-on-ubuntu-15-04/#comment-3070, that had the installation instructions.

Add New Application to Owncloud Server 8.1 from the Command Line

This contains instructions on how to add new applications to your owncloud 8.1 server. I will give an example of adding Mozilla Sync 1.4 application. I am downloading the application using the command line. The server is Linux Ubuntu 14.04.02.

  • Go to https://apps.owncloud.com/ and find the application you want to add. Find Mozilla Sync 1.4 application and go to it’s page.
  • Go to it’s git page by clicking “Link”. It is located at the top of the page at Version Control: Link
  • From the git page, copy the git link “HTTPS clone URL”. The link is https://github.com/owncloud/mozilla_sync.git
  • From the terminal go to your apps directory in owncload (/var/www/cc.com/owncloud/apps).
  • Download the application with:

sudo git clone https://github.com/owncloud/mozilla_sync.git

  • View the directory and make sure the application is owned by your web server user “www-data”

ls -hl

  • Change the ownership of the directory to www-data:www-data (user:group)

sudo chown www-data:www-data -R mozilla_sync/

  • From owncloud menu, select Apps/Not enabled. Find the application Mozilla Sync 1.4 and select the “enable” button to activate the application.

The end.

Upgrade Owncloud 8.04 to 8.1 in Ubuntu Linux

When I tried to upgrade owncloud 8.04 to 8.1, the owcloud updater app did not work and said I was already at the highest version. However when I run

sudo dpkg -l owncloud*

I get that owncloud 8.1 is installed. Version 8.1 was installed to my /var/www/owncloud directory, however I run owncloud at /var/www/cc.com/owncloud. Here are my installation steps.

Backup owncloud folders: see https://blog.chadchenault.com/2015/07/20/updates-in-owncloud-8-ubuntu-linux/

Undo strong permissions and directory ownership for updates: https://blog.chadchenault.com/2015/07/20/updates-in-owncloud-8-ubuntu-linux/

Turn on Maintenance mode:

sudo -u www-data php /var/www/cc.com/owncloud/occ maintenance:mode –on

Rename current owncloud installation and save it in case you need to restore to it

cd /var/www/cc.com/

mv -v owncloud owncloud.8.04

Move owncloud 8.1 to /var/www/cc.com

cp -vR /var/www/owncloud /var/www/cc.com/

Copy old config.php to new files

cp -v /var/www/cc.com/owncloud.8.04/config/config.php /var/www/cc.com/owncloud/config/

Remove new data directory and restore old data dir

rm -vR /var/www/cc.com/owncloud/data

cp -av /var/www/cc.com/owncloud.8.04/data /var/www/cc.com/owncloud/

Undo strong permissions and directory ownership for updates: https://blog.chadchenault.com/2015/07/20/updates-in-owncloud-8-ubuntu-linux/

Restart you webserver

service apache2 restart

Run the owncloud upgrade

sudo -u www-data php /var/www/cc.com/owncloud/occ upgrade

“The upgrade operation takes a few minutes, depending on the size of your installation. When it is finished you will see a success message, or an error message that will tell where it went wrong.” source https://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html

Here is the last two lines of output indicating success: “Update successful
Maintenance mode is kept active”

Reset your Strong Permissions: https://blog.chadchenault.com/2015/07/20/updates-in-owncloud-8-ubuntu-linux/

/usr/local/bin/owncloud.set.permissions.sh

Turn off Maintenance mode

sudo -u www-data php /var/www/cc.com/owncloud/occ maintenance:mode –off

The End!

 

Updates in Owncloud 8 Ubuntu Linux

Steps on performing an Owncloud update in version 8.x. This did not work when upgrading from 8.04 to 8.1. See post on upgrading between major versions.

backup data folders

Simply copy your config and data folder (or even your whole ownCloud install and data folder) to a place outside of your ownCloud environment. You could use this command:

rsync -Aaxv -delete /media/media.serv/owncloud/ /media/backup.serv/backup/temp/owncloud-dirbkp_`date +”%Y%m%d”`/

You must undo strong permissions and directory ownership for updates

https://doc.owncloud.org/server/8.0/admin_manual/maintenance/update.html

chown -Rv www-data:www-data /var/www/cc.com/owncloud

Run owncloud updater from administration menu

data backup done by owncloud. Here is your backup: /media/media.serv/owncloud/data/updater_backup/8.0.0.7-3a8eb931

from command line

must be run from owncloud folder

cd /var/www/cc.com/owncloud/

sudo -u www-data php occ upgrade

Reapply strong permissions on directories

reference: https://doc.owncloud.org/server/8.0/admin_manual/maintenance/update.html#setting-strong-permissions

/data, /apps, and /config are www-data:www-data; everything else root:www-data

my script to set permissions

/usr/local/bin/owncloud.set.permissions.sh

 

How to Add a Custom Command to Webmin for your Server

Server is Mythubuntu 14.04 with Ampache, Apache, WordPress, Postfix and Dovecot email, mythtv, and Owncloud software. This is a post on how to run a script on your server using Webmin. When I first start up my server, I have a LUKS encrypted hard drive (backup) that has to be mounted. I written a script to automate this task. The private key to unlock this disk is stored in my encrypted home folder, so I must login first to open my encrypted home folder and then unlock the backup drive. The script to run is shown below and is called “mount backup disk on startup” and is run from the webmin server.

custom_commands.main

The next image shows how to configure the command to run. This command must be run as root.

custom_commands.edit

There is very little document on the custom commands for webmin.