Category: Tutorial

Setting up Nextcloudpi (NCP) with an Encrypted Hard Drive

The following tutorial is how you can setup an encrypted hard drive to work with Nextcloudpi. Please note that there are a few steps you will have to perform every time your pi goes down because the drive will require decrypting. Basic understanding of the command line will be required for this so if you don’t have these skills locate someone who does. One step that should be complete before beginning is formatting your encrypted drive. We recommend following this tutorial for setting up your drive.

1. Flashing Nextcloudpi onto the SD Card using Etcher

Go and find Etcher. There are other ways to do it but Etcher works really well and fast. They seem to have deb packages now if you are Ubuntu/Debian

2. Download the appropriate NCP image

Here is the repository for the NCP downloads. Make sure to get the right one as there are different ‘flavours’ of raspberry pi’s out there. Consider asking a community member. Generally it will be the generic RPi version if you are on a raspberry pi.

3. Extract the image from the downloaded archive

This extraction of the downloaded archive takes a bit more time than I expected so maybe get a coffee or play with your cat. Just saying. The extracted version is what you’ll flash to the card in the next steps, however, I think Etcher can use the raw archive but I’m too lazy to research that…

4. Flash the NCP Image to the SD Card

The instructions are pretty hard to mess up with Etcher in terms of how to use it. Just do it, but read the next important note (seriously read it, that’s why i put it bold and I’m mentioning it before you even read it)

Important usefule note!! It’s very easy to create a tragedy when flashing an image onto an SD card since Etcher doesn’t care that much what you are flashing on. I recommend physically removing any drive you don’t want to screw up. If you don’t it’s possibe to accidentally flash this onto your drive and completely kill it. Again, physically remove the drives you don’t want to kill and you’ll be a happier person.

  • Optional Step if you have previously attempted an Installation on this computer (clearly out your history)
    If you have already accessed a nextcloud server from Firefox and accessed it via ssh. While image is flashing onto the SD, remove historical garbage that will screw things up:
    • Remove cached stuff in Firefox (assuming Firefox)
      By going to settings and preferences / privacy & security / Cookies & Site data-Manage Data, then search IP address of your box and ‘remove’ and then ‘save’. It will give a warning which you say ok to. Not doing this might prevent you from accessing your box on same IP address with new install
    • Remove ‘known_hosts’ from SSH.
      This makes sure your old SSH keys and such don’t get in the way of a new SSH setup. In terminal go to /home/user(whatever it is) / .ssh.
      Now you are in the .ssh folder. Now type rm known_hosts.

5. Plug in Encrypted Drive

This step assumes you have already encrypted your drive. If you haven’t or aren’t sure if you have, don’t continue but instead refer to comment in pre-amble above.

6. Put newly-etched SD card with NCP image on it, into your Raspberry Pi and plug it in.

About 2 minutes later you should be able to move to next step. If it hangs, you’re too zealous… and chill. If you find the page won’t load, perhaps you already tried an installation and you need to follow the ‘optional steps’ above?

7. Go to IP address of your Pi in your Browser

If you don’t know the IP address of your Pi yet, you can get it from your router (if you know how) or you can use tools like nmap and zenmap to do this on your network. They scan to show what devices are there and their IP addresses. After entering your IP address into the browser URL (something like 192.168.x.xx), you will be prompted with an activation page. But righ before that you will be prompted to accept the not secure connection (which is fine for this part).

