How to create a 3-in-1 bootable usb drive on Linux

A usb drive with only 1 partition to load grub2 on usb-bootable machines with Legacy BIOS, 64bit UEFI or 32bit UEFI.

Note: due to the maximum size of a file inside an EFI system partition, files (such as ISO disk images) of 4 GiB or larger must be placed on another partition. That second partition can be of type ext4, for instance.

Partition the drive and install grub2

Warning: the usb drive will be formatted, save your data before proceeding!

First of all, on you current installation, check if the folder /usr/lib/grub/ exists and is not empty. If it is empty or does not exist, make sure the package grub-common (or equivalent for your distribution) version 2 or higher is installed. Depending on the system, /usr/lib/grub/ will contain one or more of the following folders: x86_64-efi, x86_64-efi-signed, i386-pc, i386-efi, …

The x86_64-efi, i386-pc and i386-efi folders need to be present in order to install the corresponding bootloader on the usb drive. Continue reading

Raspberry Pi PXE Boot – Network booting a Pi 4 without an SD card

Install Raspbian on an SD card and install needed tools

Let’s start configuring your client system for netboot. This is the Raspberry Pi that will eventually boot without a micro SD card installed.

  • Download PiOS Lite. For this tutorial I used the Bullseye release.
  • Copy the Bullseye image onto an SD card. I suggest using the PiOS Imager. Warning! This will overwrite data on the device specified. Triple check you are writing to the SD card and not your laptop drive!
  • Put the SD card in your client Raspberry Pi 4 and boot it. Using the lite version of raspbian give you a text console only. If you want a graphical console you can use the full version and it should work. I have not tested this workflow with the full version.
  • Log in via the console using the login you created with the Imager.
  • Connect your Raspberry Pi to the internet via an ethernet cable.
  • Update PiOS via apt-get and install the rpi-config program:

Continue reading

How to Backup IMAP Mailboxes and Nextcloud Calendars, Contacts, and Notes

To backup all IMAP mailboxes for a user account, first download Rick Sander’s IMAP tools and save them somewhere on your system. Next, create a cron job and have it execute the following command:

mkdir -p /tmp/IMAP_$(date +%Y-%m-%d) && /path/to/imapdump/imapdump.pl -S example.com:993/user/password -f /tmp/IMAP_$(date +%Y-%m-%d) && cd /tmp/IMAP_$(date +%Y-%m-%d) && zip -r /backup/path/user@example.com_$(date +'%m-%d-%Y').zip user@example.com && chown user:user /backup/path/user@example.com_$(date +'%m-%d-%Y').zip && rm -Rf /tmp/IMAP_$(date +%Y-%m-%d)/user@example.com && find /backup/path -type f -mtime +90 -delete

To backup Nextcloud calendars and contacts, create a cron job running as root and have it execute the following command:

wget --directory-prefix=/tmp/nc-backup --user=ncuser --password=ncpassword --timestamping https://example.com/remote.php/dav/calendars/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/personal-1?export https://example.com/remote.php/dav/addressbooks/users/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/contacts?export && mv /tmp/nc-backup/personal-1?export /backup/path/calendar_$(date +'%m-%d-%Y').ics && mv /tmp/nc-backup/contacts?export /backup/path/contacts_$(date +'%m-%d-%Y').vcf && find /backup/path -type f -mtime +90 -delete

For Notes, do the same thing as above but execute the following instead:

mkdir -p /tmp/nc-backup && cd /nextcloud/path/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/files && zip -r /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip Notes && chown user:user /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip && mv /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip /backup/path

How to solve delete file “Operation not permitted” on Linux

Sometimes it is necessary to prevent all users including root from deleting a file. This is often done by changing the file attributes on a Linux file system. The tool used to change file attributes in Linux and other Unix systems is chattr and the tool used to view the newly set attributes is lsattr.

The format of a symbolic mode is +-=[acdeijstuADST]. The format of a symbolic mode is +-=[acdeijstuADST] and they select the new attributes for
the files.

  • The operator ‘+’ causes the selected attributes to be added
    to the existing attributes of the files
  • ‘-’ causes them to be removed
  • ‘=’ causes them to be the only attributes that the files have.

See explanation of all letters used below:

Continue reading

How to Install Webmin+Nginx+Nextcloud+Syncthing on a Raspberry Pi 4

Flash Pi OS Lite to a micro SD card.

Install Webmin

If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the line:

deb https://download.webmin.com/download/repository sarge contrib

You should also fetch and install the Webmin GPG key with which the repository is signed, with the commands:

wget https://download.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

You will now be able to install with the commands:

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install webmin

All dependencies should be resolved automatically.
Continue reading

How To Install Nextcloud On A Synology NAS

This post should tell you everything you need to know to install Nextcloud instance on your Synology NAS without using Docker.

I previously published a post on how to setup Pi-Hole on a Synology and since then a number of people have asked for a guide on how to install Nextcloud on a Synology. After lots of tinkering, this post is the result.

I’ve talked about Nextcloud vs Synology before, and why I think Synology is the better choice for a home server. However, by using this guide you don’t need to choose – you can install Nextcloud on your Synology NAS!

This is likely to be another long post, so let’s get cracking shall we?

Setup DNS

Once Nextcloud is all setup and working on your Synology NAS, you will probably want to access it via a nice URL, usually a subdomain like nextcloud.example.com. If that’s the case, make sure you log into the DNS provider for your domain (this is usually the registrar you registered the domain with) and configure an A record that points to the public IP address of your Synology NAS. Continue reading

How to Flash Lineage OS on an LG V20 Phone

This method will, when completed, will provide you with root and an unlocked bootloader, with fastboot available. It is a somewhat involved process, but the majority of the process has been simplified as much as possible.

WARNING!!!!This replaces your current bootloader with a debug bootloader. If you attempt to lock this bootloader you may brick your device.
Currently AT&T(H910) and Sprint(LS997) cannot return to stock because no KDZ files are available.

Disclaimer:
Once your phone is unlocked, it will no longer be covered by LG warranty @me2151.
As we cannot guarantee the proper operation of our hardware with custom software, we are not able to maintain the full scope of warranty for your device after you have unlocked the bootloader.
Because of that we have a responsibility to let you know that defects which may result from, or were caused by custom device-software may not be covered by LG warranty @me2151. Continue reading

How can I remove the GUI from Raspbian/Debian?

$ sudo apt-get --purge remove "x11-*"

This will remove all the packages that are under x11 which is the library with all the graphical packages. the option –purge allow you to delete all the config file related.

$ sudo apt-get --purge autoremove
autoremove removes all the unused packages. There are a lot of unused packages after the first command.

Reference

https://raspberrypi.stackexchange.com/questions/5258/how-can-i-remove-the-gui-from-raspbian-debian

How to fix raspi-config “The splash screen is not installed so cannot be activated”

Problem:

You want to enable the boot splash screen on your Raspberry Pi using raspi-config, but you see this error message:

The splash screen is not installed so cannot be activated

followed by There was an error running option B3 Splash Screen

Solution:

As you can find out from reading the raspi-config source code, it checks for the existence of /usr/share/plymouth/themes/pix/pix.script. In order to install this file, install the rpd-plym-splash package.

Reference

https://techoverflow.net/2020/06/13/how-to-fix-raspi-config-the-splash-screen-is-not-installed-so-cannot-be-activated