Monday, April 30, 2018

Recovery of files from a Windows failing drive

A 1TB NTFS-formatted disk on my Windows 10 machine started crapping out.



Following advice in other questions, I downloaded a System Rescue CD ISO, booted from it and ran ddrescue as suggested here to copy the data to a different drive of the same size.



The first step was running ddrescue -f -n /dev/sdd /dev/sdb rescue.log overnight.
Unfortunately, the speed keept deteriorating and after finishing 93%, ddrescue claims that completing the rest of the first pass will take 45 days. And that is not taking into account the further passes.




While I would like to get as many files as possible (intact!) from the drive, I'd rather have less files now than more in two month. Furthermore, while the recovery process is running, I cannot use my (Windows) computer for anything else.



What is the best way to recover as many files as possible within a reasonable period of time (a couple of days)? Can I "fix" the 93% copied drive to make it work in Windows? Will a regular chkdsk /f work?



I also consider trying to do a file-level copy from the failing drive, and then "topping up" from the rescued one. That way I know that the files that were successfully copied are not corrupt. Is there a utility that copies files quickly, skipping errors? I read somewhere that robocopy gets stuck on errors even with the /r:0 /w:0 switches.



Edit: Now it shows 142 days. And the failing disk no longer seems to be readable.

windows - Laptop's disk usage is always 100% and freezes after few seconds

I have Acer 5755G laptop with following spec:
4GB RAM
750 GB WD HDD
Intel i5 2nd Gen
Windows 8.1 Update 1 64 bit



Laptop is 2 years old.




Previously I had Windows 7 64 bit OEM version.



Previously when I had windows 7 the same problem occurred several times. I would simply reinstall the windows. For 2 months it will work fine and later the disk usage will shoot up to 100% again. Recently I formatter my laptop and installed Windows 8.1 Update 1 64 bit. For the first few months it worked fine and again the problem starts.



The laptop is mainly used for:




  1. Browsing internet using Google chrome

  2. Later having doubt on Google Chrome moved onto IE

  3. Using Word


  4. Watching SD videos and sometimes HD videos



The following troubleshooting methods were followed:




  1. Completely disabling the process "SuperFetch"

  2. Completely disabling the process "BITS"

  3. Completely disabling the process "Windows Search"

  4. Disabling automatic windows update


  5. Disabling the Windows defender

  6. Regularly do disk clean-up



Doing the above steps didn't help my laptop to improve the health. I refreshed the windows completely using the recovery option in the PC setting. Didn't help.



So now I have completely formatted my C drive and again installed Windows 8.1 Update 1. Now it is working fine. I am sure that after 2 months the same problem will start.



My hard disk health good. Did disk scan on all my drives. Doesn't show any errors.




Is there is any permanent solution to solve this problem? Or replacing my HDD with a new one will resolve it?



Edit 1: List of softwares I use install all the time:
List of softwares



**Edit 2: I have performed Short DST test using Seatools by Seagate. It shows the Short DST failed. But as of now my laptop is working fine. So the 100% disk usage is due to this? Should I replace my HDD?



Short DST failed

windows xp - What is the fastest way to securely overwrite an old hard drive?






I'm going to give my HDD away, so I'm writing it full of crap so there is no possibility to recover any of my files I had there. Although, I have heard even re-written drives can be recovered some data from them, but I don't consider a high tech guys ever touching it, unless its very easy? I would like to know if it's possible... and how many times I need to write it over?


On the real question here; could it be possible to write into the multiple disks inside the HDD simultaneously and thus increasing total data write rate? So lets say if there are 6 disks inside, I could get 6x write speed if I wrote the same data to each one of them at same time.


Any other suggestions are welcome, since I am writing with 22MB/s speed ATM (old drive, or crappy code?), this will take a while.


Edit: For a security note, my HDD is around 10 years old, or less, and 60GB in size. Does this need only one wipe?


Answer



I used CCleaner a few times, which is a free tool that does the job.
enter image description here


windows - How do I run a JAR file without installing Java?


My question may seem odd but this is indeed what I need to do. For the first in the last (maybe) 10 years I have to run a JAR file in my computer. But I don't want to install 'the Java' (and all those things it adds into your system). How can I run that JAR file?


Answer



You have two options





  1. Use jPortable together with jPortable Launcher



    jPortable Launcher allows you to easily run Java JARs from your PortableApps.com-enabled device with the jPortable portable Java Runtime Environment installed.



    To use this, visit PortableApps.com and search for jPortable . A list of result should come up and then select the runtime environment and the launcher (links above). Then download both of them, and install per directions. A folder will be created where the downloaded files were run from. Inside one of them will be "JavaPortableLauncher.exe". If you launch it, you should be able to locate and open a jar file with the application.


    The Launcher



(or)



  1. Download and extract the Windows x86 tar.gz version and start your .JAR file from commmand line: start C:\Java\bin\javaw.exe -jar C:\myfolder\myprogram.jar


How much do spin-ups wear out a hard disk drive?

On a mechanical hard disk drive, roughly (orders of magnitude) how many hours of typical continuous operation (strictly/non-inclusive between spin-up and spin-down) is one spin-up equivalent to in terms of abrasive wear?


The reason I'm asking this question is because I have an SSD and a HDD and I want to decide whether I just want to make the HDD be continuously on (if that setting is even possible).


EDIT: Ignore the following question (as hennes points out the flaw in the comments)
Further, when you hear the HDD spin up when the PC is on, will it also place the R/W-head on disk (like it does when you start up the computer) or does it just spin-up with the head already on the platters? I'm asking because the degree of abrasive wear could be higher in the case where the head is placed on the platters as well.

Windows 7 freezes on hard disk activity


Sometimes my Win7 completely freezes, even mouse pointer doesn't move. It happens only on really hard disk activity (when I perform VM suspend or whole disk antivirus scan, for example). After some seconds all is ok again.
Any ideas?


Answer



