Zum Inhalt

Autor: Florian Panzer

Systemadministrator aus Bamberg.

Ich bin auch bei Twitter und Google+

How to remove all backups in Plesk for Linux

If you ever find yourself confronted with a Plesk system that is running out of disk space, and you just want to get rid off all the misconfigured „keep forever“ backups, here’s how to remove them all from the command line:

/usr/local/psa/admin/bin/pmm-ras --get-dump-list | egrep "name=\".*.xml" | awk -F '"' '{ print $2 }' | xargs -I {} /usr/local/psa/admin/bin/pmm-ras --verbose --debug --delete-dump --dump-specification={} --session-path=/var/log/plesk/PMM
Leave a Comment

Windows 10: Creating boot partitions from scratch

First, boot a Windows 10 or Windows Server 2019 rescue CD and enter the command prompt.

Step 1a: If you have the 128MB + 100MB partitions and they are broken for some reason

list disk
select disk
list part
# visually check you are about
# to do the right thing
select part 1
delete part override
select part 2
delete part override

Now continue with step 2.

Step 1b: If you don’t have at least 228MB of unpartitioned space in front of your Windows partition

Boot the gparted Live CD and move your Windows partition to the right, 250MB is usually fine, then continue with step 2.

Step 2: Recreating the UEFI boot partitions and installing the bootloader:

create partition efi size=128
format quick fs=fat32 label="System"
assign letter="k"
create partition msr size=100
exit

bcdboot C:\windows /s k: /f UEFI

Step 3: Profit

That’s all there is to it! Make sure to set your computer to UEFI ONLY, because it’s past 2020.

Leave a Comment

How to hibernate and resume from swap file in Ubuntu 20.04 using full disk encryption

On my laptop, I am running full disk encryption (LUKS with a single encrypted ext4 partition), and a single, large swap file as large as my system RAM (16GB).

Here’s how to make it work:

Make your swapfile have at least the size of your systems RAM:

sudo swapoff /swapfile
sudo dd if=/dev/zero of=/swapfile bs=$(cat /proc/meminfo | grep MemTotal | grep -oh '[0-9]*') count=1024 conv=notrun
sudo mkswap /swapfile
sudo swapon /swapfile

Note the UUID of the partiton containing your swapfile:

$ sudo findmnt -no SOURCE,UUID -T /swapfile
/dev/nvme0n1p5 20562a02-cfa6-42e0-bb9f-5e936ea763d0

Reconfigure the package uswsusp correctly:

sudo apt -y install uswsusp
sudo dpkg-reconfigure -pmedium uswsusp
# Answer "Yes" to continue without swap space
# Select "/dev/disk/by-uuid/20562a02-cfa6-42e0-bb9f-5e936ea763d0" replace the UUID with the result from the previous findmnt command
# Encrypt: "No"

Edit the SystemD hibernate service using sudo systemctl edit systemd-hibernate.service and fill it with the following content:

[Service]
ExecStart=
ExecStartPre=-/bin/run-parts -v -a pre /lib/systemd/system-sleep
ExecStart=/usr/sbin/s2disk
ExecStartPost=-/bin/run-parts -v --reverse -a post /lib/systemd/system-sleep

Note the offset of your swapfile relative to the partition start:

$ sudo swap-offset /swapfile
resume offset = 34818

Tell grub to resume by editiing your etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=20562a02-cfa6-42e0-bb9f-5e936ea763d0 resume_offset=34818 quiet splash"

Update grub:

sudo update-grub

Create /etc/initramfs-tools/conf.d/resume

RESUME=UUID=20562a02-cfa6-42e0-bb9e-5e936ea763d0 resume_offset=34816
# Resume from /swapfile

Update initramfs:

sudo update-initramfs -u -k all

Now you can just hibernate your system with

sudo systemctl hibernate
1 Comment

Clean default sources.list file for Ubuntu 20.04 focal

deb http://de.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

deb-src http://de.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner
Leave a Comment

Saving battery life on linux using powertop

