Wednesday, May 15, 2013

Xubuntu, KVM and Display Resolution


If you are like me who use a KVM switch to control multiple computers, you may run into resolution problem with Ubuntu.

Since the computer is not being connected to the monitor directly, it may not get the DDC information from the monitor to set the resolution correctly.  In my case, I was stuck at 1024x768@60KHz.

A quick google search brought me to this nice post that helps me get pass the 1024x768.

https://www.tecmint.com/set-display-screen-resolution-in-ubuntu/

Here are few quick notes on steps I took.

1) Use cvt   1920   1080 to produce a modeline, e.g.

# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
2) Then made this available for selection

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
 Use xrandr to get the ID for your display, e.g. VGA-1
$ xrandr
 
 
$ xrandr --addmode VGA-1 "1920x1080_60.00"

3) Test the new resolution option by using your system Display setting tool, e.g.




If the setting works for you, then you can make this permanent by adding a little profile file to /etc/profile.d/, e.g.


$ sudo vim /etc/profile.d/external_monitor_resol.sh
Within this file, just add the two xrandr lines you were using earlier, e.g.



xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VGA-1 "1920x1080_60.00"



Now restart your system.  The new resolution should stay if things are done correctly.

 

Edited 2021-04-22:

It seems there is a simpler alternative.

1) Use xrandr to find out the supported resolutions, e.g.

 


2) In my case, 1920x1080@60 is the resolution I am aiming for.  Now, edit the grub file to tell the kernel about this resolution by adding video=1920x1080@60 as a parameter to the GRUB_CMDLINE_LINUX_DEFAULT option like below:





3) Run update-grub to apply the settings

After reboot, this new resolution should now be available to the system.

 

ref: https://askubuntu.com/questions/973499/wayland-how-to-set-a-custom-resolution















Saturday, March 30, 2013

Disable Thums.db

Just found a way to disable the annoying thumbs.db from being created:

http://www.technoleros.com/turn-off-caching-of-windows-7-thumbnails-in-hidden-thumbs-db-files/

Well done Microsoft, it is very well hidden in gpedit.msc

"To start the Local Group Policy Editor, click the Windows 7 start icon and type gpedit.msc in the search text box and hit Enter.  The Editor will open to the top-level Local Computer Policy, so you will have to expand the User Configuration item in the left-side pane of the Editor window.  Drill down through Administrative Templates, then Windows Components, and click on the Windows Explorer item.  Near the top of the list in the right-hand pane of the Editor window you will find the setting “Turn off the caching of thumbnails in hidden thumbs.db files”  "

While you are there, you may want to disable Windows from showing recent search terms too.

Friday, March 29, 2013

forfiles

Recently, I have come across a "find" like command in Windows called "forfiles".  Similar to the find command in Linux, you can use this command to locate files and execute a command on them.  Full details can be found at:

http://technet.microsoft.com/en-us/library/cc753551(v=ws.10).aspx

Sunday, March 17, 2013

Getting Linux to resolve NetBIOS names

Like many others, my network consists of a mixture of Linux and Windows machines.  By default, it seems Linux doesn't not seem to resolve NetBIOS names.  After a quick Google search, this seems can be "fixed" by adding wins to the line begins with hosts: in the nsswitch.conf file found in /etc/

cd /etc/nsswitch.conf
sudo pico nsswitch.conf
locate the line that starts with host:
append the word wins to its end, e.g.

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins

save the changes, and now you should be able to ping computers on your network with their NetBIOS names.

(ref: http://www.linuxquestions.org/questions/linux-networking-3/ping-netbios-names-from-linux-samba-271336/)

edited: can use NetBIOS name with mount command too.  This is much easier to remember than using IPs of machines.

edited 2018-02-04: You may need to install winbind to get this to work.  Here is the command.

sudo apt install winbind libnss-winbind

service winbind restart



Monday, February 4, 2013

Robocopy to NAS (FFT)

robocopy is a nice command prompt utility for backup files.  You can configure it to only copy files that are newer (based on timestamp) to save time and bandwidth when you are doing backup.  However, there seems to be a problem when it is backing up files from NTFS filesystem to other filesystem, e.g. ext4, XFS etc commonly found in NAS.  It seems time granularity of time value can causes robocopy mistreats files.  That is robocopy may treat identical files as different because it thinks one of them is newer.  Luckily, this can easily be fixed by use the /FFT swtich.  Full explanations can be found at this link

http://www.conetrix.com/Blog/post/Robocopy-Incorrectly-Detects-Files-as-Newer-When-Copying-Between-Different-File-Systems.aspx

Hence, the robocopy command I would use is:

robocopy [source directory] [target directory] /MIR /Z /DCOPY:T /FFT