I solved this trouble by updating firmware of my primary disk (it's SSD, sorry for not mentioning this before).


Keyboard Messed Up: Windows XP Language Settings

I've added Russian and the Russian typewriter keyboard layout in the Windows XP language settings and was able to use Russian letters in Word without a problem.


But when I tried to switch back to either my German or my US language/keyboard settings, the keyboard layout was the regular Latin character layout on the left side of the keyboard (seriously!), and it had mostly numbers and German Umlaute (ä, ü etc.) on the right hand side of the keyboard. Each number/letter occurred several times, whereas most of the letters that are usually on the right side of the keyboard are not there at all.


I tried switching back to Russian, but even that won't work anymore.


Obviously, this makes it impossible for me to use that laptop computer on which this happened at all, as the windows setting apply to most everything, including Firefox (I'm not writing this message on that laptop, of course!). Does anyone have an idea what I could do? I've already tried removing all language options but one, but that doesn't seem to help.


Thanks for all help you may be able to provide ...!


(I'm also a former Mac user who can't really afford their expensive machines anymore, but I should add that nothing like this ever occurred on my Mac ...)

Should Windows 8 be taking up 40GB of my HDD when my drive is compressed?


I want to install a game that requires 12GB on my computer with an HDD that shows 53GB total capacity, so I cleared everything off of it.



  • All documents, pictures, downloads, desktop, etc empty

  • Drive is compressed to save space

  • Ran Disk Cleanup and removed every option there, gaining about 1GB of space

  • Uninstalled all non-essential programs, all games, even my antivirus.


But I'm still 3GB short.


It appears that the Windows 8 OS is taking up 40GB by itself. I looked it up on Google and supposedly Windows 8 is only supposed to require half of that.


Can/Should Windows 8 really be taking up this much space even with my drive compressed, and is there any way to reduce it?


Answer



You may find that HIBERFIL.SYS (a hidden system file) is taking up a lot of space on your main (internal) hard drive.


If you want to reclaim this space at the cost of not being able to hibernate your PC any more you can follow these instructions:


How to disable hibernation


Alternatively you can run the following from a Command Prompt which is running in Administrator Mode and this will achieve the same effect:



powercfg -h off



Sunday, April 29, 2018

windows - Why doesn't CMD inherit environment variables on this machine?

For whatever reason, on a specific machine my cmd process doesn't inherit its environment variables from the parent process which launched it. Instead it reverts back to the "default" environment settings, like it was launched via explorer.


A simple way to demonstrate this is to open a command-prompt and then run set Path=C:\Windows\System32\, followed by launching another cmd process from the same prompt. The variable can then be viewed by running set Path.


It should be "C:\Windows\System32" (inherited from the launching process) but on my machine it's reverted back to my environment default.


You should see something like this:
Working command prompt


I instead get the following:
CMD breaking the rules


What could be causing this? It seems to break all the rules around how environment variables work and it only affects this one machine.

windows - SSH asking for user password instead of private key passphrase



Short Summary:



I am trying to connect to a Mac mini from a Windows PC through SSH to execute a shell script on the Mac mini. I do not want to store the user password in my script. I would rather use the passphrase that protects the private key.






I have everything set up as described in these tutorials:




https://www.techrepublic.com/article/how-to-generate-ssh-keys-on-macos-mojave/



and here (since ssh-copy-id didn't work)



https://www.techrepublic.com/article/how-to-manually-add-ssh-keys-for-key-authentication/






The Process:






  • Generate key on client using ssh-keygen -t rsa


  • Enter passphrase and verify it


  • Make file "authorized_keys" in /Users/Username/.ssh on host and copy public key from client into it


  • chmod 640 authorized_keys and chmod 700 .ssh




Also:





  • Enable remote connection on Mac mini




Result:



I can connect to my client but the shell asks me for the user password instead of the private key passphrase.




ssh -vv result:



Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Developer>ssh -vv systemtest@139.22.224.52
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 139.22.224.52 is address
debug2: ssh_connect_direct

debug1: Connecting to 139.22.224.52 [139.22.224.52] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Developer/.ssh/id_rsa type 0
debug1: identity file /c/Users/Developer/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Developer/.ssh/id_dsa type -1
debug1: identity file /c/Users/Developer/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Developer/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Developer/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Developer/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/Developer/.ssh/id_ed25519-cert type -1

debug1: identity file /c/Users/Developer/.ssh/id_xmss type -1
debug1: identity file /c/Users/Developer/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9
debug1: match: OpenSSH_7.9 pat OpenSSH* compat 0x04000000
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to 139.22.224.52:22 as 'systemtest'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal

debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-
group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sh
a2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sh
a2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-1
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-1

28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-
group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-1
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-1
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:

debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:BAHjy5hPVFMIB7JF+rwobrjLgXQ30C5zgoNlBC5ENRw
debug1: Host '139.22.224.52' is known and matches the ECDSA host key.

debug1: Found key in /c/Users/Developer/.ssh/known_hosts:3
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /c/Users/Developer/.ssh/id_rsa RSA SHA256:M7GM7bLi357XePOpkX+E6AhGD7Ay/JZ0xSBwSgan9kY
debug1: Will attempt key: /c/Users/Developer/.ssh/id_dsa

debug1: Will attempt key: /c/Users/Developer/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Developer/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/Developer/.ssh/id_xmss
debug2: pubkey_prepare: done
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey

debug1: Offering public key: /c/Users/Developer/.ssh/id_rsa RSA SHA256:M7GM7bLi357XePOpkX+E6AhGD7Ay/JZ0xSBwSgan9kY
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /c/Users/Developer/.ssh/id_dsa
debug1: Trying private key: /c/Users/Developer/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Developer/.ssh/id_ed25519
debug1: Trying private key: /c/Users/Developer/.ssh/id_xmss
debug2: we did not send a packet, disable method
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint

debug2: we sent a keyboard-interactive packet, wait for reply
debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
Password:



ls -al in .ssh directory in mac result



systemtestsmini:.ssh systemtest$ ls -al


total 24

drwx------ 5 systemtest staff 160 28 Aug 04:42 .

drwxr-xr-x+ 20 systemtest staff 640 28 Aug 04:03 ..

-rw------- 1 systemtest staff 1896 28 Aug 04:05 id_rsa

-rw-r--r-- 1 systemtest staff 419 28 Aug 04:05 id_rsa.pub


-rw-r--r-- 1 systemtest staff 175 28 Aug 04:20 known_hosts

Answer



It sounds like you may have swapped the client and server roles in your mind and thus accidentally performed the client steps on the server and the server steps on the client. It sounds like you generated the key pair on the machine you wanted to connect to (the Mac mini), and then copied the public key to the machine you wanted to connect from (the Windows PC).



From the additional logs and info you provided, it seems like you already have an RSA key pair on your Windows PC at C:\Users\Developer\.ssh\id_rsa (and there should be an id_rsa.pub in the same location)



You should copy that id_rsa.pub from the Windows box to the Mac, and then append it to the ~/.ssh/authorized_keys file under the home directory of the user account you want to log into on the Mac.




Edited to add more explanation per your follow-up question:



Think of it this way: Your private key is private. You keep it to yourself. You only keep it on your primary machine that you sit at. You even protect it "at rest" (i.e. on your local disk) by encrypting it with a passphrase so that even if someone steals the file, they can't use your private key.



Your public key is public. You distribute your public key to all the servers you want to be able to log into, and mark it as one that is authorized to log you in. But when you try to log in you still have to prove you're really you, so you have to prove that you possess the private key that forms the matched set with the authorized public key. (This is done mathematically in a way that doesn't reveal the private key.)



The reason you can log into the Mac, even without your keys set up right, is that you fall back to not using those keys at all. You fall back to good ol' username+password credentials for authentication: The same credentials that the Mac's GUI login window accepts.


How do I create a macro in Excel for Mac?

I have found this thread on this topic
How to get the list of sheet names of ms-excel?


But I have no idea how to create the macro people are talking about. I will be grateful for your help on how to create the macro with the suggested code.

Computer Power Supplies are not working anymore


So a little back-story. So I have two computers which I built. About a month ago or so one of them just stopped working (no power). This one in particular has a cosair 750w power supply (probably at least 3-4yrs old). So anyways I figured it had just went bad because we hardly ever shut the computer down.


Now last night I took my other computer (corsair 600w power supply) and moved it to the same location as the computer that died. I plugged it in and nothing. So I then checked the outlet. There is definitely power there. I also tried other outlets, still nothing.


SOME OTHER DETAILS:





  1. The first computer has been working for 3+ yrs with no problems.

  2. The second computer I built about 2 months ago.

  3. The night before the first computer stopped working my wife and I smelt something that smelt like burnt rubber.
    We thought it was coming outside, but I have reason to believe it may have been the power strip. The reason I think it was the power strip is because the second computer made no smell before it died.


PROBLEM / QUESTION:


So with that in mind I am assuming I have a bad power strip. But what I don't understand is how a faulty power strip could cause two power supplies to go bad. Would a power supply go bad because of a lack of power? Or too much power?


PC1 Power Supply - http://www.microcenter.com/product/406089/CX_Series_CX750M_750_Watt_ATX_Modular_Power_Supply


PC2 Power Supply - http://www.microcenter.com/product/406088/CX_Series_CX600M_600_Watt_ATX_Modular_Power_Supply


Answer



Well I did a paper clip test on the power supplies and both actually still work. Its very odd that both would stop working after plugging them into the same outlet. But long story short I spent the night dissecting one of my PC's and found out that the circuit board connected to the power button doesn't work. So now I have to start it with a paper clip until I either fix the switch or get a new case.


Thanks to everyone for sharing your advice.


windows 8 - Powershell remoting as non-administrator


I'm using ssh to log on to other Windows machines. I'm trying to make a pssession on a localhost. But I cannot do it in normal posh prompt:


$ New-PSSession
New-PSSession : [localhost] Connecting to remote server localhost failed with the
following error message : Access is denied. For more information, see the
about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession
+ ~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspa
ce) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed

It seems that I have to be on an elevated posh shell. Is there any way to do this without administrator privileges?


Answer



Powershell Remoting has a default PSSessionConfiguration called Microsoft.PowerShell with a SDDL which only allows people with administrative rights to execute remote commands on that machine.


You will need to get in touch with an administrator and have them open that up for you:


PS C:\> Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI

More info here: http://blogs.msdn.com/b/powershell/archive/2009/11/23/you-don-t-have-to-be-an-administrator-to-run-remote-powershell-commands.aspx


Don't forget to Enable-PSRemoting along with opening the appropriate ports (5985 HTTP/5986 HTTPS).


Saturday, April 28, 2018

Where to get mac ISO for VirtualBox



I've got a Mac Pro running Catalina. I'd like to run a guest also running Catalina. Where do I find an ISO so I can do that?


Answer



Please check https://apple.stackexchange.com/questions/128319/official-way-to-obtain-an-os-x-iso-file




I didn't test it, but, as far as I know, the method given there should still work on Catalina.


Windows won't install updates (Security Update for Microsoft Office 2013)


Today [Patch Tuesday] I installed the new Windows Updates available for Windows 8. I think there were 14 Updates altogether. All except 3 updates were installed. When i try to install the last 3 updates which are security updates for Microsoft Office 2013 64 Bit and Microsoft Office 2007 suites (I don't have Office 2007, only 2013) I get the Error: Code 80242009 Windows Update ran into a problem.


I have tried to install one by one the updates. The Office 2007 suites install successfully but the Office 2013 won't install. When i click on Check for Updates I again see the 2 Office 2007 suites updates, even if they were successfully installed. Can someone help with this ?


Here is a link to the update that won't install: MS13-074 Security update for Access 2013: September 10, 2013


Some Updates were not installed


Security Updates for Microsoft Office


Answer



This might help. Request from here the Hotfix, or download it for Office 2013 64 bit from here or for Office 2013 32 Bit from here.


I just installed the Office 2013 hotfix package and the problem with windows update went away. Everything was installed.



KB Article Number(s): 2768361
Language: All (Global)





The problem around this update was escalated to the proper team and new updates are being released to take care of this issue. You should try checking for updates in your computer now and try installing the updates available (don't forget to unhide the updates). This should help you resolve the issue.


Here is the blog post from the Microsoft Team.


Friday, April 27, 2018

networking - Windows 10 Sharing - Clients ask for Password when password protected sharing turned off?

I hope this is a simple issue for someone to just point me at the right setting, but i'm having issues getting sharing working between PCs on my network. The issue is if any clients try and connect to my server, they're prompted for a username and password despite password-protected sharing being off, and even if i put in the server's username and password, won't allow the clients to connect.




  • The Server (called "Ravnica") runs Win 10 Home 1903, is a desktop tower connected via Ethernet.


  • The primary Client (called "Innistrad") runs Win 10 Home 1809, is a laptop and can be connected by either Wireless or Ethernet depending on location

  • The secondary Client (called "Ixalan") runs Win 10 Home 1903, is a desktop tower connected via Ethernet.



The issue is if either Innistrad or Ixalan try and connect to Ravnica, they're prompted for a username and password, which is both undesirable (as Ixalan is my housemate's PC) and even if Ravnica's admin username and password are put in, it'll not allow access. This is despite all PCs having all of the following set:




  • Private network

  • Network discovery on

  • File and printer sharing on


  • Password-protected sharing off

  • 128-bit encryption

  • Public folder sharing on

  • Same Workgroup (called "Multiverse")



All the folders (and printer) i need to share on Ravnica are shared, with Read permissions for "Everyone", with the Microsoft-account-linked user as an admin (which is the only named user on Ravnica)



Why are the clients being prompted for a password in this situation?




Extra data that may help, but i doubt it's relevant



The network is as follows:



{ISP wireless AP/switch/router} <-> {gigabit switch A} <-> {Powerline Adpator} ~~



~~ {Powerline Adpator} <-> {gigabit switch B} <-> {Ravnica}



~~ {Powerline Adpator} <-> {Ixalan}




{Innistrad} is either connected by wireless to {ISP wireless AP/switch/router}, or by a wire to {gigabit switch A}
There are a variety of other non-PC devices attached to all three switches, including the TV, games consoles, a raspberry Pi, etc, but none are configured to use the network share.



EDIT: Just to clarify if either client types \\RAVNICA into an explorer address bar, then it is prompted for a password. I do not even get to see the shared folders.



The folders in question are not under {insert any drive letter here}:/users. The folders are all on the root of a secondary hard disk, and are not considered system folders



the following is set ravnica:
enter image description hereenter image description here
enter image description hereenter image description here

enter image description hereenter image description here
enter image description hereenter image description here
enter image description here

macos - Is it possible to query the launch services database for applications that will open an arbitrary file or UTI type?


I am able to use mdls to show the Uniform Type Identifier (UTI) for an arbitrary file as well as the hierarchy of types that are supersets of a specific UTI.


mac:~ mike$ mdls -name kMDItemContentType -name kMDItemContentTypeTree foo.ksh
kMDItemContentType = "public.ksh-script"
kMDItemContentTypeTree = (
"public.ksh-script",
"public.shell-script",
"public.script",
"public.source-code",
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)
mac:~ mike$ mdls -name kMDItemContentType -name kMDItemContentTypeTree foo.command
kMDItemContentType = "com.apple.terminal.shell-script"
kMDItemContentTypeTree = (
"com.apple.terminal.shell-script",
"public.shell-script",
"public.script",
"public.source-code",
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)

Are there any tools that can show which Apps have registered for a particular UTI other than trial and error?


It's clear from inspection that the foo.command file will be opened by Terminal.app, but it's not at all clear that foo.ksh currently belongs to TextEdit.app.


I'd like to be able to read the Mac OS X Launch Services database directly without actually resorting to using open to see which app is chosen on a per UTI basis. It would be like having --preview --verbose switches to get open to tell me what is would do rather than doing it.


Even better would be a way to list all apps that could open that UTI, even if they are not the preferred app.


To get this secondary information, I have to create or find a file for each type of interest and use Finder to manually show which apps could open that UTI.


enter image description here


I would really like to be able to access this data programatically from the terminal.


Answer



Andrew Mortensen’s duti is a CLI that will list UTI handlers:



  • -d lists the default handler;

  • -l lists all registered handlers.


See the man page for duti.


EDIT: as Lri points out in this answer, duti does not seem to list all possible applications (possibly because it does not take account of UTI inheritance? That would be a matter for further inquiry). His recommended solution, AllApllications would obviously be a better answer.


windows 7 - How to secure a public computer?


We'll have a couple of laptops sitting at a table at a convention we're going to soon. We're not concerned about physical theft - the laptops will be physically secured, and there'll be someone keeping an eye on them most of the time. There's also no sensitive information on them.


However, we want to make it as hard as reasonably possible for someone malicious to go in and format the hard drive, or delete everything from the Windows folder, or install KILLALLNERDS.EXE from a USB drive while the minder is distracted. Alternatively, if someone does manage to ruin one, we'd like to be able to get it back up and running ASAP, without spending 3 hours reinstalling windows and all the software.


The laptops are running fully up to date Windows 7 (I think 64-bit edition), and will be physically networked to a printer, but not connected to the internet.


What's the cheapest way to reasonably do this? Protecting this from some master hacker isn't important - all we care about is making it hard for a bored kid to do some damage.


Answer



Create a guest account, password protect all other accounts with strong passwords.


Use Acronis to make a full disk image prior to deploying the PC to the public, if something does get hacked you can restore the image in less than an hour.


http://www.acronis.com/homecomputing/products/trueimage/index.html


Prevent Windows 10 installer from using the preinstalled serial key without disabling UEFI



My laptop (a Lenovo Flex 2 15) came preinstalled with Windows 8 Standard (with the serial key preinstalled into the BIOS), and I've since installed an SSD (a Samsung Evo 840 120GB) & upgraded to Windows 10.



When the laptop still had its hard drive, I upgraded it to Professional so I could use the resources provided by the domain on my homeserver; because of this, I can only use the Professional editions of Windows (Home can't join domains).



I bought Windows 10 Professional & completed a fresh-install (complete reinstallation) of Windows, only that it installed Windows 10 Home instead of Professional. I'm guessing this is due to the Windows 8 Standard Edition serial key preinstalled in the BIOS.




I then downloaded an All-In-One ISO image of Windows 10 from MSDN (of which I have limited access to), transferred the installer onto a USB stick, & reinstalled (a clean install again). However it's still installing Windows 10 Home.



If I try to install using the AIO image from within Windows, the installer does not present me with a list of options for the edition I want to install; instead, it assumes that I want to install Home Edition:



enter image description here



I am able to get Windows 10 Professional to install if I disable UEFI & use Legacy instead, but I feel that this is stepping around the issue rather than resolving it.



Is it possible to have the Windows 10 installer ignore any serial keys preinstalled in the BIOS/UEFI? If so, how? If not, is using Legacy mode really the only way around this?



Answer



First of all, make sure you have a regular (single-architecture) Windows ISO. It seems you already have that covered.



Then, try this method:




  1. Create a Setup USB drive

  2. Create a file named PID.txt in the Sources directory, with the following contents:



    [PID]

    Value=YOURK-EYGOE-SHERE-XXXXX-XXXXX

  3. Boot from this USB drive



linux - How to partition a hard drive but not delete it's content?

I want to install Xubuntu on my friend's computer. There is one hard drive but multiple partitions. She doesn't want to delete Windows 10, but she wants to devote a large part of her hard drive to Linux, and a little part to Windows.


So this is what we think we should do : keep the partition with Windows installed, give it some place on the hard drive (~50GB), and dedicate the rest to Xubuntu.


If I remember right, there is a main partition with about 900GB and 3 or 4 others with a few GB each. Is it possible to split this partition into 2 partitions but not delete what's on it ?

grub - Multiple Bootable Images on Flash Drive UEFI mode


I am aware that there exists tools that can change the mbr of the drive so that it can boot up multiple operating systems such as the Windows XP installer, Windows 7 installer, Windows PE-based live environment, and a linux live environment with software like this: http://www.msfn.org/board/topic/120444-how-to-install-windows-from-usb-winsetupfromusb-with-gui/


But all these things are made possible via grub4dos or some variant of that. How would I access the uefi boot options from the Windows 7 installer, for installing in UEFI mode? Some linux distributions such as Ubuntu now also support UEFI mode as well. How would I have a menu, like the grub option, for accessing individual UEFI modes of the images?


Thank you.


Answer



Pretty much the same way – install an EFI boot manager (such as Gummiboot or grub2-efi) that is capable of "chainloading" other EFI boot loaders, and add the various Windows versions to its menu.


You won't even need to modify bootsectors, since in EFI all boot loaders are just files named something.efi. (The one used by Windows is Bootmfgw.efi, if I remember correctly.)


windows 7 - AutoHotKey: How do I set the starting value of the current loop iteration?


I've made a basic AHK script that adds unique metadata to each file on a system I use every day. The idea is to add _01 to the first file followed by _02 to the second file and going up forever until i exit the script.


At first, i felt like I've been doing this the long way and I wasn't sure what was required to make the script smaller and less painful to edit.


Here's the script:


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
F3::
{
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _01
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _02
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _03
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _04
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _05
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
}

So as you can see, I've had to copy/paste the entire script and change the _01 to be _02 in the next part, followed by _03, _04 and _05.


I found out how to do this with the use of Loop + A_index and it works fine just as the above does:


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
F3::
Loop, 5
{
Send, {LAlt}
Sleep, 20
Send, {Right}
Sleep, 200
Send, {Right}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Right}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 107, 30
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Down}
Sleep, 20
Send, {Enter}
Sleep, 100
MouseClick, Left, 346, 38
Sleep, 200
Send, ^v
Sleep, 100
Send, _
Sleep, 100
Send %A_Index%
Sleep, 200
Send, {Enter}
Sleep, 200
Send, {Enter}
Sleep, 200
MouseClick, Left, 91, 102
Sleep, 100
MouseClick, Left, 92, 100
Sleep, 100
MouseClick, Left, 147, 156
Sleep, 100
Send, {Down}
}

I now need to be able to set the starting value of %A_index% with the use of a input box at the beginning of the script.


I want to be able to enter any number into the inputbox and have %A_index% work sequentially starting from that number.


So since A_Index simply keeps track of the current loop iteration, and therefore is a built-in internal value that cannot be changed...


...what i'm essentially asking is:


How do I get the script to start from a specific loop iteration using inputbox?


Does anyone know how this can be achieved?


Answer



You need to use another intermediate variable, convert A_Index to a 0-indexed loop count by subtracting 1, and add them together inside the loop


InputBox, myEntry, Enter a value, Enter starting value...
Loop {
myIndex:=myEntry + (A_Index-1)
myIndex:=(myIndex<10) ? "0" myIndex : myIndex
;...
Send %myIndex%
;....
}

Thursday, April 26, 2018

How can I use the keyboard to choose how to paste text in MS Word?


While using a word processor I prefer to user the keyboard almost exclusively, but when pasting text in MS Word I seem forced to use the mouse. I can find no way to specify how to treat formatting (keep source / match destination / text only) on a one-off basis without using the mouse (distracting and slow) or altering my default settings (even worse).


Is there a way to do this? It seems to me I need either a keyboard shortcut to enter the Paste Options dialogue after pasting or a different command that I can use to specify the formatting option. I looked at Paste Special, but that only seems to provide one relevant option, namely ‘text only’ (Unformatted Text), while I want ‘keep’ or ‘match’ as well.


I am using MS Word 2007, but an answer applying to other versions would obviously be more generally useful.


P.S. I use MS Office’s Dutch UI for compatibility with colleagues, so various keys and texts above may be inaccurate.


Answer



Further to the useful answer by Lernkurve, I conclude that ‘Paste Special…’ does not do the job, while mapping keystrokes to macros created from the ‘paste mode’ dialogue does. Since his first two options apply Word 2013 and up, anyone stuck on 2007 will have to create and map macros.


Recording Macros


To record macros, you need the Developers tab enabled in the ribbon, in Word Options/Popular Options.


Macros for the Paste Modes


The macros needed to do the job, recorded by entering the choice menu after pasting are:


Sub PasteOriginal()
' Paste with option ‘original formatting’
Selection.PasteAndFormat (wdFormatOriginalFormatting)
End Sub
Sub PasteMatching()
' Paste with option ‘match destination’
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
End Sub
Sub PasteText()
' Paste with option ‘only text’
Selection.PasteAndFormat (wdFormatPlainText)
End Sub

I mapped these to Ctrl+Alt+Shift+(<|||>) for keep format, text only and merge format respectively. I chose the modifier keys Ctrl+Alt+Shift to avoid clashes with predefined mappings, while (<|||>) suggested to me looking back (to the source format), neutral and looking forward (to the destination format), even if those are not really what happens.


Meaning of the Options


The meaning of the options is described as follows on MSDN (I have not tested this thoroughly):



  • Keep source formatting (wdFormatOriginalFormatting): “Preserves original formatting of the pasted material” – I presume this includes styles, but wonder what happens if style names clash. I presume that all current formatting is ignored.

  • Merge formatting (wdFormatSurroundingFormattingWithEmphasis): “Matches the formatting of the pasted text to the formatting of surrounding text” – I believe this means that the characters from the source and any emphasis (bold, italic, _ underlining _) are inserted in the current formatting, while all other original formatting is ignored.

  • Keep Text only (wdFormatPlainText): “Pastes as plain, unformatted text.” – Only the characters from the source are inserted, in the current formatting.


Options in Paste Special


I investigated the options in Paste Special…, recording macros for each option, as in the screenshot of the dialogue in Lernkurve’s answer. Some of them seemed to behave as keep format (sometimes doing odd extra things), others as text only, but none as merge format. (To get all options I had to paste text with some extra formatting, otherwise I just got two options; my set of options included “Picture (Windows Metafile)”, not in his screenshot.)


These were the results:


Sub SpecialPasteDoc() ' MS Office Word-document object
Selection.PasteSpecial Link:=False, DataType:=wdPasteOLEObject, Placement _
:=wdInLine, DisplayAsIcon:=False
End Sub
Sub SpecialPasteRTF() ' Formatted text (RTF)
Selection.PasteAndFormat (wdPasteDefault)
End Sub
Sub SpecialPastePlain() ' Unformatted text
Selection.PasteAndFormat (wdPasteDefault)
End Sub
Sub SpecialPastePic() ' Picture (Windows Metafile)
Selection.PasteAndFormat (wdPasteDefault)
End Sub
Sub SpecialPastePicEnhanced() ' Picture (Enhanced Metafile)
Selection.PasteAndFormat (wdPasteDefault)
End Sub
Sub SpecialPasteHTML() 'HTML Format
Selection.PasteSpecial Link:=False, DataType:=wdPasteHTML, Placement:= _
wdInLine, DisplayAsIcon:=False
End Sub
Sub SpecialPasteUnicodeText() ' Unformatted Unicode Text
Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine, _
DisplayAsIcon:=False
End Sub

graphics card - How to connect one HDMI and one VGA monitor to a laptop?

I have a Lenovo P400 with Windows 8 Operating System laptop and the graphics card is an Intel(R) HD Graphics 4000. Currently, I have a 20" LCD external monitor connected to the laptop through a VGA cable (since the external monitor only supports VGA, not HDMI). I am about to buy a second external monitor (which supports HDMI). I have two similar questions so I decided to make it in one post.




  1. Will my laptop be able to extend it's screen across all three screens (the two external monitors as well as the laptops screen)? (with one of the external monitors connected through HDMI and the other connected through VGA).


  2. Will my laptop be able to at least display on both external monitors without displaying on it's own screen?





There is a port which says 'HDMI' on my laptop.
Let me know if more information is required.

How do I set a Windows 7 Security Policy option to "not defined"?


I have two identical machines running Windows 7, and I'm trying to replicate the security policy settings of one on the other (these are the settings under secpol.msc).


One machine has a setting Local Policies > Security Options > Network security: LAN Manager authentication level setting of Not Defined. The other has one of the options selected.


How do I reset that option to "Not Defined"? It doesn't appear in the list of options when I open its properties and there's no visible action to clear it.


Answer



Delete the regkey entry (DWORD) LmCompatibilityLevel under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet\Control\Lsa and reboot.


windows 7 - How safe is it to re-partition a hard drive?


My hard disk has two drives, C-390gb & D-74gb, both primary partitions with NTFS file system. I want to increase the size of my D drive and allocate the minimum required space to C: to run Windows. I have Windows7 Ultimate 64-bit.


I wanted to know how safe it is to do this. Very recently I lost the complete data on C: which included the all s/w installers, documents, personal data, etc., and I had to reinstall Windows. Now I want to save all my data on D: and hence want to increase the size.


When I right click D: in disk management, there is no option to extend it. Also, there is an option of formatting. Does that mean that D: is not formatted?


I can't afford to take any major risks, since I do not have a Windows installation cd. Also, I don't have any external drive for backup.


Any help is highly appreciated.


Answer



I dont know if your approach is necessarily the best for what it is you seem to be trying to do here.


Having two partitions on 1 disk isnt really a great protection against losing your files in the future, what about disk damage? How did you lose your files on it first time round?


Anyway - to help you with your question - it sounds like you want to do this on the fly without reformatting. Id say this is another bad idea but anyway...


Why this whole thing is a bad idea:


-What are you defining as the minimum required space to run windows?


-You already have programs installed in program files, are you planning on keeping these on the c drive?


That would assume then that you never plan to install any programs in the future which will eat up your fixed and limited space. (Whats the point in keeping program files folder safe anyway? - the programs wouldnt all work if you ever reinstall windows - you would have to reinstall the programs - think registry entries etc - so this says to you you cant define a minimum space unless you never want to install any programs in the future)


-What about your Users directory? Is it moving drive? This can have horrible hangovers if done on the fly


-You may be considering moving the current program files folder - this could be a bad idea and also have hang over effects later on


This crazy fella has carried out what you seem to want to - would be a good idea to read his experiences and opinions.


For resizing your partitions on the fly I would look into getting a bootable disc with gparted or something on it.


Why dont you invest in another physical disc and reisntall windows afresh using this other disc for your personal data and leaving a full hard drive for windows and however much space it will need - dont confine your options too much - it will cause pain one day.
You would of course also be advised to back up this other physical disc :)


