maharmstone / btrfs

WinBtrfs - an open-source btrfs driver for Windows
GNU Lesser General Public License v3.0
5.87k stars 227 forks source link

Unable to uninstall #654

Open Zodiaksl opened 6 months ago

Zodiaksl commented 6 months ago

Hello,

I am on Windows 11

I am currently trying to remove BTRFS following the instructions provided on the github page.

I ran CMD as admin and used

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 btrfs.inf

the notes say that "You may need to give the full path to btrfs.inf". I did not know where the file w as located, doing a search, I found the following location:

C:\btrfs-1.9\btrfs.inf_amd64_2a582010388bb96f

So I then tried running the command line again but this time with the path

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\btrfs-1.9\btrfs.inf_amd64_2a582010388bb96f

Both of these commands gave me the same error of:

Error: Installation failed

I'm trying to uninstall BTRFS from Windows 11, not reinstall it.

Help please

sskras commented 6 months ago

Same happens on my w10, Microsoft Windows [Version 10.0.19044.3086].

Can I help with some debugging on my machine?

pee-tu commented 5 months ago

hmm, If you are trying to remove the system driver shouldn't path be an actual driver .inf ? like so: c:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf

or the windows copy of it: c:\Windows\INF\oem147.inf (oem147 is a windows generated name so you need to check the name in "driver' tab of the btrfs volume device.

sskras commented 5 months ago

Just tried both paths to no avail: "Installation failed."

image

pee-tu commented 5 months ago

it seem you are not using elevated prompt. Try to use admin command line.

Zodiaksl commented 5 months ago

it seem you are not using elevated prompt. Try to use admin command line.

Hello,

Thanks for the reply.

This time around I did the following command as requested.

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf

Nothing appears to have happened, but the prompt came back cleanly with no errors or fussing.

I've since then rebooted my computer.

How can I verify that the BTRFS driver has been successfully uninstalled?

Thank you

sskras commented 5 months ago

it seem you are not using elevated prompt. Try to use admin command line.

OK, I did. The result same as written by @Zodiaksl – nothing happens except for my taskbar flashing two times in a half of second:

image

sskras commented 5 months ago

@Zodiaksl wrote:

How can I verify that the BTRFS driver has been successfully uninstalled?

I think using sc query is good enoough:

C:\Windows\system32> sc query btrfs

SERVICE_NAME: btrfs
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

On my box it shows that BTRFS driver is still running.

maharmstone commented 5 months ago

Open an elevated Regedit Set HKLM\SYSTEM\CurrentControlSet\services\btrfs\Start to 4 Reboot and delete C:\Windows\System32\drivers\btrfs.sys

Zodiaksl commented 5 months ago

CMD

I tried the sc querry btrfs after doing RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf and it's still there.

Regedit

I then launched Regedit as admin, went to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs and set it to 4 and rebooted.

I then rebooted, went to C:\Windows\System32\drivers and tried to delete btrfs.sys but it's not letting me, even though my user account is set to administrator.

Delete Error

pee-tu commented 5 months ago

alright, that command (one using RUNDLL32.exe) does not work because of this: _

Starting with Windows 10 version 1903, the DefaultUninstall and DefaultUninstall.Services sections are prohibited, (with exception). These sections were optional in prior OS versions. _

Apparently rundll32 uninstallation has been deprecated and forbidden to use. Neither btrfs.inf nor btrfs-vol.inf have DefaultUninstall .inf section (which is correct). Ducumetation is either outdated or command never worked. rundlll32.exe will do nothing. No action is taked and that could be observed in c:\Windows\INF\setupapi.dev.log :

[Boot Session: 2024/05/07 15:46:45.500]
>>>  [Device Installation Restrictions Policy Check]
>>>  Section start 2024/05/07 15:48:01.702
<<<  Section end 2024/05/07 15:48:01.811
<<<  [Exit status: SUCCESS]

Nevertheless there is a short PS script provided with chocolatey btrfs package that almost did the trick: ProgramData\chocolatey\lib\winbtrfs\tools\chocolateyuninstall.ps1

$ErrorActionPreference = 'Stop';
$toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

Write-Host -ForegroundColor green   "Listing drivers"
$btrfsDrivers = Get-WmiObject win32_pnpsigneddriver | where { $_.DeviceName -like "*btrfs*" -and $_.InfName -like "*oem*"}

foreach($driver in $btrfsDrivers)
{
    Write-Host -ForegroundColor green "Removing driver" $driver.DeviceName $driver.InfName 
    pnputil -f -d $driver.InfName
}

Problem with this script is it's unable to remove both drivers. Yeap are two : btrfs.inf and btrfs-vol.inf It could properly indentify only btrfs driver, the volume driver was not detected. Aditionally there is a problem with btrfs service: it's incomplete hence there is no possiblility to stop it from system side (other than not to start it).

In the end to completely remove btrfs from system one need to do few steps:

1) grep \Window\inf folder for btrfs string (for example in my case oem146.inf and oem147.inf were the offenders) 2) "sc delete btrfs" ( or deleting HKLM \SYSTEM\CurrentControlSet\Services\btrfs key entirely ) then reboot 2) pnputil.exe -f -d oem146.inf 3) pnputil.exe -f -d oem147.inf 4) manually remove btrfs storage device in devmgmt.msc

