Записи за месяц: October 2020

Лето 2020

Сделал скрипт для выкладывания фоточек “как на imgur”, выложил кучу чего видел:

Фоточки!

Папе рассказываю: – Это червяк из Италии, его к нам завезли и ему тут понравилось.
Папа говорит:
– Это да, у нас в стране много разных гадов прижилось.

Что значит работать через прокси! В гугл мапс изучаю учреждение. желая разглядеть его получше, нажал “построить маршрут”.
– Сначала вам надо сесть на самолёт, – говорит Гугл.

– А ещё есть какие-то СберМобайл, оказывается…
– СберМобайл это в подворотнях стоят, ты заходишь к ним, а они у тебя сбер мобайл

Вино “ч.лек”, “чёрный лекарь”. Такой вот чаёк!

Windows, AHCI/RAID and INACCESSIBLE_BOOT_DEVICE

When you switch SATA from AHCI -> RAID or back in BIOS, Windows may fail to boot with INACCESSIBLE_BOOT_DEVICE. There are several pieces of advice on the internet that work only sometimes. You will now understand why. This is an ultimate guide to fixing every driver-related INACCESSIBLE_BOOT_DEVICE out there.

You can jump straight to instructions but life is messy and blind copying often doesn't work.

TLDR Why this happens

Windows needs to see the disk from which it boots. Bootloader initially cheats and jumpstarts Windows, but then Windows needs to quickly load drivers that can talk to the disk properly.

INACCESSIBLE_BOOT_DEVICE happens if after loading all boot-time drivers Windows doesn't see the boot disk runtime device around.

How Windows loads drivers

Every PNP device has an ID, something like VEN_8086&DEV_06D6&SUBSYS_86941043&REV_00. Each driver has an INF file which lists the devices it can service. Windows keeps a library of known drivers ("Driver Store"). When it discovers a new device it looks through that library for a driver that can handle it.

If Windows finds a compatible driver it installs it and saves the device permanently in the registry. Next time it sees the same device it will load that installed driver directly. The devices are saved in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum.

A driver is a program running in the background. When Windows loads a driver for the device it explains which device has to be serviced (by giving it that registry key). The driver then creates a runtime device object. Only one copy of the driver will be running even if it services multiple devices.

So there are three different things:
– Hardware device attached to the PC, known to Windows by its PNP ID
– Registry entry for the device's PNP ID
– Runtime device object

Hardware device that has no driver won't get a registry entry and a runtime device object. You can still see such devices in the Device manager with an exclamation mark.

If you detach an installed hardware device its registry entry will remain. But a driver won't be loaded and a runtime device object won't be created. You can see such devices if you check "Show hidden devices" in Device manager.