In saying that your whole sitution could probably have been avoided if you backed up your files anyway :p


Update:
To check if the d: drive is formatted go to "Computer" and double click on it - windows will alert you if it needs formatted.


windows 10 - Make a shift key behave like an arrow key


I have a Windows 10 laptop with a keyboard designed by idiots. They tried to cram the arrow keys where they don't belong, with the result that the up arrow key is between the right shift key and the / key (US keyboard layout). This is one of the stupidest things the designers could have done, because it means that when I go to hit the right shift key (which is most of the time), I end up hitting up arrow instead. This is incredibly annoying.


I found a program called Sharp Keys which allows me to remap the keys such that the up arrow behaves as shift and the right shift behaves as up arrow. Now, at least I can type. However, I've now lost important functionality for the up arrow key. Up arrow (now labeled "shift" on my keyboard) doesn't repeat. So, I can't just hold the key down to move up. Instead, I have to hit the key repeatedly. How can I fix this, so my right shift key behaves like up arrow and my up arrow key behaves like right shift?


Following a suggestion from the comments, I installed AutoHotkey. I have the following script:


RShift::Up
Up::RShift

I have the same problem as earlier. But, since AHK is a scripting language, is it possible to use it to change the repeat behavior?


Answer



While JJohnston2's answer gave me part of the solution, I wound up asking several other places and doing a lot of experimentation myself. Here's what I eventually wound up with:


Up::RShift
*RShift::
delay=400
While GetKeyState("RShift", "P") {
Send {Blind}{Up}
Sleep %delay% ; Set delay to taste
delay=30
}
Return

This solves the problems of key repeat and allowing shift+up to work as expected. There are two outstanding issues that I haven't solved, but which are low enough in priority that I'm going to consider this question solved anyway:



  1. The race condition isn't solved. I tried to put the first iteration outside of the loop, as JJohnston2 did, but it had no observable effect for me.

  2. The root cause of all this trouble is that the system doesn't seem to repeat the shift, Ctrl, or Alt keys, even though the others repeat. So, AHK can't repeat what it never sees. Since everyone I've asked for help hasn't had this issue, there must be something funky with my setup, but I don't have the foggiest idea what that might be.


How to print two different sheets with different scale options using Excel 2007 and Excel 2010?



I have two sheets in a .xlsx file.



The first sheet uses columns A to C and fits into a single landscape orientation A4 size paper.



The second sheet will fit into a single landscape orientation A4 size paper width with infinite pages tall. It uses columns A to L.



But when I select both sheets to print or when I select Print Entire Workbook, the preview always shows the second sheet to have some of the columns "chopped off".




If I print each sheet separately, it is fine. Of course the words on the printed first sheet look bigger than the words on the printed second sheet. I believe the second sheet is scaled down to about 47% in order to fit into the width of a landscape A4. The first one retains the 100% scale.