Save those passwords somewhere safe (note the convenient clipboard icon which automatically copies the long string to clipboard!) (I use KeepassX and ‘activate’ installation. Should take a minute or two. If it hangs on the activation page for more than 5 minutes, although unlikely, you may need to re-flash the image from Step 1 above as there could be a problem with the way the image flashed onto the card.

8. Enter user and password into the prompt box.

These are the passwords you saved from step 5. Specifically it will be the password for the top one (:4443). The user is ‘ncp’ and the password is that long string of gobbly gook you saved in Step 5 above. You may/will also need to confirm security exception here again (which is normal).

9. Skip the installation wizard when prompted

We are skipping this step since we are adding an encrypted drive. We’ll do part of it later.

10. (Optional) Make Static IP

You can skipt this step, but I think it’s smart for your future to make a static IP for your NCP at this point because some routers tend to change it etc, etc. Just go to the nc-static-IP option and type in what you like and what will work in your unique network config.

Power off and get back to this web admin area so that your router/network will have new static IP if you did this step. You can do this with the power button icon in the top right of NCP admin, too, but when it comes back remember you’ll need to change the URL to the new IP in your browser.

11. Activate SSH in NCP admin

  • On the left hand column you will see the SSH option in the NCP admin page. Go there and click the activate checkbox and enter an easy password. You can enter something as simple as 1234 here since it won’t be your ‘actual password’.
  • Go to your terminal and do ssh pi@xxx.xxx.x.xx where the x’s are your pi’s IP address discovered in step 5 above.
  • At the first prompt you enter the 1234 (easy password) you just made in the NCP admin page. This next part is a bit ‘weird’ if you haven’t dont it because it will kick back a request for the same password again.
  • Enter it again.
  • NOW you enter a real and strong SSH password that you will use for actual access to your box. Make sure it’s strong and you don’t lose it.
  • Once you enter that it will log you out of SSH again and force you to log in again with your new and real password.

Mastering this step is critical because you’ll need SSH access to do encrypted drive stuff (such as decrypting it every time the power goes off) if something ‘goes wrong’ usually you can access your pi via SSH to try to fix it. Note: if you are prompted for the key fingerprint (should be) then answer ‘yes’.

12. Update your Pi-kages

This is to make sure you have the packages required to do useful stuff such as encrypt your drive. The cryptsetup package is in here so if ou want to do steps 11 below you better run these two:

sudo apt update
sudo apt upgrade

9. Do an NCP Update

Log in again with ssh pi@xxx.xxx.x.xx and run this command below. This is to make sure that your packages includ the ‘cryptsetup’ package and also makes sure that your box is up to date:

sudo ncp-update

10. Make Apache2 not start on boot.

Making apache2 not start on boot lets you decrypt your encrypted drive before the system starts up. If/when your pi goes down, you will need to later go in and manually mount the drive each time (instructions to follow):

sudo update-rc.d apache2 disable

Remember: when the power goes off your Nextcloud will not work until you go in with SSH, decrypt drive, and restart apache2. More on this later…

11. Pre-Mounting of the Encrypted Drive

From this point we assume your drive is already encrypted in Luks format. If it’s not refer to [this page](link to come) for those instructions

  • a) Install the encryption toolset so you can decrypt your drive on NCP sudo apt install cryptsetup
  • b) Check your pi to make sure the drive is showing up at least sudo lsblk

Mine shows up as ‘sda’ but yours might be different. Look at profile of it and make sure it’s at least there.

  • c) Key step: –> make sure contents of encypted drive are EMPTY…..
  • d) Decrypt the drive so it’s usable by Nextcloud. You’ll need your drive de-cryption password here (and every single time you reboot your NCP…so get used to this step…): sudo cryptsetup luksOpen /dev/sda gcw2
  • e) Check again to make sure drive is looking right sudo lsblk
    Mine looks like this:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
└─gcw2 254:0 0 232.9G 0 crypt

12. Start apache

This makes your nextcloud stuff work so you can reach it in a browser

sudo /etc/init.d/apache2 start

13. Run the NCP Installation Wizard to Move Files to Encrypted Drive

  • Go to the address of your pi in your browser with :4443/wizard at the end to access the first run wizard in NCP https://xxx.xxx.x.xx:4443/wizard
  • “Do you want to save Nextcloud data in a USB drive?” Yes.
  • “Plug in the USB drive and hit continue.” –> it’s plugged in so ‘continue’
  • “If you want to prepare the USB drive to be used with NextCloudPi hit Format USB. Skip if already formated as ext4 or BTRFS. Attention! This will format your USB drive as BTRFS and will destroy any current data.” –> Skip formatting of drive because it’s encrypted and you want to keep it that way
  • Move data to USB –> click the button
  • Go through the ‘external access’ wizard however you like. I do mine manually in router
  • For DDNS, I skip and do mine manually in router as well with No-ip but you can try this if you want. This is not the point of this tutorial This should make your nc-datadir point to your drive meaning that your hard files will now save to the encrypted USB drive instead of to the stock SD card which is by default where they would go. You will know if this part was successful because nc-automount and nc-datadir should will change from an orange colour to a green colour in the bottom right side of your browser screen.
  • Go back to web admin panel from there

