Fix Debian 9 Upgrade apt-get update freezes and stops [0% Working]

Since our last dist-upgrade from Debian 8 Wheezy to Debian 9 Stretch, we’ve encountered quite a few new issues. By issues, I am referring to incompatibilities with any manual changes that I have made to my PC.

Most of the repositories that I have manually added have to be manually adjusted from wheezy to stretch. After that, we tried the usual sudo apt-get update and it never completed it’s course.

Stuck on 0% [Working]?

sudo apt-get install apt-transport-https

This one line solved the 0% Working issue where the package list downloading would hang and become stuck on Debian 9.

Using Rufus on Linux to make Bootable Windows USB. WoeUSB: WinUSB for Linux Debian, Ubuntu

Only recently I found out Etcher.io didn’t make bootable Windows USB’s properly, or rather, did not support it at all.

There are 3 ways to make Windows Bootable USBs on Debian Ubuntu of any Linux distro, but first you’ll need a Windows ISO which Windows themselves now provide. Just search “Windows ISO” and make sure you’re at microsoft.com. At the time of writing, Windows was providing the Windows 10 ISO here.

1)  Use WoeUSB on Ubuntu or Debian to make Bootable Windows USBs from ISO.

Woeusb debian ubuntu winusb for linux
Woeusb debian ubuntu winusb for linux

The deb packages for WoeUSB are found here, ignore the .exe files in this directory.

http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/w/woeusb/

2) Use a Windows VirtualBox to create a bootable USB using Rufus.

You’ll need to install VirtualBox (sudo apt-get install virtualbox) and then install a virtual Windows machine using the ISO from Microsoft.com at the start of this article.

You will also have to install VirtualBox Guest Additions to be able to passthrough the physical USB stick straight into the VirtualBox. To do that, boot your virtual machine, select Devices on the toolbar, and select insert Guest Additions CD. Install it, reboot, and you’ll now be able to connect your USB. To connect your USB, go to the virtual machine settings and add USB 2.0 or USB 3.0 support. You can only add USB support when the machine is off. If you haven’t installed the guest additions correctly, it will give you an error on booting.

USB not recognised virtualbox guest additons
USB not recognised virtualbox guest additons

If your VirtualBox doesn’t recognize the USB or fails to install drivers etc., make sure it’s formatted as Fat32 (use gnome-disks or gparted, might need to reformat it a few times with both programs).

When you boot the machine, bottom right of the virtual machine window has a small USB icon, right click it, and select the desired USB that you’d like to pass straight through to the VM.

USB passthrough virtualbox
USB passthrough virtualbox

Here is a screenshot of me successfully making a Bootable Windows USB using Rufus on a VirtualBox Windows 7 while my host OS is Debian.

Using rufus in VirtualBox Bootable USB Debian

3) Use another Windows PC to create the bootable USB.

Fix or Repair Debian GRUB when it’ not working. Blank screen with blinking underscore cursor.

Playing around with GRUB is a nightmare for the first few times, and often GRUB reinstallations will actually be mandatory when installing multiple operating systems on the same drive, or multiple drives, or after reinstalling windows or vice versa.

If you can’t boot into your OS, you’ll need a linux live CD of any kind (Debian or Ubuntu) or a rescue disc. The most natural way to reinstall GRUB is to boot into your main OS via a live CD and run the grub-install command. I prefer not to do this as my live CD is around 4GB and can take 5-20 minutes to create the USB. And if you don’t have your OS live CD laying around, you’ll need another PC to either download it and create the bootable USB (60 minute exercise at least), or you can use a smaller, lighter, recovery OS on a bootable USB.

The best rescue method is by ‘burning’ Super Grub2 Disk to a USB or CD/DVD. You’ll need to download the Super Grub2 Disk ISO from here: https://www.supergrubdisk.org/super-grub2-disk/

It’s a tiny 20MB ISO that you can use Etcher to create a Super Grub2 Disk bootable USB in about 30 seconds. Any version will work. This will get you back into your PC. Once you’re inside you can run the grub-install command. On Debian this is the only command that worked for me completely:

Open gparted or gnome-disks and find the /dev/sdX of the drive you want to install grub to. Your main partition will be either /dev/sda or /dev/sdb or /dev/sdc or /dev/sd0. It should show that it’s mounted at / which is your root directory of the OS you’re in, you’re main OS.

grub-install --force --debug --boot-directory=/boot /dev/sdabc0

Replace sdabc0 above with whatever your drive is.

Now reboot without the Super Grub2 Disk USB and see if your distro goes into GRUB. This is a good time to keep the Super Grub2 Disk in a safe place as it is a very powerful tool for booting into all sorts of drives or places, even ISOs with loopback setup.

How to use gparted live when your GRUB isn’t working with Super Grub2 Disk and when you only have one USB.

