Update the BIOS without CPU on MSI B450M Mortar motherboard for 3rd Gen AMD RYZEN

July 2019 the 3rd generation AMD Ryzen hit the shelves. Examples are the Ryzen 5 3600, the 3600X and the 3700X.
These CPUs are brand spanking new, and so are likely to not be supported by the BIOS versions factory installed on most motherboards.
Most BIOS update procedures require an older, supported CPU. If you do not have one of these, there is a way to update some motherboards without a CPU installed.

MSI manufactures a couple of motherboards with the Flashback option, that requires only power to the motherboard, and a USB pendrive with the ROM, to update the BIOS:

  • MSI B450 Gaming Plus
  • MSI B450 Gaming Pro Carbon AC
  • MSI B450 Tomahawk
  • MSI B450-A Pro
  • MSI B450M Bazooka Plus
  • MSI B450M Gaming Plus
  • MSI B450M Mortar
  • MSI B450M Mortar Titanium
  • MSI X370 Gaming M7 ACK
  • MSI X370 XPower Gaming Titanium
  • MSI X470 GAMING M7 AC

This video demonstrates how to use the flash button of the MSI B450M Mortar motherboard to update the BIOS without a CPU installed.

The video shows how to:

  • Format a USB drive with FAT32 and Master Boot Record
  • Prepare a MSI.ROM file with the bios data
  • Start the flash procedure without cpu, ram and graphics card installed
  • Shows the different ways in which the red flash led and the usb drive led are flashing during the next minutes
  • Show the different ways in which the CPU not detected EZ Debug led is turned on and off on the next boot
  • Show the EZ Debug lights during a successful boot

DISCLAIMER: Use at your own risk. No warranties are implied by this video!

Advertenties

Download youtube video’s to watch with Plex with automatically translated subtitles

There is so much entertaining, funny and educative material available on Youtube, most of which is in english. Some of the video’s have Dutch subtitles.

This is my wishlist for these video’s:

  1. Preference for Dutch and English subtitles, if youtube has them available (automatically translated or not)
  2. Best quality available – this is the default setting for youtube-dl according to the documentation – but specifically for merging into mp4
  3. Converted to MP4, so I can watch it both in the web browser, as well as on the RasPlex, without transcoding (my NAS is not fast enough)