14. Run the nc-database move feature in the NCP admin panel

Again, make sure the hard drive is completely clear at this point. It’s probably possible to move a previous existing database here, but it’s out of the scope of my ability or this tutorial. You can investigate it yourself but this is assuming you have a clear drive.

Bonus section you hopefully won’t need

If you got a green light above in the last step don’t even read this section and skip to Step 15. If you have a problem where you try to do the above step and it gives you a permission So what happens here with encryption is a ‘symlink’ is created so it’s this symlink that needs to get the right permissions or NCP can’t do it’s thing with the step above. This may be a bug that no one else sees, but I’m leaving a few hints here in case we need it later:

In the next steps you have to in your terminal go to your /media/ folder and correct a permission manually before you are able to use the NCP ncdatabase function. if you have done previous nextcloud installations with their default directories on this drive, you will need to wipe out whatever is there before you move forward.

sudo chmod o+xr /media/gcw-ssd

(gcw-ssd is the name of the symlink created on your drive that points to USBdrive in Nextcloud)

Now go back to your NCP web area and do the nc-database move and it should work.

Command to empty your folders complete are as follow (use with caution, of course because this will ruin your day if you do it to the wrong dir!)

(if it’s not empty run: sudo rm -rf /media/USBdrive/ncdatabase)

You might also like to keep this command handy to check permissions if someone asks:
sudo ls -ld

15. LetsEncrypt – nice and easy.

This is a good chance to relax and do some Lets Encrypt since it’s easy and satisfying. Go to the left panel of web admin find letsencrypt, fill in the blanks, and press go. Now you should be able to find your box from the internets with secure connection too. You’ll need your dynamic dns url at this point to make it all work so go and do that at no-ip.com or whatever you like. S

16. Reboot system to make sure things are working as they ought

  • Shut down your box with command:
    sudo reboot
  • To be sure it’s back up you can ping xxx.xxx.x.xx (your box). When it starts responding you should be ready to ssh in
  • SSH in (see instructions above in Step 8) At this point, because you made apache2 not start on reboot, neither your NCP admin pages nor your nextcloud instance will be accessible. We will proceed with a new section now which will be your process to get it back up each time the power goes down or it’s rebooted.

17. Getting things back up after a reboot:

  • Unlock/decrypt drive. Note: yours will not be ‘gcw2’ – that’s just my example. Can be whatever you like.
  • sudo cryptsetup luksOpen /dev/sda gcw2
  • Enter your decryption password for drive
  • Restart apache (see above)
  • sudo /etc/init.d/apache2 start

Celebrate if it’s working! Try again if it’s not!

Special thanks to Tobias, Nachoparker and Kevin for all your hard work with me getting it this far!

Tags : , , , , ,

How to Convert YouTube Video into MP3 Audio

This is a useful tool and tutorial if you, for example, make a video on Youtube and then want to publish the audio quickly on Soundcloud (or somewhere else).

If you aren’t already running Ubuntu on your computer this will be a couple of steps more difficult for you but well worth the effort.

Step 1: Get Ubuntu on your computer

If you don’t know what this, look it up and get it done.  Apple and Microsoft are so restrictive, un-secure, and 1990….

Step 2: Open a terminal

If you don’t know what this is, go look that up too.

Step 3: Install Youtube-dl tool with Terminal

Make sure the youtube-dl app thing is installed on your machine by pasting this into your terminal.  Note, you cannot just ‘control c/control-v’ into a terminal but you need to hold down both control *and shift* before pressing V to paste…  ready?  Ok, control C this into your computers clipboard (if it runs the command upon pasting, you’ll have to type it out manually, sorry)

sudo apt install youtube-dl

Now press enter in Terminal.

This will complete the installation of the tool.  Say ‘yes’ if it asks you to do anything since it’s just hard to argue these days…