Another option is I choose to print both sheets at a scale of 47%. But of course, that means the first sheet does not maximize the width of the printed page and the words will look unnecessarily small on the first printed sheet.



My question is:



is there a way to print both sheets in a single print command while retaining the different scales for both sheets using Excel 2007 and 2010?



If the method involves preparing the Excel xlsx file in some way, I would like to know as well.




Currently, I am using PHPExcel to generate this xlsx file for an enterprise client hence the request.



The client is not tech savvy and I want to find out just how possible this can be achieved.



Answers need not involve knowledge of PHPExcel. I will simply take your Excel related answers and figure out how to accomplish it using PHPExcel.


Answer



You need to set the orientation and print settings in each sheet separately. Manually, you'd use the options on the Page Layout ribbon for that.



Sheet1 can be portrait with print area set from A1 to G30, for example. Sheet2 can be landscape with print area set from A1 to Q26, for example and scaled to print on one page.




Select each sheet individually and see the correct print preview.



Select both Sheet1 and Sheet2, or use "Print Entire Workbook" and the print preview will show Sheet1 in portrait and Sheet2 in landscape.



Here are some screenshots of the print preview, page 1 and page 2.



enter image description here



enter image description here


What is the use of this USB (mini-B) cable that has a forked connection?



What is the use of this USB (mini-B) cable that forks to a "black" and "red" connection:


USB (mini-B) cable that forks to a


The cable was included with some product. I'm pretty sure it was a camera (which I no longer have and never used). So, my guess was always that you could get faster transfer rate if both the red and black ends are plugged into the laptop. But that sounds crazy. Is that technically possible? If not, why have a forked connection?


Answer



Hard to tell from that pic, but it looks like it was for an external hard drive bay. Two USB-A plugs, one for data, one for more power, and mini-B to connect to the hard drive enclosure.


Wednesday, April 25, 2018

windows 7 - Remove a part of a list of names


I have some files and each files have distinct name but all of them have the same "-statement" at the end like this:


flower-statement.mp3
leave-statement.mp3
ball-statement.mp3
goal-statement.mp3

So I want to remove this: -statement


Is that possible?


Answer



Why can't you just do this with batch like so without any special programs? From what I tested, this will do exactly what you're looking for it to do which is parse out the -statement part of the file name and then rename each without it leaving the other parts of the file. This will work for all .mp3 files in a specific folder just fine.


In my below example where I have the C:\Users\User\Desktop\Test\*.mp3 just put your folder name in that location. Save that to a text file and rename to batch.cmd or something like that. Then just double-click to run it to perform the rename of the files in that folder parsing out the -statement part of it.


You can also make this script implicit to run the directory which you copy it to and just using *.mp3 from there rather than the full path.


EXPLICIT SCRIPT (specify the directory where *.mp3 are located)


@ECHO ON
FOR %%A IN ("C:\Users\User\Desktop\Test\*.mp3") DO (
CALL :RenameFiles "%%~A" "%%~NXA"
)
GOTO EOF
:RenameFiles
SET fname=%~2
SET renname=%fname:-statement=%
REN "%~1" "%renname%"
GOTO EOF

IMPLICIT SCRIPT (copy to and then run from the directory where *.mp3 are located)


@ECHO ON
FOR %%A IN ("*.mp3") DO (
CALL :RenameFiles "%%~A" "%%~NXA"
)
GOTO EOF
:RenameFiles
SET fname=%~2
SET renname=%fname:-statement=%
REN "%~1" "%renname%"
GOTO EOF



ADD SOMETHING TO THE END OF A RENAMED FILE BEFORE THE FILE NAME EXTENSION


(change fpart and mp3path to match what you need those to be for your usage. The fpart is what you need to add and the mp3path is the folder where the MP3 files reside.)


NOTE: This still assumes the MP3 files have -statement in the file name to be stripped out.


EXCPLICIT SCRIPT (with parse file name characters)


@ECHO ON
SET mp3path=C:\Users\User\Desktop\Test
SET fpart=_something
FOR /F %%A IN ('DIR /B "%mp3path%\*.mp3"') DO (
CALL :RenameFiles "%%~FPA" "%%~NA" "%%~XA"
)
GOTO EOF
:RenameFiles
SET fname=%~2
SET ext=%~3
SET renname=%fname:-statement=%
REN "%~1" "%renname%%fpart%%ext%"
GOTO EOF

EXCPLICIT SCRIPT (no parse just add file name characters)


@ECHO ON
SET mp3path=C:\Users\User\Desktop\Test
SET fpart=_something
FOR /F %%A IN ('DIR /B "%mp3path%\*.mp3"') DO (
CALL :RenameFiles "%%~FPA" "%%~NA" "%%~XA"
)
GOTO EOF
:RenameFiles
SET fname=%~2
SET ext=%~3
REN "%~1" "%fname%%fpart%%ext%"
GOTO EOF

bash - Evaluate each environment variable and set it back in ubuntu


I'm trying to write a shell script which reads all the environment variables, evaluate them for included env. variable with in them and re-export after evaluvation.


Example - I've an environment variable exposed like this:


echo $JVM_OPTS
-Djava.awt.headless=true -Xmx1600m -Djava.rmi.server.hostname=${CONTAINER_IP} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Duser.language=en -Duser.country=US -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0
echo $CONTAINER_IP
10.44.214.63

Now, I need to eval "JVM_OPTS" variable and substitute the value of ${CONTAINER_IP} in $JVM_OPTS to 10.44.214.63. Finally, set this evaluated value back in JVM_OPTS variable.


Sample Output:


echo $JVM_OPTS
-Djava.awt.headless=true -Xmx1600m -Djava.rmi.server.hostname=10.44.214.63 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Duser.language=en -Duser.country=US -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0

My Analysis so far:
I wrote the below code to do the task


#!/bin/bash
for path in $(printenv); do
path=`eval echo $path`
echo $path
done

printenv would give the entire env. variable along with values. I just need the name and then use the value.


How to achieve this?


Answer



The following worked for me.


for path in $(compgen -e) ; do
eval "$path=\"${!path//\"/\\\"}\""
done

As posted at https://stackoverflow.com/a/36449824/1925997


Tuesday, April 24, 2018

multiple monitors - Using ThinkPad Pro Dock with dual screen configuration



At my company we are using Lenovo laptop with a ThinkPad Pro Dock 90W. As specified in the documentation:





  • 1x DisplayPort 1.2 (Exclusive use with DVI-D)

  • 1x DVI-D (Exclusive use with DisplayPort)

  • 1x VGA



Which means that for a dual screen setup (identical DELL u2412Mb with 1920 / 1200) I need to connect one monitor to VGA (compulsary!) and one monitor to either DVI-D or DisplayPort. I am sure there is a low level hardware issue here, but this is irrelevant here.



My question is: I find the white color to be brighter on the monitor digitally connected (DVI-D) while white color is a little darker on the right side (monitor analog connected).




I did some extensive testing using also a DisplayPort to DVI adaptor. The monitor that has the brighter white is the one connected to DVI-D or the DisplayPort to DVI-P adaptor.



Is this an impression ? Should I do something with my DELL screen configuration ? Should I buy some kind of adaptors (DVI splitter?) ?


Answer



I finally found something that reduces the difference: I used: 'Preset Modes: Text' on both monitors. I now find the white color a little darker on both sides. If I move a white background window across both screen the difference is now invisible.


memory - Does Windows 7 task manager Performance tab show all RAM and CPU usage for non-admin users?

I'm trying to specify computer upgrades for our CAD computers. IT refuses to give me admin privileges even though I'm the de facto CAD manager. Most of our computers have 8 GB RAM, but I notice mine rarely goes over 6 GB used if I check the "performance" tab of task manager. I know the "Processes" tab is useless for monitoring my overall system needs as it doesn't show administrator tasks. But what about the "Performance" tab? Is it truly showing me overall usage, or just usage for my user's programs? Overall physical memory usage rarely seems to go much over 6 GB (but definitely not over 7 GB), even when I have a couple CAD files open and my typical 20-50 Chrome tabs. I get slowdowns or lag that seem to be from maxing out either RAM or CPU, but Task Manager does not seem to corroborate this. Is it because it is not accounting for administrator tasks?

My typical usage scenario

Invisible memory leak on Linux - Ubuntu Server (not disk cache/buffers!)





Please note, this is still happening. This is not related to linuxatemyram.com - the memory is not used for disk cache/buffers. This is what it looks like in NewRelic - the system leaks all the memory, uses up all swap space and then crashes. In this screenshot I rebooted the server before it crashed:




enter image description here



It is impossible to identify the source of the leak using common userspace tools. There is now a chat room to discuss this issue: http://chat.stackexchange.com/rooms/27309/invisible-memory-leak-on-linux