Zodiaksl commented 5 months ago

In the end to completely remove btrfs from system one need to do the steps:

  1. grep \Window\inf folder for btrfs string (for example in my case oem146.inf and oem147.inf were the offenders)
  2. "sc delete btrfs" ( or deleting HKLM \SYSTEM\CurrentControlSet\Services\btrfs key entirely ) then reboot
  3. pnputil.exe -f -d oem146.inf
  4. pnputil.exe -f -d oem147.inf
  5. manually remove btrfs storage device in devmgmt.msc

I don't understand what grep is, means or how to do it, is it just a cmd command?

pee-tu commented 5 months ago

sorry, grep is an idiom from linux world derived from program name grep used for searching things. in widows you can use findstr:

cd c:\Windows\INF
findstr /m /s /i /c:"Btrfs driver" *.inf
pee-tu commented 5 months ago

Not really, sohuld be max two. I do not know the correct syntax out of my head. Use findstr manual (easy to find on MS sites) Basically you want to find *.inf files that have "Btrfs driver" string in them.

rautamiekka commented 5 months ago

Not really, sohuld be max two. I do not know the correct syntax out of my head. Use findstr manual (easy to find on MS sites) Basically you want to find *.inf files that have "Btrfs driver" string in them.

Just do findstr /? to get the --help info that'll be more than enough; /? goes for the vast majority of pre-PowerShell apps, it even works with PowerShell (I just tested, haven't used Batch/CMD for years).

Zodiaksl commented 5 months ago

Not really, sohuld be max two. I do not know the correct syntax out of my head. Use findstr manual (easy to find on MS sites) Basically you want to find *.inf files that have "Btrfs driver" string in them.

Just do findstr /? to get the --help info that'll be more than enough; /? goes for the vast majority of pre-PowerShell apps, it even works with PowerShell (I just tested, haven't used Batch/CMD for years).

Don't confuse me more than I already am @_@

I barely know cmd or powershell commands.

I just wish for a clear and easy way to uninstall the BTRFS drives.

pee-tu commented 5 months ago

findstr /m /s /i /c:"Btrfs driver" *.inf worked for me

Zodiaksl commented 5 months ago

findstr /m /s /i /c:"Btrfs driver" *.inf worked for me

CMD

This is the result I got from it. Does that look right? If so, what do I do next?

pee-tu commented 5 months ago

wrong folder cd c:\Windows\INF

pee-tu commented 5 months ago

now you are in wrong folder and have wrong command:. change directory to windows\inf and then use the original command

Zodiaksl commented 5 months ago

CMD

Is this right this time? Sorry, I'm trying.

Do I just go there and delete those files?

itsTyrion commented 5 months ago

image Does this not work for you??

Zodiaksl commented 5 months ago

image Does this not work for you??

"Storage volumes" does not show up in my Device Manager

musicomputer-tao commented 4 months ago

CMD

I tried the sc querry btrfs after doing RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf and it's still there.

Regedit

I then launched Regedit as admin, went to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs and set it to 4 and rebooted.