Step 4: Copy the ‘magic line’ into your clipboard

We say ‘magic’ in technology when we’re doing something that is harder than sending an email.

Copy this ‘magic line’ of whatever to your computer with control C

youtube-dl --extract-audio --audio-format mp3

Step 5: Paste the ‘magic line’ into your Terminal

Paste the ‘magic line’ into your terminal taking note of my notes in Step 3…  pay special attention that there is only one trailing space and no other stuff after the ‘3’ in mp3.  You are going to paste a URL here from the video in the next step so extra garbage before or after the ‘magic line’ could mess it up.

Step 6: Copy Video URL from Youtube to clipboard

Using the ‘share’ link from the Youtube video (I find this works better than the main video URL…) copy the URL to the computer clipboard.

Step 7: Paste video URL to Terminal

Paste the video URL at the end of the magic line in your terminal using again my notes from Step 3.

Step 8: Press ‘enter’ in Terminal and get some popcorn

Press ‘enter’ on your keyboard.  The thing should run and it will be dumping the mp3 audio into your ‘home’ folder on your computer.  It takes a bit of time for this step so let it go and have a coffee

Boom.  A nice MP3 of your video.

Thanks to all the folks who made the youtube-dl tool!

Thanks to all the efforts of the free software community who make all of this possible.

Extra note: If, for some reason everything looks like it was running fine and you can’t find your new MP3 file in the Home directory, it’s possible the defaults were changed by you or something else and the Terminal downloaded the video somewhere else.  Do a system wide search for your file and you’ll probably find it somewhere.  This happened to me a few times 🙁

Tags : , , , , ,

Bypass Empty cartridge Brother Printer to Keep Printing

If you are like me, you bought your Brother scanner printer because you wanted a decent scanner and perhaps the odd black and white print.  Nothing more.  That’s why you didn’t pay a lot.

Well, built into the ‘cheap printer’ business model at Brother is a nasty little trick which says ‘When their colour cartridge runs out (which is really small) then stop printer from printing *everything* – including black and white – even though it’s full!”

Now that is just dirty.

I turned off colour printing on computer and it still refused to print with some bogus message like ‘cannot maintain print quality’.  Really?  I have a fully black and white cartridge and I’m not printing colour and it cannot maintain print quality?  I call BS, Brother.

Thankfully, the solution was super, duper crazy easy.  Thanks very much to these guys here

Just take some electricians tape (don’t bother with sharpie markers or other ideas as I tried other stuff on my desk) and get some small scissors (or exacto knife probably easier and more accurate) and cut some black electricians tape so that the tape *perfectly* covers the plastic clear window.

Note: you can see a small gap in this photo example which you should avoid.  Aim for 100% coverage of the window or it may not work.  I tried one with a slightly larger gap and it failed (their lasers are very accurate!)

Once the lasers kick in and hit the tap your screen will show a nice full cartridge and printing in Black and white (or whatever colour you have left) should work.

Enjoy!

Tags : , ,

How to Reset/Purge Brother Printer Page Counter

So you have an ink cartridge and Brother decided that it was empty and you disagree and want to milk it further?  One thing that might work for you is to reset the internal page counter.

It’s fairly public understanding that printer companies have tech inside the machines that essentially tell it when it has printed enough and to print no more (so you have to run out and buy another cartridge).  The screen will tell you ‘can’t maintain print quality’ or ‘cannot print’ or some message that you might not care about.

This post is specifically how to do it on the following models but I will have links to websites that will probably be able to solve your other models too:

MFC-J460DW

MFC-JF480DW

MRC-J485DW

The answer to my question was found tucked away in one reply somewhere on this page and on THIS WEBSITE

Here is the quote:

To enter maintenance mode on the MFC-J480DW, with the printer powered on, press the Settings button followed by *2864
The Settings button will have different names according to where you purchased your printer. To help identify the button: It depicts a wrench and a screw driver.

However!  One tiny little detail cost me many hours.  It’s important that before you do the above make sure you hit the ‘stop’ button which will clear the ‘ink levels low’ message from the LCD.  You can’t do the above steps until the LCD is clear of the warning.