Only way to recover the "missing" memory appears to be rebooting the server. This has been a long standing issue reproduced in Ubuntu Server 14.04, 14.10 and 15.04.





The memory use does not show in top and cannot be recovered even after killing just about every process (excluding things like kernel processes and ssh). Look at the "cached Mem", "buffers" and "free" fields in top, they are not using up the memory, the memory used is "missing" and unrecoverable without a reboot.




Attempting to use this "missing" memory causes the server to swap, slow to a crawl and eventually freeze.



root@XanBox:~# top -o +%MEM
top - 12:12:13 up 15 days, 20:39, 3 users, load average: 0.00, 0.06, 0.77
Tasks: 126 total, 1 running, 125 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.1 hi, 0.0 si, 0.0 st
KiB Mem: 2,040,256 total, 1,881,228 used, 159,028 free, 1,348 buffers
KiB Swap: 1,999,868 total, 27,436 used, 1,972,432 free. 67,228 cached Mem


PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11502 root 20 0 107692 4252 3240 S 0.0 0.2 0:00.06 sshd: deployer [priv]
11336 root 20 0 107692 4248 3240 S 0.0 0.2 0:00.06 sshd: deployer [priv]
11841 root 20 0 107692 4248 3240 S 0.0 0.2 0:00.06 sshd: deployer [priv]
11301 root 20 0 26772 3436 2688 S 0.7 0.2 0:01.30 /usr/sbin/openvpn --writepid /var/run/openvpn.zanview.com.pid --status /var/run/openvpn.zanview.com.status 10 --cd /etc/openvpn --config /etc/openvpn/z+
11385 deployer 20 0 19972 2392 1708 S 0.0 0.1 0:00.03 -bash
11553 deployer 20 0 19972 2388 1708 S 0.0 0.1 0:00.03 -bash
11890 deployer 20 0 19972 2388 1708 S 0.0 0.1 0:00.02 -bash
11889 deployer 20 0 108008 2280 944 S 0.0 0.1 0:00.25 sshd: deployer@pts/3
12009 root 20 0 18308 2228 1608 S 0.0 0.1 0:00.09 -su

12114 root 20 0 18308 2192 1564 S 0.0 0.1 0:00.04 -su
12007 root 20 0 67796 2136 1644 S 0.0 0.1 0:00.01 sudo su -
12112 root 20 0 67796 2136 1644 S 0.0 0.1 0:00.01 sudo su -
12008 root 20 0 67376 2016 1528 S 0.0 0.1 0:00.01 su -
12113 root 20 0 67376 2012 1528 S 0.0 0.1 0:00.01 su -
1 root 20 0 33644 1988 764 S 0.0 0.1 2:29.77 /sbin/init
11552 deployer 20 0 107692 1952 936 S 0.0 0.1 0:00.07 sshd: deployer@pts/2
11384 deployer 20 0 107692 1948 936 S 0.0 0.1 0:00.06 sshd: deployer@pts/0
12182 root 20 0 20012 1516 1012 R 0.7 0.1 0:00.08 top -o +%MEM
1152 message+ 20 0 39508 1448 920 S 0.0 0.1 1:40.01 dbus-daemon --system --fork

1791 root 20 0 279832 1312 816 S 0.0 0.1 1:16.18 /usr/lib/policykit-1/polkitd --no-debug
1186 root 20 0 43736 984 796 S 0.0 0.0 1:13.07 /lib/systemd/systemd-logind
1212 syslog 20 0 256228 688 184 S 0.0 0.0 1:41.29 rsyslogd
5077 root 20 0 25324 648 520 S 0.0 0.0 0:34.35 /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
336 root 20 0 19476 512 376 S 0.0 0.0 0:07.40 upstart-udev-bridge --daemon
342 root 20 0 51228 468 344 S 0.0 0.0 0:00.85 /lib/systemd/systemd-udevd --daemon
1097 root 20 0 15276 364 256 S 0.0 0.0 0:06.39 upstart-file-bridge --daemon
4921 root 20 0 61364 364 240 S 0.0 0.0 0:00.05 /usr/sbin/sshd -D
745 root 20 0 15364 252 180 S 0.0 0.0 0:06.51 upstart-socket-bridge --daemon
4947 root 20 0 23656 168 100 S 0.0 0.0 0:14.70 cron

11290 daemon 20 0 19140 164 0 S 0.0 0.0 0:00.00 atd
850 root 20 0 23420 80 16 S 0.0 0.0 0:11.00 rpcbind
872 statd 20 0 21544 8 4 S 0.0 0.0 0:00.00 rpc.statd -L
4880 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty4
4883 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty5
4890 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty2
4891 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty3
4894 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty6
4919 root 20 0 4368 4 0 S 0.0 0.0 0:00.00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
5224 root 20 0 24048 4 0 S 0.0 0.0 0:00.00 /usr/sbin/rpc.mountd --manage-gids

6160 root 20 0 14540 4 0 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty1
2 root 20 0 0 0 0 S 0.0 0.0 0:03.44 [kthreadd]
3 root 20 0 0 0 0 S 0.0 0.0 1:04.63 [ksoftirqd/0]
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H]
7 root 20 0 0 0 0 S 0.0 0.0 16:03.32 [rcu_sched]
8 root 20 0 0 0 0 S 0.0 0.0 4:08.79 [rcuos/0]
9 root 20 0 0 0 0 S 0.0 0.0 4:10.42 [rcuos/1]
10 root 20 0 0 0 0 S 0.0 0.0 4:30.71 [rcuos/2]





I have observed this on 3 servers out of around 100 so far (though others may be affected). One is an Intel Atom D525 @1.8ghz and the other 2 are Core2Duo E4600 and Q6600. One is using a JMicron Technology Corp. JMC250 PCI Express Gigabit Ethernet Controller, the others are using Qualcomm Atheros Attansic L1 Gigabit Ethernet (rev b0).



I ran lshw on the trouble servers as well as on an example OK server. Problem Servers: http://pastie.org/10370534 http://pastie.org/10370537 and http://pastie.org/10370541 -- OK Server: http://pastie.org/10370544





This is an entirely headless application. There is no monitor connected and in fact no XServer installed at all. This should rule out graphics drivers/issues.




The server is used to proxy and analyse RTSP video using live555ProxyServer, ffmpeg and openCV. These servers do crunch through a lot of traffic because this is a CCTV application: http://pastie.org/9558324



I have tried both very old and latest trunk versions of live555, ffmpeg and openCV without change. I have also tried using opencv through the python2 and python3 modules, no change.



The exact same software/configuration has been loaded onto close to 100 servers, so far 3 are confirmed to leak memory. The servers slowly and stealthily leak around xMB (one leaking 8MB, one is slower, one is faster) per hour until all ram is gone, the servers start swapping heavily, slow to a crawl and require a reboot.





Again, you can see the Cached and Buffers not using up much memory at all. HugePages are also disabled so this is not the culprit.




root@XanBox:~# cat /proc/meminfo
MemTotal: 2,040,256 kB
MemFree: 159,004 kB
Buffers: 1,348 kB
Cached: 67,228 kB
SwapCached: 9,940 kB
Active: 10,788 kB
Inactive: 81,120 kB
Active(anon): 1,900 kB
Inactive(anon): 21,512 kB

Active(file): 8,888 kB
Inactive(file): 59,608 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1,999,868 kB
SwapFree: 1,972,432 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 14,496 kB
Mapped: 8,160 kB

Shmem: 80 kB
Slab: 33,472 kB
SReclaimable: 17,660 kB
SUnreclaim: 15,812 kB
KernelStack: 1,064 kB
PageTables: 3,992 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 3,019,996 kB

Committed_AS: 94,520 kB
VmallocTotal: 34,359,738,367 kB
VmallocUsed: 535,936 kB
VmallocChunk: 34,359,147,772 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0

Hugepagesize: 2,048 kB
DirectMap4k: 62,144 kB
DirectMap2M: 2,025,472 kB




Free shows the following (note cached and buffers are both low so this is not disk cache or buffers!) - the memory is not recoverable without a reboot:



root@XanBox:~# free -m

total used free shared buffers cached
Mem: 1,992 1,838 153 0 1 66


If we subtract/add the buffers/cache to Used and Free, we see:




  • 1,772MB Really Used (- Buffers/Cache) = 1,838MB used - 1MB buffers - 66MB cache

  • 220MB Really Free (+ Buffers/Cache) = 154MB free + 1MB buffers + 66MB cache




Exactly as we expect:



-/+ buffers/cache:      1,772        220


So around 1.7GB is not used by userspace and in fact used by the kernel as the system is actually using 53.7MB (see PS Mem output below).



I'm surprised with the amount of comments that think 1.7GB is used for caching/buffers - this is fundamentally misreading the output! - this line means used memory excluding buffers/cache, see linuxatemyram.com for details.






Here is a full list of running processes sorted by memory:



# ps -e -o pid,vsz,comm= | sort -n -k 2
2 0 kthreadd
3 0 ksoftirqd/0
5 0 kworker/0:0H
7 0 rcu_sched
8 0 rcuos/0

9 0 rcuos/1
10 0 rcuos/2
11 0 rcuos/3
12 0 rcu_bh
13 0 rcuob/0
14 0 rcuob/1
15 0 rcuob/2
16 0 rcuob/3
17 0 migration/0
18 0 watchdog/0

19 0 watchdog/1
20 0 migration/1
21 0 ksoftirqd/1
23 0 kworker/1:0H
24 0 watchdog/2
25 0 migration/2
26 0 ksoftirqd/2
28 0 kworker/2:0H
29 0 watchdog/3
30 0 migration/3

