public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Smartctl issues in Cygwin with elevated terminal
@ 2022-09-13  9:11 Hamish McIntyre-Bhatty
  2022-09-13 11:46 ` Hamish McIntyre-Bhatty
  2022-09-13 17:23 ` Christian Franke
  0 siblings, 2 replies; 4+ messages in thread
From: Hamish McIntyre-Bhatty @ 2022-09-13  9:11 UTC (permalink / raw)
  To: The Cygwin Mailing List

Hi there,

I recently noticed that smartctl only works when the Cygwin Terminal 
isn't run as administrator - the opposite way round to Linux where you 
need superuser privileges to access the disk.

With Administrator privileges on Windows 11, I get:

"Read Device Identity Failure Input/Output error"

But it continues to work fine as a normal user.

Does anyone know why? In my case, this actually matters because I'm not 
sure how to elevate and/or drop privileges in Cygwin, as sudo doesn't 
work due to it not being Unixy underneath. I'll be happy to try and 
debug this and provide extra details if needed, but I'm not sure what to 
do next on this one.

Cheers,
Hamish

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Smartctl issues in Cygwin with elevated terminal
  2022-09-13  9:11 Smartctl issues in Cygwin with elevated terminal Hamish McIntyre-Bhatty
@ 2022-09-13 11:46 ` Hamish McIntyre-Bhatty
  2022-09-13 17:23 ` Christian Franke
  1 sibling, 0 replies; 4+ messages in thread
From: Hamish McIntyre-Bhatty @ 2022-09-13 11:46 UTC (permalink / raw)
  To: The Cygwin Mailing List

On 13/09/2022 10:11, Hamish McIntyre-Bhatty wrote:

Just adding a note to say this seems to only occur on Windows 10 and 11.

> Hi there,
> 
> I recently noticed that smartctl only works when the Cygwin Terminal 
> isn't run as administrator - the opposite way round to Linux where you 
> need superuser privileges to access the disk.
> 
> With Administrator privileges on Windows 11, I get:
> 
> "Read Device Identity Failure Input/Output error"
> 
> But it continues to work fine as a normal user.
> 
> Does anyone know why? In my case, this actually matters because I'm not 
> sure how to elevate and/or drop privileges in Cygwin, as sudo doesn't 
> work due to it not being Unixy underneath. I'll be happy to try and 
> debug this and provide extra details if needed, but I'm not sure what to 
> do next on this one.
> 
> Cheers,
> Hamish
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Smartctl issues in Cygwin with elevated terminal
  2022-09-13  9:11 Smartctl issues in Cygwin with elevated terminal Hamish McIntyre-Bhatty
  2022-09-13 11:46 ` Hamish McIntyre-Bhatty
@ 2022-09-13 17:23 ` Christian Franke
  2022-09-26 14:26   ` Hamish McIntyre-Bhatty
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Franke @ 2022-09-13 17:23 UTC (permalink / raw)
  To: The Cygwin Mailing List

Hamish McIntyre-Bhatty wrote:
> I recently noticed that smartctl only works when the Cygwin Terminal 
> isn't run as administrator - the opposite way round to Linux where you 
> need superuser privileges to access the disk.
>
> With Administrator privileges on Windows 11, I get:
>
> "Read Device Identity Failure Input/Output error"

This likely happens because one of the tried pass-through I/O-controls 
returns an error code which does not mean "not implemented". This is a 
limitation or bug in the driver of the disk controller.

For further diagnostics, try for example. 'smartctl -r ioctl,2 -i /dev/sda'


>
> But it continues to work fine as a normal user.

When run without admin rights for a SATA device, smarctl may print:
"Warning: Limited functionality due to missing admin rights"
and then prints only limited device identify and SMART DATA information 
returned by IOCTL_STORAGE_QUERY_PROPERTY and IOCTL_STORAGE_PREDICT_FAILURE.

Other functionality requires admin rights and a working pass-through 
I/O-control - try 'smartctl -x /dev/sda'.


Please note that the above is not Cygwin specific as it applies to both 
(Cygwin and Mingw-w64) Windows builds of smartctl. Use this ML for 
related support requests:
https://listi.jpberlin.de/mailman/listinfo/smartmontools-support


>
> Does anyone know why? In my case, this actually matters because I'm 
> not sure how to elevate and/or drop privileges in Cygwin, as sudo 
> doesn't work due to it not being Unixy underneath.

To drop privileges, try 'cygdrop' tool from 'cygutils-extra' package.


-- 
Regards,
Christian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Smartctl issues in Cygwin with elevated terminal
  2022-09-13 17:23 ` Christian Franke
@ 2022-09-26 14:26   ` Hamish McIntyre-Bhatty
  0 siblings, 0 replies; 4+ messages in thread
From: Hamish McIntyre-Bhatty @ 2022-09-26 14:26 UTC (permalink / raw)
  To: cygwin

On 13/09/2022 18:23, Christian Franke wrote:
> Hamish McIntyre-Bhatty wrote:
>> I recently noticed that smartctl only works when the Cygwin Terminal 
>> isn't run as administrator - the opposite way round to Linux where you 
>> need superuser privileges to access the disk.
>>
>> With Administrator privileges on Windows 11, I get:
>>
>> "Read Device Identity Failure Input/Output error"
> 
> This likely happens because one of the tried pass-through I/O-controls 
> returns an error code which does not mean "not implemented". This is a 
> limitation or bug in the driver of the disk controller.
> 
> For further diagnostics, try for example. 'smartctl -r ioctl,2 -i /dev/sda'
> 
> 
>>
>> But it continues to work fine as a normal user.
> 
> When run without admin rights for a SATA device, smarctl may print:
> "Warning: Limited functionality due to missing admin rights"
> and then prints only limited device identify and SMART DATA information 
> returned by IOCTL_STORAGE_QUERY_PROPERTY and IOCTL_STORAGE_PREDICT_FAILURE.
> 
> Other functionality requires admin rights and a working pass-through 
> I/O-control - try 'smartctl -x /dev/sda'.
> 
> 
> Please note that the above is not Cygwin specific as it applies to both 
> (Cygwin and Mingw-w64) Windows builds of smartctl. Use this ML for 
> related support requests:
> https://listi.jpberlin.de/mailman/listinfo/smartmontools-support
> 
> 
>>
>> Does anyone know why? In my case, this actually matters because I'm 
>> not sure how to elevate and/or drop privileges in Cygwin, as sudo 
>> doesn't work due to it not being Unixy underneath.
> 
> To drop privileges, try 'cygdrop' tool from 'cygutils-extra' package.
> 
> 

Thanks.

I can confirm that this only seems to be an issue in QEMU - it's a disk 
controller and/or driver issue as you suggested it might be.

cygdrop will hopefully resolve my issue.

Hamish

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-26 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13  9:11 Smartctl issues in Cygwin with elevated terminal Hamish McIntyre-Bhatty
2022-09-13 11:46 ` Hamish McIntyre-Bhatty
2022-09-13 17:23 ` Christian Franke
2022-09-26 14:26   ` Hamish McIntyre-Bhatty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).