You can check the attached PNP device IDs with a tool like devcon.exe. (Note that Windows won't see PNP IDs of devices attached further to the devices it has no drivers for).

Boot devices

Boot devices are those that are critical for Windows to boot. Disk controller is a prime example.

Windows cannot install devices and drivers at boot time. The Driver Store and the registry itself are stored on disk which is inacessible. All the boot devices and drivers have to already be in the registry (which is read once at the very beginning, via cheats).

This is why you can replace your graphics card and Windows may find new drivers automatically but you cannot simply switch from AHCI to RAID and back. Your "AHCI controller" will disappear and a new "RAID controller" appear; Windows cannot install drivers for this new device at boot time.
You have to boot to install drivers but you have to have drivers to boot.

Thankfully many drivers will discover "their" devices even without registry entries. For these devices it's enough to have the driver itself registered and started at boot; it'll create runtime objects, you don't need to have CurrentControlSet\Enum device keys.

This is why there's advice to preinstall RAID controller drivers. If you preinstall the drivers and configure them to auto-start despite not having any devices to service (another piece of advice), the drivers just might see their devices and let you boot – where you can install the devices properly.

How Safe Mode is different

There's advice to enable RAID and boot to Safe Mode first. Why?

In Safe Mode, Windows automatically boots all boot-time drivers even if there are no registered devices that need that. So this advice still needs you to preinstall RAID controller drivers, and it's the same as configuring those drivers to auto-start, only safer and easier.

oem*.inf and installed third-party drivers

Once Windows installs a driver, it creates a key for it in the registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services. This key controls when the driver is started and lists devices associated with it.

Drivers can be forcefully installed by installing their inf files. There's a number of ways to do that, one is to right-click the file and choose "Install". Another is pnputil /add-driver.
INF files that are installed this way are copied into Windows with names like oem0.inf, oem1.inf etc. You can list all third-party drivers with pnputil /enum-drivers or dism /Online /Get-Drivers or uninstall them with either of these utilities.

Simple case: Preinstall drivers

The standard advice just may work in many cases:

  1. Install latest drivers for your RAID controller, either via setup or by force-installing their INF files if the installer seems too smart for its own good.
  2. If you have older versions of the same driver installed you may choose to delete them to be on the safe side.
    To do this, reboot after installing the new version to hopefully let all devices switch to the newer versions. Use dism /Get-Drivers or pnputil to enumerate all oem*.inf drivers. Find the ones to be deleted and use pnputil to delete them.
  3. Reboot in RAID mode and go straight to Safe Mode. Hopefully your boot-time RAID controller driver will load, see the RAID controller and let Windows boot from it.
  4. Install RAID controller drivers again from Safe mode to register the device properly.

Why can this process fail?

  1. Your RAID controller driver does not auto-discover supported devices.
  2. Some INF files are written in a way that if they don't see the device at the moment of installation they won't install everything that's needed to run it.
    A popular example is iaStorAC.inf. When preinstalled on a system without RAID controller attached it won't install iaStorAfs filter driver. When you later reboot in RAID mode it sees a RAID controller but fails to initialize because iaStorAfs is not installed.

In both cases it's not enough to preinstall a driver; you also need a registry key for a device.

Messy case: Preinstall a boot time device

Now that you know everything you may imagine a number of solutions such as manually installing iaStorAfs. But here's a more resilient version.

  1. Prepare a flash drive with unpacked drivers for your RAID controller and a number of utilities, including devcon.exe. All utilities must be of exactly the OS bitness – 32bit emulation doesn't work in recovery mode.
  2. Boot into recovery mode and open command prompt.
  3. Use devcon to list all devices in the system. Find the RAID controller and take note of its PNP ID. Open your driver's inf file and check that it services this PNP ID. If not, you need newer drivers.
  4. Open your driver's inf file and check that if it's install sections have OS identifiers attached (".NTamd64-10.0.1") then your OS is supported. See INF format docs, Manufacturer section.
  5. Use Windows\System32\drvload.exe to load your RAID controller driver.
  6. If everything goes right, this recovery system now has that driver loaded!
    Check the device list again to verify that the RAID controller now has a more personalized name. Check that the device list now has your hard drive too or use diskpart list disk to verify that the disk is visible.
    If something went wrong, stop at this point. Figure out why the driver isn't loading. It's pointless to try and install a driver that doesn't load.
  7. Start regedit. This system now has the driver and the device installed. Go to the following keys and export them as reg files to your flash or hard drive.
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_8086&DEV_06D6&SUBSYS_86941043&REV_00
      This is the device node. Find the one matching your PNP ID.
    • HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e97b-e325-11ce-bfc1-08002be10318}This is the class registration node. This one is for SCSI controllers; if you need a different one, find it by looking inside them

    For the good measure look up all places in the registry where oem0.inf is mentioned (that's how Windows renamed the inf you've just installed). Export all those.

  8. Now disable the RAID mode and reboot into normal OS.

You now have registry export files with registration information for the RAID controller device. Your have to adjust these files and import them, making this copy of Windows think it saw this device.

What do you need to adjust?

  1. Preinstall the driver as per simple case. Take note of what "oem*.inf" name it got.
  2. You'll only need to import the Enum\PCI\… and Control\Class\.. files. The rest are just in case.
  3. In both of those, replace oem0.inf with the oem*.inf for your imported driver.
  4. Go to the registry and find those keys. See which 0000, 0001 etc keys are already there; change your reg files so that they take the yet unused key numbers.
  5. Delete any parts of those files that duplicate the already existing keys. For instance, all key=value pairs directly inside Control\Class\{4d36e97b-e325-11ce-bfc1-08002be10318} are not needed. Leave only keys directly related to your device, the less you touch things outside of that, the better.
  6. Very carefully take ownership of both of the keys where you're going to import these, and give your account full permission. Make sure SYSTEM, Administrators and other accounts that had permissions over those keys before get to keep them.
  7. Import the reg files. If there are any problems, stop here and solve them until the import works. Verify that what you have in the registry now matches the reg files.
  8. Reboot the PC normally. Now go to the Device Manager and enable "Hidden devices". You should see that RAID controller that you've just imported as a reg file. If you don't, solve this before going further.

Okay, now you have an offline device for your RAID controller! From here on try these actions, starting from the simplest:

  1. Reboot into RAID mode. Things may just work.
  2. Reboot into RAID Safe mode. If successful, install the drivers.
  3. If neither RAID normal nor RAID safe mode boots, but you still see the RAID controller in "Hidden devices" in AHCI mode, try installing RAID drivers from AHCI mode, preferably via their setup.
  4. As a last resort, right-click the "hidden device" in Device manager and "Update drivers" this way. Then try booting in RAID Safe mode again.