31 0 ksoftirqd/3
32 0 kworker/3:0
33 0 kworker/3:0H
34 0 khelper
35 0 kdevtmpfs
36 0 netns
37 0 writeback
38 0 kintegrityd
39 0 bioset
41 0 kblockd

42 0 ata_sff
43 0 khubd
44 0 md
45 0 devfreq_wq
46 0 kworker/0:1
47 0 kworker/1:1
48 0 kworker/2:1
50 0 khungtaskd
51 0 kswapd0
52 0 ksmd

53 0 khugepaged
54 0 fsnotify_mark
55 0 ecryptfs-kthrea
56 0 crypto
68 0 kthrotld
70 0 scsi_eh_0
71 0 scsi_eh_1
92 0 deferwq
93 0 charger_manager
94 0 kworker/1:2

95 0 kworker/3:2
149 0 kpsmoused
155 0 jbd2/sda1-8
156 0 ext4-rsv-conver
316 0 jbd2/sda3-8
317 0 ext4-rsv-conver
565 0 kmemstick
770 0 cfg80211
818 0 hd-audio0
853 0 kworker/2:2

953 0 rpciod
PID VSZ
1714 0 kauditd
11335 0 kworker/0:2
12202 0 kworker/u8:2
20228 0 kworker/u8:0
25529 0 kworker/u9:1
28305 0 kworker/u9:2
29822 0 lockd
4919 4368 acpid

4074 7136 ps
6681 10232 dhclient
4880 14540 getty
4883 14540 getty
4890 14540 getty
4891 14540 getty
4894 14540 getty
6160 14540 getty
14486 15260 upstart-socket-
14489 15276 upstart-file-br

12009 18308 bash
12114 18308 bash
12289 18308 bash
4075 19008 sort
11290 19140 atd
14483 19476 upstart-udev-br
11385 19972 bash
11553 19972 bash
11890 19972 bash
29503 21544 rpc.statd

2847 23384 htop
850 23420 rpcbind
29588 23480 rpc.idmapd
4947 23656 cron
29833 24048 rpc.mountd
5077 25324 hostapd
11301 26912 openvpn
1 37356 init
1152 39508 dbus-daemon
14673 43452 systemd-logind

14450 51204 systemd-udevd
4921 61364 sshd
12008 67376 su
12113 67376 su
12288 67376 su
12007 67796 sudo
12112 67796 sudo
12287 67796 sudo
11336 107692 sshd
11384 107692 sshd

11502 107692 sshd
11841 107692 sshd
11552 108008 sshd
11889 108008 sshd
1212 256228 rsyslogd
1791 279832 polkitd
4064 335684 whoopsie


Here is a full list of all running processes:




root@XanBox:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 33644 1988 ? Ss Jul21 2:29 /sbin/init
root 2 0.0 0.0 0 0 ? S Jul21 0:03 [kthreadd]
root 3 0.0 0.0 0 0 ? S Jul21 1:04 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Jul21 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S Jul21 16:03 [rcu_sched]
root 8 0.0 0.0 0 0 ? S Jul21 4:08 [rcuos/0]
root 9 0.0 0.0 0 0 ? S Jul21 4:10 [rcuos/1]

root 10 0.0 0.0 0 0 ? S Jul21 4:30 [rcuos/2]
root 11 0.0 0.0 0 0 ? S Jul21 4:28 [rcuos/3]
root 12 0.0 0.0 0 0 ? S Jul21 0:00 [rcu_bh]
root 13 0.0 0.0 0 0 ? S Jul21 0:00 [rcuob/0]
root 14 0.0 0.0 0 0 ? S Jul21 0:00 [rcuob/1]
root 15 0.0 0.0 0 0 ? S Jul21 0:00 [rcuob/2]
root 16 0.0 0.0 0 0 ? S Jul21 0:00 [rcuob/3]
root 17 0.0 0.0 0 0 ? S Jul21 0:13 [migration/0]
root 18 0.0 0.0 0 0 ? S Jul21 0:08 [watchdog/0]
root 19 0.0 0.0 0 0 ? S Jul21 0:07 [watchdog/1]

root 20 0.0 0.0 0 0 ? S Jul21 0:13 [migration/1]
root 21 0.0 0.0 0 0 ? S Jul21 1:03 [ksoftirqd/1]
root 23 0.0 0.0 0 0 ? S< Jul21 0:00 [kworker/1:0H]
root 24 0.0 0.0 0 0 ? S Jul21 0:07 [watchdog/2]
root 25 0.0 0.0 0 0 ? S Jul21 0:23 [migration/2]
root 26 0.0 0.0 0 0 ? S Jul21 1:01 [ksoftirqd/2]
root 28 0.0 0.0 0 0 ? S< Jul21 0:00 [kworker/2:0H]
root 29 0.0 0.0 0 0 ? S Jul21 0:07 [watchdog/3]
root 30 0.0 0.0 0 0 ? S Jul21 0:23 [migration/3]
root 31 0.0 0.0 0 0 ? S Jul21 1:03 [ksoftirqd/3]

root 32 0.0 0.0 0 0 ? S Jul21 0:00 [kworker/3:0]
root 33 0.0 0.0 0 0 ? S< Jul21 0:00 [kworker/3:0H]
root 34 0.0 0.0 0 0 ? S< Jul21 0:00 [khelper]
root 35 0.0 0.0 0 0 ? S Jul21 0:00 [kdevtmpfs]
root 36 0.0 0.0 0 0 ? S< Jul21 0:00 [netns]
root 37 0.0 0.0 0 0 ? S< Jul21 0:00 [writeback]
root 38 0.0 0.0 0 0 ? S< Jul21 0:00 [kintegrityd]
root 39 0.0 0.0 0 0 ? S< Jul21 0:00 [bioset]
root 41 0.0 0.0 0 0 ? S< Jul21 0:00 [kblockd]
root 42 0.0 0.0 0 0 ? S< Jul21 0:00 [ata_sff]

root 43 0.0 0.0 0 0 ? S Jul21 0:00 [khubd]
root 44 0.0 0.0 0 0 ? S< Jul21 0:00 [md]
root 45 0.0 0.0 0 0 ? S< Jul21 0:00 [devfreq_wq]
root 46 0.0 0.0 0 0 ? S Jul21 18:51 [kworker/0:1]
root 47 0.0 0.0 0 0 ? S Jul21 0:00 [kworker/1:1]
root 48 0.0 0.0 0 0 ? S Jul21 1:14 [kworker/2:1]
root 50 0.0 0.0 0 0 ? S Jul21 0:01 [khungtaskd]
root 51 0.4 0.0 0 0 ? S Jul21 95:51 [kswapd0]
root 52 0.0 0.0 0 0 ? SN Jul21 0:00 [ksmd]
root 53 0.0 0.0 0 0 ? SN Jul21 0:28 [khugepaged]

root 54 0.0 0.0 0 0 ? S Jul21 0:00 [fsnotify_mark]
root 55 0.0 0.0 0 0 ? S Jul21 0:00 [ecryptfs-kthrea]
root 56 0.0 0.0 0 0 ? S< Jul21 0:00 [crypto]
root 68 0.0 0.0 0 0 ? S< Jul21 0:00 [kthrotld]
root 70 0.0 0.0 0 0 ? S Jul21 0:00 [scsi_eh_0]
root 71 0.0 0.0 0 0 ? S Jul21 0:00 [scsi_eh_1]
root 92 0.0 0.0 0 0 ? S< Jul21 0:00 [deferwq]
root 93 0.0 0.0 0 0 ? S< Jul21 0:00 [charger_manager]
root 94 0.0 0.0 0 0 ? S Jul21 1:05 [kworker/1:2]
root 95 0.0 0.0 0 0 ? S Jul21 1:08 [kworker/3:2]

root 149 0.0 0.0 0 0 ? S< Jul21 0:00 [kpsmoused]
root 155 0.0 0.0 0 0 ? S Jul21 3:39 [jbd2/sda1-8]
root 156 0.0 0.0 0 0 ? S< Jul21 0:00 [ext4-rsv-conver]
root 316 0.0 0.0 0 0 ? S Jul21 1:28 [jbd2/sda3-8]
root 317 0.0 0.0 0 0 ? S< Jul21 0:00 [ext4-rsv-conver]
root 336 0.0 0.0 19476 512 ? S Jul21 0:07 upstart-udev-bridge --daemon
root 342 0.0 0.0 51228 468 ? Ss Jul21 0:00 /lib/systemd/systemd-udevd --daemon
root 565 0.0 0.0 0 0 ? S< Jul21 0:00 [kmemstick]
root 745 0.0 0.0 15364 252 ? S Jul21 0:06 upstart-socket-bridge --daemon
root 770 0.0 0.0 0 0 ? S< Jul21 0:00 [cfg80211]

root 818 0.0 0.0 0 0 ? S< Jul21 0:00 [hd-audio0]
root 850 0.0 0.0 23420 80 ? Ss Jul21 0:11 rpcbind
root 853 0.0 0.0 0 0 ? S Jul21 0:00 [kworker/2:2]
statd 872 0.0 0.0 21544 8 ? Ss Jul21 0:00 rpc.statd -L
root 953 0.0 0.0 0 0 ? S< Jul21 0:00 [rpciod]
root 1097 0.0 0.0 15276 364 ? S Jul21 0:06 upstart-file-bridge --daemon
message+ 1152 0.0 0.0 39508 1448 ? Ss Jul21 1:40 dbus-daemon --system --fork
root 1157 0.0 0.0 23480 0 ? Ss Jul21 0:00 rpc.idmapd
root 1186 0.0 0.0 43736 984 ? Ss Jul21 1:13 /lib/systemd/systemd-logind
syslog 1212 0.0 0.0 256228 688 ? Ssl Jul21 1:41 rsyslogd

