Author Archives: Scott Alfter

Cheatsheet: install debloated Windows 11 on QEMU

This pulls together tips from https://christitus.com/windows-11-perfect-install/, https://christitus.com/install-windows-the-arch-linux-way/, https://blogs.oracle.com/virtualization/post/install-microsoft-windows-11-on-virtualbox, and some other sources I’ve forgotten. It’s mainly aimed at getting Win11 running under QEMU on Gentoo Linux, but should also work for bare-metal installs, QEMU on other platforms, or other virtualization platforms (VMware, VirtualBox, etc.).

  1. Verify kernel prerequisites as described in https://wiki.gentoo.org/wiki/QEMU
  2. Install app-emulation/qemu and app-emulation/libvirt
  3. Start /etc/init.d/libvirtd, and add it to the default runlevel:
    sudo rc-update add libvirtd
  4. Add yourself to the kvm group:
    sudo usermod -aG kvm `whoami`
  5. Download the latest Win11 ISO from https://www.microsoft.com/software-download/windows11
  6. Download the latest libvirt driver ISO from https://github.com/virtio-win/virtio-win-pkg-scripts/
  7. Start virt-manager and create a new VM, installing from the Win11 ISO. Most defaults are OK, with the following exceptions:
    a. Change virtual disk storage bus from SATA to virtio
    b. Add new storage, select the driver ISO, and change type from disk to CD-ROM
    c. Change network device type from e100e to virtio
  8. Start the VM; Win11 setup should begin.
  9. Disable TPM and Secure Boot checks in the installer:
    a. When the installer begins, press Shift-F10 and launch regedit from the command prompt.
    b. Add a new key named LabConfig under HKLM\SYSTEM\Setup
    c. Add two new DWORDS to HKLM\SYSTEM\Setup\LabConfig named BypassTPMCheck and BypassSecureBootCheck, and set both to 1.
    d. Exit Regedit, close the command prompt, and continue.
  10. Optional: when prompted during installation, select “English (World)” as the time and currency format. This causes a bunch of bloatware and other crap to not be installed.
  11. After installation on the first boot, press Shift-F10 again and enter this to cut OOBE short:
    oobe\BypassNRO
    This will trigger a reboot, followed by a less intrusive offline OOBE process (necessary because the virtual NIC isn’t working yet, and it’s a good idea anyway).
  12. Once the system’s up and running, run virtio-win-guest-tools.exe from the driver ISO to install the remaining needed drivers and other tools.
  13. If you selected “English (World)” as the time and currency format when installing, start intl.cpl and make sure all settings are as they should be (whether “English (United States)” or whatever’s appropriate for you). Do the same for “region settings” in the Settings app.
  14. Open Microsoft Store, search for “App Installer,” and update it…need to do this for Winget to work. (TODO: is there a way to do this with a normal download instead?)
  15. Open a PowerShell admin window and launch Chris Titus’s tweak utility:
    irm christitus.com/win | iex
    Use it to debloat your system, install the software you want, etc.
    Warning: Removing the Edge browser with this utility may break other apps (I know for certain that Teams won’t work), and it might not be possible to get it working right again without a full reinstall. It appears that Edge is embeddable within applications in much the same way that Internet Explorer was once embeddable. Plus ça change
  16. Check for Windows updates in the usual manner.

More Win11-without-TPM/Secure Boot tricks

https://nerdschalk.com/install-windows-11-without-tpm/ has several methods that might be useful, especially for upgrading from Win10 or earlier (as opposed to the clean install described above).

For upgrading to Win11 22H2 from an earlier version, https://jensd.be/1860/windows/upgrade-to-windows-11-22h2-on-unsupported-hardware should be useful.

Two-Tier Justice

We are no longer a nation of laws:

Wesley Snipes – 3 years in prison for tax evasion.

Mike Sorrentino, Jersey Shore – 8 months in prison for tax evasion.

Ja Rule – 28 months in prison for tax evasion.

Darryl Strawberry – 3 months in prison, 3 months of house arrest for tax evasion.

Fat Joe – 4 months in prison for tax evasion.

Joe and Teresa Guidice – 4 years and 1 year in federal prison for tax evasion.

Heidi Fleiss – 37 months in prison for tax evasion.

Chuck Berry – 3 months in prison for tax evasion.

Richard Hatch – 51 months in prison for tax evasion.

Leona Helmsley – 4 years in prison for tax evasion.

Hunter Biden – No JAIL TIME