Most distributions come with a handy tool called powertop, that is able to automatically set kernel parameters to save energy.

sudo powertop --auto-tune

Settings are not permanent, to you can use the following snippet to create and load a systemd unit file to load the settings after rebooting your machine:

cat << EOF | sudo tee /etc/systemd/system/powertop.service
[Unit]
Description=PowerTOP auto tune

[Service]
Type=idle
Environment="TERM=dumb"
ExecStart=/usr/sbin/powertop --auto-tune

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable powertop.service
systemctl start powertop.service

Leave a Comment

Xiaomi Robot Vacuum 4S2P DIY Battery Pack Repair

My Xiaomi Robot (V1) just sporadically shut down after around 20 Minutes of cleaning, stating „Error 14“. I looked it up, and Error 14 stands for battery malfunction.

Since i own a lot of 18650 battery packs I’m able to build my own battery from old laptop battery 18650s, so I decided to upload the pinout of the Xiaomi Charging Pad

Solder your 4S cells here and you’re good to go!

3 Comments

gentoo/octane – A modern GNU/Linux system for the SGI Octane Workstation

It took about 6 months of work, and it’s done: gentoo/octane 1.0 has been released.

Grab your copy here: gentoo-octane-v1.0-by-rephlex.tar.xz

It’s basically a complete tarball of the system. So:

  • attach scsi disk to any machine or netboot the octane using root=/dev/nfs nfsroot=a.b.c.d/path/to/filesystem (if you’re a tough guy)
  • prepare the octanes local disks
  • add tarball
  • set envvars (included)
  • profit

What works:

  • everything that would work in any random gentoo that is up-to-date as of April 2019 😉
  • Kernel 4.12 with audio, and all the funny devices inside the octane including impact graphics.

What doesn’t work yet:

  • xf86-video-impact xorg module ;/ – see /etc/motd for how to achieve running xorg. It’s ALMOST DONE!
  • Kernel newer than 4.12. The patches need to be tested and maybe adjusted, that’s it.

IF YOU HAVE THOSE PATCHES, PLEASE CONTACT ME!

If you want to donate money, my paypal is rephlex@rephlex.de 😉

2 Comments

Preferred settings for Macs Fan Control on older iMacs that run hot and make funny noises

Yesterday I encountered a customers iMac which ran crazy hot on the backside. Macs Fan Control indicated that the PSU was running on 70°C and more, and something made a buzzing sound (like a wire dangling inside a fan, which was not the case).

So I decided to set up the fans manually, the Mac now runs much cooler and still it’s not too loud.

Here’s my settings:

Set everything to manual
ODD Fan is controlled by GPU Diode. 40°C – 75°C (this controls the right hand side of the iMac)
The HDD fan is controlled by the HDD temperature. We set it to 45°C – 55°C. If your disk runs hotter, you’ll shorten its lifetime and jeopardize your data. This stuff is sitting in the middle of the iMac case.
OK, and this one here is most important. Set the CPU fan to be controlled by the PSU Primary temperature.

I learned that Apple did decide to „cool“ the PSU by blowing the CPUs hot air onto it. Duh. So since we need to make sure the PSU does not overheat and melt your display panels LED strips on the right side, we set the CPU fan speed in relation to the PSU temperature. We want the PSU to be 40°C – 53°C. The CPU temperature will also stay in this healthy temperature range.

Download Macs Fan Control on the dev’s website, on github, or from my local mirror (v4.1.12).

Leave a Comment

Fix IcedTea „cannot grant permissions to unsigned JARs“ error

In case you are a Linux user unsuccessfully trying to connect to your IPMI/LOM Console using IcedTea / OpenJDK 8 or newer, you will likely run into this error.

You know, because if you’re a major hardware vendor selling expensive enterprise class servers, you don’t care about your IPMI hardware once you sold it.

Here’s how to fix the issue on the client side:

Find the java.security file. In my case it is located in /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

Then find the row

jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024

Comment it out, copy it, delete the word „MD5“.

jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024

1 Comment