Now, here’s a challenge: rescue your linux computer with one USB.

Get Super Grub2 Disk as described above and boot into your normal OS via the above method. After you’re in your normal OS, download Rescatux but don’t burn it to a USB.

Instead, as root, open your boot folder and make a folder called boot-isos and put Rescatux in that folder.

sudo su
cd /boot
mkdir boot-isos

Download the latest Rescatux ISO from here and put it in that folder.

Rescatux bootable from hard disk loopback
Rescatux bootable from hard disk loopback

Now when you boot using Super Grub2 Disk, you’ll see a bootable ISO entry with the Rescatux ISO which you can boot into! This is because Rescatux is setup for loopback mount meaning you can boot into it on a hard disk instead of a USB. Booting a live distro from live USB. Rescatux has gparted and you can make changes to your partitions without being mounted but Rescatux does not have grub-install. This helped me when I had one single USB but I wanted to use both “gparted live” and Super Grub2 Disk at the same time without losing my Super Grub2 Disk USB.

John the Ripper VPS/Dedicated Server Cracking – Multiple Core & Thread Research Tutorial

John the Ripper, also know as john in yum & apt package managers, is an open source password cracker and hash decipher program.

Here is a “How To” tutorial for using John the Ripper on VPS or Dedicated instances so that you can leave it running overnight, for example.

John the Ripper CentOS & Fedora installation & usage:

# john requires openssl-devel package
yum install openssl openssl-devel -y

# get the latest JUMBO version of John
wget http://www.openwall.com/john/j/john-1.8.0-jumbo-1.tar.gz

# extract and enter the src folder
tar -xzvf john*
cd john*
cd src

# configure and make john
./configure && make

# navigate and run the test and benchmark script
cd ../run
./john --test

 

 

 

 

 

Paste Clipboard on Linux with xdotool (Ctrl + V into terminal or type)

Ctrl + V (paste shortcut) doesn’t work everywhere that you expect it to work.

For example, using noVNC, I really need to paste certain strings that I’ve already copied to clipboard with Ctrl + C.

The program for the job is xdotool.

sudo apt-get install xdotool

Open your keyboard shortcuts tool, on Xfce it’s in Keyboard settings and Application Shortcuts.

sh -c 'sleep 0.5; xdotool type "$(xclip -o -selection clipboard)"'

Fix Copy/Paste Issue with Facebook Messenger & Posts on Linux (Ubuntu/Debian/Mint)

If you can’t copy and paste properly on Facebook without the comment or message becoming jumbled up, you may have to allow a certain Firefox setting in the about:config that allows clipboard events to function properly on Linux distros.

Open a new tab and type:

about:config

Search for:

dom.event.clipboardevents.enabled

Double click on this entry to set it to true and copying and pasting correctly from the clipboard should function as expected now.

This fixed the issue for me when I could not copy and paste on Facebook messenger or comments on Firefox.

VestaCP: Error Establishing a database connection (Digital Ocean/VPS Fix)

If you have WordPress sites on a VPS with less than 700mb-1gb of RAM, you may experience intermittent MySQL downtime as the service turns itself off when it exceeds your server or allocated resource usage.

The following commands will append to your crontab. This will check if mariadb/mysqld is running, if it’s not running, it will restart it.

If you have MySQL:

echo " * * * * * root /sbin/service mysqld status || service mysqld restart" >> /etc/crontab

If you have MariaDB:

echo " * * * * * root /sbin/service mariadb status || service mariadb restart" >> /etc/crontab

Verify it’s been added with:

cat /etc/crontab

Download a WeVideo video with cURL

Click play on the video. Then right click on the video and inspect element.

Find <video class=”fp-engine”…. and copy the Akamai URL.

Download WeVideo video with cURL

Alternatively click download on the video and once the download starts, cancel it, open your download queue and then right click on the download and copy the download URL.

Copy WeVideo mp4 file name url to download

With either of the above methods to get the URL (which lacks a .mp4 extension), you can use that in your cURL command as follows:

curl -o video.mp4 "paste long download URL here"

Remember to use double quotes “” around the URL.

The reason we use curl -o, instead of curl -O, is that the file name of the download will be something like 1200 characters long which gives us a File name too long error.

It will start downloading like this:
[[email protected]]# curl -o video "http://wevideo-a.akamaihd.net/7hSWWXP2%Fcbhg1zZayqjvbARb73ozXljnFZxHPS2%9cLxLHznbxXZjSx9qbXyA3v1g7qan33FzqRno7vjljWbch1bygzqvz%zqqa%2LAjzLHXH9ASRXoPljgR1lZX9P2jWFXhacbyoq"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 212M 100 212M 0 0 442k 0 0:08:11 0:08:11 --:--:-- 541k