Additional help

Use pnputil and devcon to manage drivers and devices.

Use dism /Online /Get-Drivers. Dism is available even in the recovery console and while it can't uninstall drivers from /Online systems (use pnputil), in recovery console it CAN uninstall from the main OS.

If you're stuck in a recovery loop (without Windows even attempting to boot into normal mode), do bcdedit /set {current} recoveryenabled No. After that you'll be getting a bluescreen instead of going into recovery, and what would you think! You can STILL go into recovery from that bluescreen, but you also get a problem description and you can also restart in Safe Mode and other things.

To access the main OS registry from recovery, open regedit, select HKEY_USERS and File > Load hive. Load the Windows\System32\drivers\config\SYSTEM for HKEY_LOCAL_MACHINE from your main OS. It'll load under HKEY_USERS so importing .reg files won't work but you can edit things by hand.

For the purposes of this guide drive letters don't matter. In earlier Windows versions drive letters could become mixed and Windows would fail to find C:\Windows because it's now D:\Windows. This can still happen later in the boot process but the kernel and the bootloader are now mostly drive letter agnostic, they know how to tell one physical disk-thing from another. If it says INACCESSIBLE_BOOT_DEVICE then it's really inaccessible.

Озимандий

Наткнулся на диски с музыкой, которые я записывал лет 15 назад.
Диски называются:
“Music #001”.
“Music #002”.
“Music #03”. На третьем диске я начал подозревать, что трёхзначная нумерация для нашей изменчивой жизни слишком велика.

Четвёртого диска нет.

Paint it black

Я раньше Paint it black воспринимал просто как обрывочную песню кого-то поехавшего. Вижу дверь, надо перекрасить. Девушки идут в летней одежде, отворачиваюсь, пока тьма не отпустит. Маньяк такой.
Потому её и на вьетамское кино, наверное, налепили. На PTSD очень похоже.

Потом я прислушался — хотя песня лоскутная, но лейтмотив есть. То ли героя бросили, то ли изменили, тоскует по девушке. No more will my green sea go turn a deeper blue. Не потемнеет больше лазурный прибой. I could not foresee this thing happening to you. Кто мог подумать, что так кончится с тобой.

И только год или полтора спустя я прочёл текст песни, казавшийся обрывочным, подряд:
I see a line of cars and they’re all painted black
With flowers and my love, both never to come back
I see people turn their heads and quickly look away
Like a new born baby, it just happens every day

Я вижу ряд машин, угольные цвета
Венки и милую увозят навсегда
Прохожие глянут вслед, их лица лишь тронет тень
Как роды, горе в мире с кем-то каждый день.

Теперь я только одну эту строчку не понимаю. No more will my green sea go turn a deeper blue.

Как я провёл летом

Полная карта всех мест, где я бегал в этом году и немного прошлой осенью (нажимабельна). Всякая мелочёвка тонкими зелёными линиями, велосипед жёлтыми.

С высоты всё такое простое и маленькое! Каждая зелёная ниточка это кварталы, кварталы, переходы, перекрёстки, повороты, улицы, улицы. Представьте, как пробегаете один многоквартирный дом. Попробуйте найти такой дом и отдалить карту!

Самый прямой проспект это Севастопольский. Из одного конца другой почти видно.

Акунин, “Просто Маса”

Как будто разные люди за Акунина пишут. Очередной исторический роман и Аристономия про детский приют — пресные. “А вот если мы поделим детей по таким графам, а взрослых по таким”. Да кто его знает, что получится? Тысячелетиями, каждый строй и каждый уклад поощряют в людях какие-нибудь таланты и делят по заслугам. Это новая мысль? С чего Акунин взял, что взятая наугад классификация Борхеса стоит подробного описания?

Дети так технику рисуют. Вот тут будет левое крыло, вот тут правое, нет вы послушайте, вот тут в носу будет двигатель.
В Аристономии про приют, правда, советская часть была красивой вроде бы.

А “Просто Маса” вдруг прежний Акунин.

Маса слушал и запоминал, а сам решал, что ему делать с этим плохим человеком, исчерпавшим свою полезность. Раньше не колебался бы — прикончил, и дело с концом. Потому что придерживался концепции, гласившей, что чем меньше в мире грязи, тем мир чище. Но во время русской гражданской войны все считали друг друга грязью и чистили мир, чистили, а он становился только грязней. Наверное, чистота достигается какими-то другими способами.

Маса не слишком на себя прежнего похож, но наверное, раньше про него мало и говорилось. Книга интересная и смешная там, где хочет быть смешной, и трогательная.