root 1714 0.0 0.0 0 0 ? S Jul21 0:00 [kauditd]
root 1791 0.0 0.0 279832 1312 ? Sl Jul21 1:16 /usr/lib/policykit-1/polkitd --no-debug
root 4880 0.0 0.0 14540 4 tty4 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty4
root 4883 0.0 0.0 14540 4 tty5 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty5
root 4890 0.0 0.0 14540 4 tty2 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty2
root 4891 0.0 0.0 14540 4 tty3 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty3
root 4894 0.0 0.0 14540 4 tty6 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty6
root 4919 0.0 0.0 4368 4 ? Ss Jul21 0:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
root 4921 0.0 0.0 61364 364 ? Ss Jul21 0:00 /usr/sbin/sshd -D
root 4947 0.0 0.0 23656 168 ? Ss Jul21 0:14 cron

root 5077 0.0 0.0 25324 648 ? Ss Jul21 0:34 /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
root 5192 0.0 0.0 0 0 ? S Jul21 0:00 [lockd]
root 5224 0.0 0.0 24048 4 ? Ss Jul21 0:00 /usr/sbin/rpc.mountd --manage-gids
root 6160 0.0 0.0 14540 4 tty1 Ss+ Jul21 0:00 /sbin/getty -8 38400 tty1
root 6681 0.0 0.0 10232 0 ? Ss 11:07 0:00 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0
root 9452 0.0 0.0 0 0 ? S 11:28 0:00 [kworker/u8:1]
root 9943 0.0 0.0 0 0 ? S 11:42 0:00 [kworker/u8:0]
daemon 11290 0.0 0.0 19140 164 ? Ss 11:59 0:00 atd
root 11301 0.2 0.1 26772 3436 ? Ss 12:00 0:01 /usr/sbin/openvpn --writepid /var/run/openvpn.zanview.com.pid --status /var/run/openvpn.zanview.com.status 10 --cd /etc/openvpn --config /etc/openvpn/zanvie
root 11335 0.0 0.0 0 0 ? S 12:01 0:00 [kworker/0:2]

root 11336 0.0 0.2 107692 4248 ? Ss 12:01 0:00 sshd: deployer [priv]
deployer 11384 0.0 0.0 107692 1948 ? S 12:01 0:00 sshd: deployer@pts/0
deployer 11385 0.0 0.1 19972 2392 pts/0 Ss+ 12:01 0:00 -bash
root 11502 0.0 0.2 107692 4252 ? Ss 12:01 0:00 sshd: deployer [priv]
deployer 11552 0.0 0.0 107692 1952 ? S 12:01 0:00 sshd: deployer@pts/2
deployer 11553 0.0 0.1 19972 2388 pts/2 Ss 12:01 0:00 -bash
root 11841 0.0 0.2 107692 4248 ? Ss 12:02 0:00 sshd: deployer [priv]
deployer 11889 0.0 0.1 108008 2280 ? S 12:02 0:00 sshd: deployer@pts/3
deployer 11890 0.0 0.1 19972 2388 pts/3 Ss 12:02 0:00 -bash
root 12007 0.0 0.1 67796 2136 pts/3 S 12:02 0:00 sudo su -

root 12008 0.0 0.0 67376 2016 pts/3 S 12:02 0:00 su -
root 12009 0.0 0.1 18308 2228 pts/3 S+ 12:02 0:00 -su
root 12112 0.0 0.1 67796 2136 pts/2 S 12:08 0:00 sudo su -
root 12113 0.0 0.0 67376 2012 pts/2 S 12:08 0:00 su -
root 12114 0.0 0.1 18308 2192 pts/2 S 12:08 0:00 -su
root 12180 0.0 0.0 15568 1160 pts/2 R+ 12:09 0:00 ps aux
root 25529 0.0 0.0 0 0 ? S< Jul28 0:09 [kworker/u9:1]
root 28305 0.0 0.0 0 0 ? S< Aug05 0:00 [kworker/u9:2]





I also tried the ps_mem.py from https://github.com/pixelb/ps_mem



root@XanBox:~/ps_mem# python ps_mem.py
Private + Shared = RAM used Program

144.0 KiB + 9.5 KiB = 153.5 KiB acpid
172.0 KiB + 29.5 KiB = 201.5 KiB atd
248.0 KiB + 35.0 KiB = 283.0 KiB cron

272.0 KiB + 84.0 KiB = 356.0 KiB upstart-file-bridge
276.0 KiB + 84.5 KiB = 360.5 KiB upstart-socket-bridge
280.0 KiB + 102.5 KiB = 382.5 KiB upstart-udev-bridge
332.0 KiB + 54.5 KiB = 386.5 KiB rpc.idmapd
368.0 KiB + 91.5 KiB = 459.5 KiB rpcbind
388.0 KiB + 251.5 KiB = 639.5 KiB systemd-logind
668.0 KiB + 43.5 KiB = 711.5 KiB hostapd
576.0 KiB + 157.5 KiB = 733.5 KiB systemd-udevd
676.0 KiB + 65.5 KiB = 741.5 KiB rpc.mountd
604.0 KiB + 163.0 KiB = 767.0 KiB rpc.statd

908.0 KiB + 62.5 KiB = 970.5 KiB dbus-daemon [updated]
932.0 KiB + 117.0 KiB = 1.0 MiB getty [updated] (6)
1.0 MiB + 69.5 KiB = 1.1 MiB openvpn
1.0 MiB + 137.0 KiB = 1.2 MiB polkitd
1.5 MiB + 202.0 KiB = 1.7 MiB htop
1.4 MiB + 306.5 KiB = 1.7 MiB whoopsie
1.4 MiB + 279.0 KiB = 1.7 MiB su (3)
1.5 MiB + 268.5 KiB = 1.8 MiB sudo (3)
2.2 MiB + 11.5 KiB = 2.3 MiB dhclient
3.9 MiB + 741.0 KiB = 4.6 MiB bash (6)

5.3 MiB + 254.5 KiB = 5.5 MiB init
2.7 MiB + 3.3 MiB = 6.1 MiB sshd (7)
18.1 MiB + 56.5 KiB = 18.2 MiB rsyslogd
---------------------------------
53.7 MiB
=================================





I also tried slabtop:



root@XanBox:~# slabtop -sc
Active / Total Objects (% used) : 131306 / 137558 (95.5%)
Active / Total Slabs (% used) : 3888 / 3888 (100.0%)
Active / Total Caches (% used) : 63 / 105 (60.0%)
Active / Total Size (% used) : 27419.31K / 29580.53K (92.7%)
Minimum / Average / Maximum Object : 0.01K / 0.21K / 8.00K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME

8288 7975 96% 0.57K 296 28 4736K inode_cache
14259 12858 90% 0.19K 679 21 2716K dentry
2384 1943 81% 0.96K 149 16 2384K ext4_inode_cache
20916 20494 97% 0.11K 581 36 2324K sysfs_dir_cache
624 554 88% 2.00K 39 16 1248K kmalloc-2048
195 176 90% 5.98K 39 5 1248K task_struct
6447 6387 99% 0.19K 307 21 1228K kmalloc-192
2128 1207 56% 0.55K 76 28 1216K radix_tree_node
768 761 99% 1.00K 48 16 768K kmalloc-1024
176 155 88% 4.00K 22 8 704K kmalloc-4096

1100 1100 100% 0.63K 44 25 704K proc_inode_cache
1008 1008 100% 0.66K 42 24 672K shmem_inode_cache
2640 2262 85% 0.25K 165 16 660K kmalloc-256
300 300 100% 2.06K 20 15 640K sighand_cache
5967 5967 100% 0.10K 153 39 612K buffer_head
1152 1053 91% 0.50K 72 16 576K kmalloc-512
3810 3810 100% 0.13K 127 30 508K ext4_allocation_context
60 60 100% 8.00K 15 4 480K kmalloc-8192
225 225 100% 2.06K 15 15 480K idr_layer_cache
7616 7324 96% 0.06K 119 64 476K kmalloc-64

700 700 100% 0.62K 28 25 448K sock_inode_cache
252 252 100% 1.75K 14 18 448K TCP
8925 8544 95% 0.05K 105 85 420K shared_policy_node
3072 2351 76% 0.12K 96 32 384K kmalloc-128
360 360 100% 1.06K 12 30 384K signal_cache
432 337 78% 0.88K 24 18 384K mm_struct





I also tried scanning for a rootkit with rkhunter - it found nothing. And I tried to sync and dump cache with:



sync; sync; sync; echo 3 > /proc/sys/vm/drop_caches


It made no difference also.



I also tried to force swap or disable swap with:



sudo sysctl -w vm.swappiness=100

sudo swapoff /dev/sda2


I also tried using htop and sorting by memory and it is not showing where the memory is going either. The kernel version is Linux 3.13.0-40-generic #69-Ubuntu SMP.



Dmesg output: http://pastie.org/9558255
smem output: http://pastie.org/9558290






What is going on? - Where is all the memory going? - How do I find out?


Answer



My conclusion is it is a kernel memory leak somewhere in the Linux kernel, this is why none of the userspace tools are able to show where memory is being leaked. Maybe it is related to this question: https://serverfault.com/questions/670423/linux-memory-usage-higher-than-sum-of-processes



I upgraded the kernel version from 3.13 to 3.19 and it seems the memory leak has stopped! - I will report back if I see a leak again.



It would still be useful to have some easy/easier way to see how much memory is used for different parts of the Linux kernel. It is still a mystery what was causing the leak in 3.13.


hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...