So no liberals, tax evasion crimes absolutely result jail time. Unless you are the crackhead son of the most corrupt administration in the history of this country.

https://twitter.com/DefiyantlyFree/status/1671247236678963200

On “insurrection”

Perhaps this would’ve been more timely closer to 6 January 2021, but it’s no less timely now that we have proof the government has been lying about the origins of the recent “pandemic” (among other things). The next time you hear some idiot in Congress, the White House, or wherever bleating about “insurrection,” keep this quote in mind:

We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness.–That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, –That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness.

— Declaration of Independence

For how much longer will you consent to the current form of “governance?”

CH32V links and cheatsheet

A while back, I found this Hackaday article that led me down a rabbit hole of cheap RISC-V microcontrollers. This post will mainly be a link dump and random notes on making use of these devices.

An ffmpeg cheatsheet

I recently had some need to clean up the subtitles in some video files in my possession. It took a little while to track down the exact set of options to get it to do what I wanted it to do, so I’ve written them down here for future reference. This post may be amended from time to time to add more

Extract subpictures from file

The second number in the -map parameter selects the (zero-indexed) stream to extract. Use something like mediainfo to determine which stream to select, then issue something like one of these:

ffmpeg -i src.m4v -c copy -map 0:2 dest.en.sup  # Blu-ray subpictures
ffmpeg -i src.m4v -c copy -map 0:2 dest.en.vob  # DVD subpictures

Subtitle Edit can read subpictures and convert them to text subtitles. As long as you have a .NET runtime available, it should work; I’ve run it on Windows 11 and Gentoo Linux. Its accuracy is pretty good, especially if you have it use one of the Tesseract OCR engines.

Extract text subtitles from file

ffmpeg -i src.m4v -f srt dest.en.srt

“srt” can be replaced with several other formats (ssa, ass, etc.) if you want those. Depending on the source, there may be extra HTML formatting that you might want to use sed to filter out. If more than one subtitle stream is present, a “-map” parameter may be necessary to select the one you want.

Mux text subtitles into file

ffmpeg -i src.m4v -i src.en.srt -c copy -c:s mov_text -map 0:0 -map 0:1 -map 1:0 -metadata:s:2 language=eng -metadata title= dest.m4v

Assumptions: the desired video and audio are in the first two streams of the first file, and the subtitles are in English. (Audio language should already be set in that stream to whatever it is.)

“-metadata title=” will clear out the title string that might have been set in the original file.

Selecting tracks by language

Instead of needing to look up track numbers, it’d be nice to just specify the language(s) we want to include. That is possible, with something like this:

ffmpeg -i src.mkv -c copy -map 0:v:0 -map 0:a:m:language:ger -map 0:s:m:language:eng dest.mkv

This example selects German audio and English subtitles…useful for something like Das Boot or Deutschland 83. (Assuming that you like foreign shows in their original language with English subtitles, anyway…which I do.) These track mapping options should also apply in the preceding examples.

Extracting chapters from existing file

ffmpeg -i src.mkv -f ffmetadata src.metadata

This creates a file with chapter information (and possibly other metadata) structured like this:

;FFMETADATA1
encoder=Lavf60.3.100
[CHAPTER]
TIMEBASE=1/1000
START=0
END=728102
title=Chapter 1
[CHAPTER]
TIMEBASE=1/1000
START=728102
END=1319902
title=Chapter 2
[CHAPTER]
TIMEBASE=1/1000
START=1319902
END=2008965
...

Inserting chapters

A metadata file structured as above can be inserted into a file when it’s encoded:

ffmpeg -i src.mkv -i src.metadata -map_chapters 1 ...

Audio: transcode anything to AAC

This preserves metadata (including cover art)…tested with FLAC sources, but should work with others:

ffmpeg -i src.flac -c:a libfdk_aac -b:a 128k -c:v copy -disposition:v:1 attached_pic dest.m4a

On Trump and taxes

According to the Epoch Times, Donald and Melania Trump reported negative income in four of the six years’ worth of tax returns that were dumped. I’m sure the usual scumbags will try to make something of this, but as long as all the “I”s are dotted and “T”s are crossed, I don’t see anything at all wrong with this:

Anyone may arrange his affairs so that his taxes shall be as low as possible; he is not bound to choose that pattern which best pays the treasury. There is not even a patriotic duty to increase one’s taxes. Over and over again the Courts have said that there is nothing sinister in so arranging affairs as to keep taxes as low as possible. Everyone does it, rich and poor alike and all do right, for nobody owes any public duty to pay more than the law demands.

– Learned Hand