So, here is a more clear list:

  1. clear the screen with the stop/exit button
  2. hit the settings button (wrench)
  3. enter the following 5 keys * 2 8 6 4
  4. use the down arrow until you come to the purge followed by some numbers (the numbers, btw, are your page count -wasted time trying to figure out why mine was different from websites out there, ha)
  5. press 2 7 8 3
  6. I got a ‘cannot detect’ message, and the stop/exit button didn’t work so then I did step 7 and got out
  7. press 9 and then 9 again
  8. machine reboots and page count is clear /purged

You may also get a message that says your colour cartridges are low and your printer stops you printing, even black and white!  Don’t worry, I overcame this trick too in THIS POST if you’d like to have a black and white only brother printer (works for me!)

 

Tags : , ,

View Your Mind: How to turn Xlink on

First of all, thanks a million to the creators of View Your Mind mind mapping software.  It’s a great piece of useful free license software!

Everything was going very well while I was using it.  I especially found useful the xlink (xlinks?) feature.  This feature will allow you to connect a visual reference from one branch to any other branch on the screen.  In my case I was trying to track the last 10 years of my life visually and all the interesting connections and overlaps of people in my life but I needed the xlink feature to do so.

I figured out that if you hold the shift key and click your mouse over a branch that the xlink started working just as the documentation, but I accidentally switched modes and couldn’t get it on again.  Unfortunately, p 33 of the documentation wasn’t helpful at all to me.  Finally, I figured out how to turn it back on so I wanted to throw it out there for anyone else who might have struggled.

First, add the ‘link mode’ to your toolbar

modfier_mode_toolbar

Next, find it on your toolbar and make sure this one is selected

modifier_mode_xlink

Next, start working by clicking ‘shift’ on your keyboard when you click your

mouse.

modifer_mode_with_xlinks_workingEnjoy!

Tags : , ,

Ubuntu: How to Decrease Desktop Icon Size 16.04

It’s quite funny how easy this was but how long it took me to figure this out so I just thought I’d throw this online in case anyone is as dumb as me.

Hopefully it helps someone and if it does, don’t tell anyone. 😉

Within Nautilus (your file browser) click the 4 square icon thing

01_icon_tutorial

(THIS)

00

 

02

Then, slide the left-right dial thing (don’t worry about what is selected in the radio dial)

04

Yes. It was really that easy…

Tags : , , ,

Ubuntu 16.04 – How to Make Brightness Keys Work on System76 Lemur

Nice computer. Usually works awesome.  Just this one little bug every time I re-install the OS or upgrade it seems.  Easy to fix but I always forget how to do it so here it is for everyone else who might be having issue.  Might also solve all your other Intel brightness button issues so give it a shot! This also seems to work for 14.04 and maybe even 13.04 and before…

Read the whole blog article first, if you want, but just doing this worked for me:

Command in terminal:

sudo gedit /usr/share/X11/xorg.conf.d/20-intel.conf

Then paste all this stuff in and save it.



Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"
EndSection


Then log out and back in again and my buttons were working.
schweet.

Tags : ,

How to Install Jitsi on Ubuntu 16.04

Yes, this is the hard way but seems to be the ‘only way’ right now at the time of this blog.  Always first check to make sure it’s not simply sitting in the software center before beginning this tutorial.

No, I can’t figure out why the packages aren’t in the Ubuntu software centre.

All I did to make this tutorial was update the wget link from this fine lad’s blog post so thanks Mr. Ji M

For 32-bit system:

wget https://download.jitsi.org/jitsi/debian/jitsi_2.5-latest_i386.deb

For 64-bit system:

wget https://download.jitsi.org/jitsi/debian/jitsi_2.5-latest_amd64.deb

To actually install what you just downloaded on both 32-bit & 64-bit run following command:

(hint: as soon as you have hit the 2.5 part and press ‘tab’ button it will auto-fill the rest then just press enter and it starts)

sudo dpkg -i jitsi_2.5-latest_*.deb

When it’s done doing it’s thing then just hit your super button and start typing jitsi and you should find it. However, mine would not work until I did a software update.

I am not sure the best way to trigger the software update but I did it by going through my dash to
s ‘system settings’ then ‘details’ and then click the update button and upon restarting my machine
i went to the dash, searched Jitsi, opened it and it started working.