I then rebooted, went to C:\Windows\System32\drivers and tried to delete btrfs.sys but it's not letting me, even though my user account is set to administrator.

Delete Error

Try this, change the file read permission.

Right click %Windows%/system32/drivers/btrfs.sys, press r. Switch to "safe" tab, click "Enhance edit(v)"(I haven't set system language as English. Maybe this is not correct. Please find the button with this meaning.) . Then, add permission user. When you need to insert name of your account, asking by the system, you can click "Enhance search...", and then find name of account in the list. Press OK(or Enter?), and ok for the previous dialog box including the safe tab.

Next, delete the Btrfs driver, try.

Zodiaksl commented 4 months ago

CMD I tried the sc querry btrfs after doing RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf and it's still there. Regedit I then launched Regedit as admin, went to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs and set it to 4 and rebooted. I then rebooted, went to C:\Windows\System32\drivers and tried to delete btrfs.sys but it's not letting me, even though my user account is set to administrator. Delete Error

Try this, change the file read permission.

Right click %Windows%/system32/drivers/btrfs.sys, press r. Switch to "safe" tab, click "Enhance edit(v)"(I haven't set system language as English. Maybe this is not correct. Please find the button with this meaning.) . Then, add permission user. When you need to insert name of your account, asking by the system, you can click "Enhance search...", and then find name of account in the list. Press OK(or Enter?), and ok for the previous dialog box including the safe tab.

Next, delete the Btrfs driver, try.

Hello,

Thank you for the reply.

I've just tried doing this.

C:\Windows\system32\drivers, find btrfs.sys > Right click > Properties > Security > Advanced > Changed the Owner from TrustedInstaller to my user Bryce (GAMING\Bryce) and even gave myself Full Control.

Then I tried deleting the file and it still wouldn't let me, so I rebooted the computer.

Even after rebooting it still wouldn't let me, saying I needed approval from the owner and even listing ME (Bryce (GAMING\Bryce) as the owner.

I had to go back INTO Security and this time go into Show Advanced Permissions and I just checked all 13 of the permissions boxes that were not even all under Advanced permissions...

But files appear to have been deleted now... I hope.

starfish0422 commented 2 months ago

命令 完成后,我尝试了 sc querry btrfs RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 C:\Windows\System32\DriverStore\FileRepository\btrfs.inf_amd64_eee2870164cc723a\btrfs.inf,但它仍然存在。 然后我以管理员身份启动 Regedit,转到 Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs 并将其设置为 4,然后重新启动。 然后我重新启动,转到 C:\Windows\System32\drivers 并尝试删除 btrfs.sys,但它不让我删除,即使我的用户帐户设置为管理员。 注册表编辑 删除错误

尝试一下,改变文件的读取权限。 右键点击%Windows%/system32/drivers/btrfs.sys,按r键。切换到“安全”选项卡,点击“增强编辑(v)”(我没有将系统语言设置为英语。可能不正确。请找到具有此含义的按钮。)。然后,添加权限用户。当您需要输入账户名称时,系统会询问,您可以点击“增强搜索...”,然后在列表中找到账户名称。按OK(或Enter?),然后对包含安全选项卡的上一个对话框单击确定。 接下来删除Btrfs驱动,试试。

你好,

谢谢您的回复。

我刚刚尝试这样做。

C:\Windows\system32\drivers,找到 btrfs.sys > 右键单击​​ > 属性 > 安全 > 高级 > 将所有者从 TrustedInstaller 更改为我的用户 Bryce (GAMING\Bryce),甚至授予自己完全控制权。

然后我尝试删除该文件但仍然不允许,所以我重新启动了计算机。

即使重新启动后,它仍然不允许我这样做,说我需要得到所有者的批准,甚至将我(Bryce(GAMING\Bryce))列为所有者。

我不得不回到安全界面,这次进入显示高级权限,我刚刚检查了所有 13 个权限框,这些权限框甚至不全部在高级权限下......

但是文件现在似乎已被删除...我希望。

可以尝试一下这个软件!也许可以删除! image

shade233 commented 1 month ago

The problem is , [DefaultUninstall] is not in btrfs.inf !!!!! it's missing in the new version of winbtrfs!!!