This is my method to watch these video’s with Plex:

  • Log in to my private google account and give the video a like
  • On the NAS make two directories youtube-likes-workdir and youtube-likes
  • In the youtube-likes-workdir directory, run:
    youtube-dl --username  \
     --cookies _youtube-dl-cookies.txt \
     --keep-video \
     --ignore-errors \
     --write-auto-sub \
     --sub-lang 'nl,en' \
     --prefer-ffmpeg \
     --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' \
     --merge-output-format mp4 \
     
    cd ../youtube-likes
    IFS=$(echo -en "\n\b") ; for i in $(ls ../youtube-likes-workdir/*vtt) ; do ln -f "$i" . ; done
    IFS=$(echo -en "\n\b") ; for i in $(ls ../youtube-likes-workdir/*mp4 | egrep -v 'f[0-9]*.mp4') ; do ln -f "$i" . ; done
    

The separation between youtube-likes-workdir and youtube-likes is required to prevent Plex to list video’s twice, which it will do since both separate audio/video and merged video files exist in the workdir, and I want to keep the original files to prevent excessive downloads. As a workaround, Plex is directed to the youtube-likes folder, where only the merged videos and subtitles are linked from the working directory. The last two commands above create these links. Hardlinks in stead of symlinks are required in order for Plex to play the video.

This method works with the latest Plex versions that supports vtt subtitles, as well as youtube 2FA google account authentication.

 

Stop a docker swarm stack and remove volumes

I often want to restart a stack with clean volumes. In swarm mode, docker stack down stops containers (services) and removes the network, but keeps the volumes, so you need to remove the volumes with docker volume rm.

Volumes cannot be removed until a stack has been completely shutdown. If you remove a volume that is still attached to a container, the following error is thrown:

Error response from daemon: unable to remove volume: remove mystack_myvolume: volume is in use.

Since it is quite annoying to retry this manually, you can use the following threeliner to stop your stack and remove the associated volumes:

docker stack down mystack
sleep 1 | docker volume ls | grep mystack | awk '{print $2}' | xargs docker volume rm -f
while [ $? -ne 0 ]; do !!; done

Increase hyperkit memory for Docker on Mac

I am running the Docker CE version 17.09 on a Mac. The overall experience with the default configuration feels so much like running docker on linux, that you’d almost forget that the docker containers are running in their own VM, with its own disks, cpu and memory settings. Long story short, here is how to watch memory usage, and increase it if necessary.

Enter the HyperKit VM to watch memory usage of the docker host

Enter this command and press ‘enter’ to enter the HyperKit VM

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
<press enter>
free
top
etc..

Increase HyperKit memory

Click the docker symbol in the menuScreen Shot 2017-12-07 at 05.04.01 bar, and select ‘Preferences’ from the docker menu. Then select the ‘Advanced’ tab. Here you will be able to change the amount of memory.

Note that this is maximum memory. The hyperkit vm will not consume that much memory if you do not use it.

Finding the right memory setting for HyperKit

HyperKit’s memory itself can be monitored by the Mac’s Activity Monitor. If you see that it runs to its maximum, check in the hyperkit itself the memory usage is linux filesystem buffers, or real application usage. In the former case, restart docker. In the latter case, you might need to give HyperKit more or less memory, depending on your actual usage.

Background

I was hit by a python command reporting a database crash, after switching from docker-compose to docker swarm mode. The crash looked like a process killed by the OOM killer, but since the setup worked fine in docker-compose mode, I did not immediately suspect memory problems. I watched memory usage on the host with the Mac’s Activity Monitor (wrong, should have accessed the HyperKit VM!) and that did not show excess memory usage. The default settings of HyperKit of 2GB prevented my application from using more memory, and crash instead.

 

Mirror (open) source projects with Gitlab

The recent EES and Bronze editions of Gitlab have a great feature for automating mirroring source projects. If your project depends on open source projects that are not under your control, mirroring is a wise choice. Full documentation is available at Gitlab Repository Mirroring

The mirroring feature is not available in the free plan, upgrade to the bronze plan – $48 per year – is required. I could spend some time writing my own mirroring software using git (set remotes, fetch all, pushing and monitoring the processes), but getting this right and monitoring it, would take probably more of my spare time than I would value $48, and also.. Gitlab is great software, why not just support it!

This screendump shows how to create a new project from an existing git url:

mirrorprojectIf you do not have a paid subscription, the project settings -> repository will show that you need to upgrade to get access to the repository mirroring feature:

upgradeplan

Migrating PyPI packages to a newer python minor version

The output of pip-freeze contains version numbers of all installed packages. I do not want to restrict package version numbers, unless there is a problem with some package. The solution is to use pip-chill. If you use a virtualenv, activate it and run

pip install pip-chill
pip-chill --no-version > requirements.txt.no-version

In the new virtualenv — I needed to upgrade from 3.4 to 3.6, see Install a Python 3.6 virtualenv with no site packages on a mac — you can then run

pip install -r requirements.txt.no-version

If a package caused troubles, instead of trying to get that package to work, perhaps it is not required anymore. In my case ‘mlab’ caused problems, so

for i in $(grep -v 'mlab' requirements.txt.no-version) ; do pip install $i ; done

 

 

Install a Python 3.6 virtualenv with no site packages on a mac

I needed to upgrade from python 3.4 to 3.6 to be able to use the SIP library required by PyQt5. Using brew virtualenv-3.x failed and pyenv has been deprecated as of python 3.6.

brew install python3
brew link --overwrite python3
deactivate
python3.6 -m venv ./pyenv
source ./pyenv/bin/activate

The defaults of the venv command, pip installed, and no system packages, are exactly what I required. For more information refer to pythons venv command.

See also Migrating PyPI packages to a newer python minor version for a quick method to populate your new environment with the packages from a previous environment.