Hope this helps because I was pretty surprised to see it wasn’t in apt repositories (ubuntu software center) and more surprised that there wasn’t a tutorial like this as a work around until it was!

Tags : , , , , ,

How to Sync a Calendar Between Owncloud/Nextcloud and Thunderbird Lightning

For some reason this is not that intuitive the first time and there don’t seem to be many/any specific tutorials out there.  I kept getting a ‘modification fail’ error message or other errors. So, here you go:

In Nextcloud/Owncloud

1. Log in to your browser-based owncloud/nextcloud page

2. Go to the top left and click the down arrow to access the calendar app

Note: this *must* be enabled first by your admin, if you happen also to be your own admin

01_nextcloud_lightning

3. Grab the caldav link from the … share icon drop down

02_nextcloud_lightning

4. Select the content of the link and copy it to your clipboard (control A/Control C)

03_nextcloud_lightning

Back in Thunderbird Lightning

Note: You must first have the Lightning add-on installed in Thunderbird if yours does not already have it.  It should come default but I recall in the past it did not…

Now skip past step #10 in this tutorial, and start at the ‘Back in Thunderbird Lightning’ steps

The key point is that it is ‘caldav’ that you select, *not* ical.

 

Tags : , , , , ,

Great Bible Habit: Bible in a Year

I realized years ago that believers live in a very imperfect world.  We are fish swimming upstream and there is nothing that the enemy of our soul would love more than to keep us weak and ignorant of God’s holy Word.

I knew that I had to find some form of ‘structure’ around my daily Bible reading.  I found that I would get on a spiritual tangent and spend all my time in Proverbs, or shift over to Psalms, or again to the book of Acts for fun and adventure.  But if you asked me who Habakkuk was I’d say “Habak who?”  Since I knew that every word in the Bible is inspired something had to change.

I then tried a straight read through the Bible for X amount of minutes per day.  The problem was that life would happen and I’d lose track and such.  I needed something with a bit of ‘drive’ behind it.  Something that would push against the desire of my flesh to stop.  That’s when I heard about ‘Bible in a year’ idea.  The idea is that the whole Bible is divided into daily reading segments so that the whole Bible is consumed in a calendar year.  Genius!  And so I began.

I spent time on Odb.org and simply clicked their daily Bible reading link but recently I discovered that it was linking to a Bible company whose ethics I can no longer suffer.  So last week I disconnected myself from Biblegateway.com since its owned by the questionable company Zondervan.

The only problem was that now I had to search for another website that I could go to that would allow me to check to see where I was at and where I should be at.  I found most of the websites either linked to Zondervan, or, didn’t have the audio Bible option (which I like).  Most were just a list of 365 days and you had to figure out what day you were on today.  Too hard for me.

Thankfully I found this website which appears to have solved my problem.  It’s the International Bible Society’s site and although their website defaults to the NIV version (shame on them) at least it has all the features I need and doesn’t send traffic to Zondervan’s site.

I also understand that this great website has a pretty impossible-to-remember URL for people who want to actually go their daily so I made a permanent page here at W.O.T. for you to remember more easily:

wayneoutthere.com/bible

This turned out to be *even better* than the program I was on because it also breaks out Psalms and Proverbs into their own daily chunks which is just awesome.  Truly Psalms and Proverbs need to be consumed daily and it looks like this program does it.  Here is a quick tutorial to set yourself up and navigate the tools:

03_daily_bible_annotations

Also, it is helpful to note that you should right click (or whatever the option is on your device) and ‘open in new tab’ when you click the Bible links because for some reason it doesn’t open a new tab/window automatically.

Although there is an option to change your start date, you may want to consider just starting today and leave it as January 1st.  It is useful, I find, to have January 1st always as the start date.  I don’t have a lot of explanation as to why but I just find it helps keep momentum.

Finally, you may want to consider doing what I plan which is to drop where I am in my current plan and use this.  Mine didn’t have the Psalms/Proverbs section so now everything is different from where I am.  I think it’s very worth changing the plan to synchronize with this one.

Tags : , ,