Thursday, December 5, 2013

Samba Share Permission in a Nutshell

In this post I'm writing all the troubles that I faced when setting up samba shares for Windows and MAC, to help novice users get the samba up and running as quickly as possible. Do note that all the tips & tricks shared here is meant to get things up and running quickly, it might create security hole. Use at your own risk and be sure to research more if you are deploying for high security concern mission.

New created folder or copy & paste into samba shared folder do not follow permission set by smb.conf
The key settings are the following (e.g. permissions 775)
  • create mask = 0775
  • force create mode = 0775
  • security mask = 0775
  • force security mode = 0775
  • directory mask = 2775
  • force directory mode = 2775 (If you change this to 0755, it won't work. So this parameter is very important)
  • directory security mask = 2775
  • force directory security mode = 2775
Now, why 2775?
  • 2 = the setgid bit is set (2) which makes newly created directories have the same group ownership as the parent.
  • 77 = owners and group members of the files have full access to them
  • 5 = everyone else can enter the directories and view the file names (use with caution)
To be continue...

Saturday, October 12, 2013

Terminal does not have history and not showing path?

What happen when a new user's terminal (xterm, lxterminal etc):

  1. does not display any path (only show $>)
  2. does not support Up key for recall previous command?
It is because the new user is using /bin/sh instead of /bin/bash. To solve this, simply do sudo chsh, then key in /bin/bash when prompted to choose an option.

Restart the terminal then you should be able to get all the features back.

The root cause for this is nothing is specified when the user is being created using command line. Be sure to specify to use /bin/bash to avoid this.

Wednesday, August 7, 2013

Fast apt-get with apt-fast

Ever experience slow download even with 10Mbps++ internet? The author has written a very useful article to share how to speed everything up with apt-fast:

[Linux] file_mode, dir_mode or permission not working correctly in Samba Share or Mount folder

Users permission in Linux is really complicated, for samba share, you need to take care:

  1. the folder permission of the parents folder where your samba share is located (at server side)
  2. the folder permission of the parents folder where your fstab mounted folder is located
  3. the create mask and directory mask in /etc/samba/smb.conf on your server
  4. the file_mode, directory_mode, nopermrw and credentials in your /etc/fstab on client PC
General rules are parent folders permission will always overwrite the smb.conf & fstab

When do I need to check the parents folder permission?
  1. If you have set everything in both files and still cannot get the correct permission for new created file/directory in your samba shares. Check client PCs mount folder's parent's permission
  2. If client PCs has problem access the samba shares, even with the correct username & password entered. Check server samba share parent's folder permission
  3. When you need valid users = xxx, xxx to give access to client PCs. Check server samba share parent's folder permission
I have set the samba/fstab/parent folder permission, but I still don't have write permission?
  1. you need to add uid=***your current user name*** at the fstab mount option.
Known Issue
  1. When creating file/directory in the mount folder (using Ubuntu 12.10), it does not honor the create mask & directory mask set by the server's smb.conf. I'm still looking for a solution... appreciate if anyone can help.

Saturday, August 3, 2013

[Ubuntu] Can access samba network share by IP but not Netbios name from Windows

After whole long day of troubleshooting why we cannot resolve samba shared folders using the NetBIOS Name defined in smb.conf.. finally I have figured out the root of the problem:
Hostname CANNOT equal to NetBIOS name!!!
A bit of background...

  1. our server hostname is server1
  2. our NetBIOS name is server1 (defined in smb.conf)
  3. IP-address is 10.0.0.2

From Windows 7 / OSX we can access the samba shares using \\10.0.0.2\share, as well as \\server1.local\share (the .local is a result of running avahi-daemon). We can also ping 10.0.0.2 or server1 or server1.local, but we simply cannot access with \\server1\share

By changing the Hostname in /etc/hosts & /etc/hostname to any name other than "server1", or change the NetBIOS name in smb.conf to any other name, we can now get it work.

This is rather weird for a Windows user like me, where only hostname need to be set and we can access directly from other PC in the network without bothering what is NetBIOS. Linux is indeed too tricky!

Anyway, kind of fun when able to figure out what's wrong. It makes me love and hate Linux at the same moment!

[Ubuntu] Can ping internet IP address but cannot resolve web address

If you got error when trying to ping any web address e.g. www.google.com, but can ping its IP address, there could be something wrong with the resolv.conf.

Despite you could have set the dns-nameservers in /etc/network/interfaces, the resolv.conf may not be updated yet. And if you have some running process and could not do ifdown / ifup, you can do nano /etc/resolv.conf, comment the original nameserver 127.0.0.1 to nameserver 8.8.8.8 (or the DNS provided by your ISP).

Ubuntu should now resolve the web address correctly!

Wednesday, July 31, 2013

How to solve chmod doesn't work on mounted folder

When chmod does not have any effect on mounted folder, it could be wrong filesystem flag being used:
  • try umount the folder first
  • if you mount folder is a HDD, check its filesystem type by fdisk -l
  • if it is a NTFS, use the following in fstab :
    •  /dev/sda1    /mnt/folder    ntfs-3g    rwx,uid=xe4,iocharset=utf8,umask=000    0    0
  •  then mount -a
Then the chmod should work now.

Tuesday, July 30, 2013

Damn you, buggy Samba 3.6.3

I have been finding solution to address a samba sharing (Ubuntu 12.04.2 LTS) for few days, the errors that I faced:

  1. windows 7 cannot access share
  2. windows 7 keep asking password to access samba share
  3. windows 7 computer on other VLAN cannot browse the Ubuntu server with Windows Explorer
  4. troubleshoot using smbclient -L localhost -U% give errors such as:
    - tree connect failed, NT_STATUS_CONNECTION_INVALID
And very very luckily... I found a discussion & an article which discussed about the bug found in Samba 3.6.3, and suggest to upgrade to 3.6.7:

Thanks god their suggestion work.. and damn Ubuntu & Samba, how could they release such a buggy version for LTS and do not issue immediate upgrade in the official repository?!!

Alright, here's the solution copy from Marcel's blog:
  • sudo add-apt-repository ppa:nathan-renniewaldock/ppa
  • apt-get update
  • apt-get install samba
Voila! Now Samba works like a charm!

Saturday, July 27, 2013

[Ubuntu] The bad day!! How to recover from dmraid

Today is a real bad day, one of the Ubuntu server that I "managed" (it's not me who installed it) has gone down! There could be two reasons:
  1. Incompatible version of Zentyal (Zentyal 3.0 was accidentally installed on this 12.10, causing the samba not functioning)
  2. The electrical leak in the office due to DP box does not have proper earth line installed. Damn it, the whole rack is covered by electricity, and I got an electric shock! Luckily it was not at high current else all devices and I would have died =_=!
Well.. after hours of troubleshooting, I could not bring the server up and running again. It halted at different stage of loading, sometimes failed to load Samba, sometimes failed at Checking Quota...

I do suspect it is caused by the Zentyal... but time is running out. I rush back to home, taking my laptop SSD* installed with Ubuntu 12.10, together with as many as HDD I could found available for the backup**, and plugged into the server.

Voila! Now I'm inside my laptop Ubuntu, and by running dmraid -r, I could now see the RAID under name isw_xxxxx (isw is a prefix for Intel RST). By running dmraid -ay (activate with silent mode YES), I can now see the whole RAID in Nautilus.

I'm backing up those file now... hopefully the files and directories in the server are still in good condition. Losing a single files will be disaster. Cross finger!

=======================

* Why SSD? Because the Ubuntu server was installed using dmraid and Intel RST (Rapid Storage Technology), so SSD can work well as most of the time SSD is used under AHCI. SATA drive that previously installed without AHCI would fail to boot up.

** Please make sure you use a reliable HDD for the backup. You won't like to fail the second time where you could be only having once chance to perform the recovery.

*** Regarding the mdadm and dmraid, here are some good reads:

  • https://help.ubuntu.com/community/FakeRaidHowto
  • http://raid6.com.au/posts/mdadm_advantages/
  • http://www.sourceware.org/lvm2/wiki/DMRAID

Monday, July 15, 2013

[Centos] yum-complete-transaction error

These commands are useful when yum-complete-transaction gives error, in my case "error removing yum" & "duplicate packages" (yum-utils need to be installed to perform no. 2 & 3):

  1. yum-complete-transaction --cleanup-only
  2. package-cleanup --dupes
  3. package-cleanup --problems

Monday, April 29, 2013

[Ubuntu] Wireless stop working after upgrade

If wireless fail to work after upgrade, be sure to use lspci | grep network to look for your wireless device and include this info when you post online for help.

If you're using Broadcom BCM4312 (full name: "Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)") same as mine, then you probably could easily fix by installing the following:
sudo apt-get install firmware-b43-installer b43-fwcutter
or try another one if the above doesn't work:
sudo apt-get install broadcom-sta-common
You're adviced to reboot your system, but before that you may try:

  1. off & on your wireless device, it may work straight away without system reboot.
  2. run command modprobe b43

If you choose to reboot and the wireless device doesn't start, try modprobe b43. To autoload the device at startup, edit /etc/modules, add "b43" to the list. That should load it during startup.

Good luck!

Sunday, March 24, 2013

[Ubuntu] iNotify-Tools: The Realtime File Monitoring Tool

I have been searching for a good real time file monitoring tools to save time on checking what directories or files has been updated by my colleagues. It seems the iNotify-Tools that built into Linux kernel has gained a lot of recommendation, and even IBM has an article on their website address for this little tool.

To setup inotify is fairly simple:
  1. apt-get install inotify-tools
  2. after install, it comes with two module:
    • inotifywait - it runs and keep monitor for changes happen in the target folder/file, and the results can be output to an external file.
    • inotifywatch - it outputs a summary count of the events received on each file or directory.
  3. We will use inotifywait to monitor our folder and output a text file in the same folder.
inotifywait /targetFolder -mr -e create,delete,move --timefmt "%D_%a_%H:%M" --format "%T | %w%f | %e" -o /targetFolder/FolderReport.txt --exclude "FolderReport.txt"
  • "-m" is used to continuously monitor the target. Without this, by default it will exit after the first event occurs.
  • "-e" is to specify the event that we want to monitor. Full list can be viewed by execute inotifywait -h
  • "--timefmt" is used to add date and time to the log. By default the result doesn't has such info.
  • "--format" has to be specified if --timefmt is used. %T is the time, %w is the path of the folder being monitored, %f is the file name and %e is the event (action done to the folder/file). We can add any words in between the parameter, and it will be output as well. For example, %w the folder is %f %e will output = "/home/tecsun/folder the folder is TestFolder CREATE,ISDIR. (blue is the output specified by parameter) 
  • "-o" is to output the result to file (else it would display on the terminal)
  • "--exclude" is to exclude the result file being monitored, especially when modify event is triggered, so it won't get into infinity loops.
There is one more tools namely iwatch, which is based on inotify, would allow sending of email when event being triggered. Another one which I have not tested is gamin, if anyone of you happen to test this, please let me know how it works.

Thursday, February 28, 2013

[Ubuntu] Xrdp password failed after user password changed

If the password of users has been changed, Xrdp service must be restarted to reflect the changes made. Else, it would give an error of either "password failed" or "login error".

To restart xrdp service, simply type this command in terminal:
/etc/init.d/xrdp restart


After that you should be able to login from remote connection.

Saturday, February 23, 2013

[Ubuntu] Temporarily / Permanently Mount Cifs Network Shares

It is strange that Ubuntu 12.10 doesn't come with cifs-utils installed. Whenever you try to mount a network folder via mount -t cifs -o username=user,password=pass //server-name/shared /mnt/shared, it will give you the following error message:

1:  mount: wrong fs type, bad option, bad superblock on //192.168.0.11/Dropbox,  
2:      missing codepage or helper program, or other error  
3:      (for several filesystems (e.g. nfs, cifs) you might  
4:      need a /sbin/mount.<type> helper program)  
5:      In some cases useful info is found in syslog - try  
6:      dmesg | tail or so  

Execute dmesg | tail will return the following result:

1:  [ 5537.959706] CIFS VFS: Connecting to DFS root not implemented yet  
2:  [ 5537.959815] CIFS VFS: cifs_mount failed w/return code = -22  

To solve this, simply apt-get install cifs-utils. After that run the same command again and you should be able to mount the network shared folder.

To permanently mount the shared folders, go to /etc/fstab, and add the following line:

1:  //server-name/shared     /mnt/shared     cifs     defaults,_netdev,credentials=/home/user/.smbcredentials     0     0  

_netdev parameter is being explained at the last section of this documentation, which in general mean connect only when network is available:
https://help.ubuntu.com/community/MountWindowsSharesPermanently

credentials and /home/user/.smbcredentials is a file created to store the username and password for the remote login, so that we don't put these sensitive info at risk because the /etc/fstab can be viewed by every users on the system. DO NOT forget to set the file permission for the .smbcredentials:

1:  chmod 600 /home/user/.smbcredentials  

Now enjoy working with your network shares!

If you would like to read on, the following articles is good to go:
  1. https://help.ubuntu.com/community/Samba/SambaClientGuide
  2. https://wiki.ubuntu.com/MountWindowsSharesPermanently
  3. https://help.ubuntu.com/community/MountWindowsSharesPermanently




Friday, February 22, 2013

[Ubuntu] Oracle Java 7 Runtime Installation Error

First, I didn't not use manual method for the installation. Instead, I used the PPA method which discussed under here:
http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html

However, the installation halted in half way due to my HDD running out of space.

After cleaning up the space and re-run with:
apt-get install -f

It keeps giving me this error:
 Setting up oracle-java7-installer (7u15-0~webupd8~1) ...  
 Installing from local file /var/cache/oracle-jdk7-installer/jdk-7u15-linux-x64.tar.gz  
 Removing outdated cached downloads...  t
 mv: cannot move `jdk1.7.0_15' to `java-7-oracle/jdk1.7.0_15': Directory not empty  
 dpkg: error processing oracle-java7-installer (--configure):  
  subprocess installed post-installation script returned error exit status 1  
 Errors were encountered while processing:  
  oracle-java7-installer  

And this error has disabled Synaptic Package Manager from function properly.

Tried a few solutions but to no avail:
  • apt-get purge
    - cannot be run
  • apt-get autoremove
    - cannot be run
  • dpkg --remove --force-remove-reinstreq oracle-java7-installer
  • http://www.khattam.info/solved-subprocess-pre-removal-script-returned-error-exit-status-2-error-2009-08-04.html - This is a great article suggesting a few solutions, big thanks to the author. It may help you to solve Java7 installation problem, give it a try. Especially the step 6, it has successfully remove the oracle-java7-installer and get apt-get work again, but that does not install Java 7 which is our initial intention. Read on...
  • Remove the installer file located in /var/cache/oracle-jdk7-installer, then re-download & run the installer... cannot resolve the problem as well
And what did the magic is... delete the directory 'jdk1.7.0 15' located inside the 'java-7-oracle', then re-run the installer apt-get install -f. Voila! The installation should complete without any more hassle.

What happened?

The 'jdk1.7.0 15' & 'java-7-oracle/jdk1.7.0 15' are actually located in /var/cache, but for some reason the 'jdk1.7.0 15' is already exist in 'java-7-oracle' folder. When the installer try to copy it into the parent folder, it cannot overwrite it, suggested by the error message 'Directory not empty'.

Somehow, this cannot be solved by changing the directory write permission, so delete the directory has become the immediate working method.

[Ubuntu] How to configure Smartmontools to send email report

There are a few steps-by-steps tutorial to teach you how to configure Smartmontools to email report to you when drives failed. But to get it works is may not be as simple as complete the steps written.

Especially for Ubuntu users, most of you that encountered this problem may have followed the instruction here:
https://help.ubuntu.com/community/Smartmontools

The documentation is very good indeed and it explains almost everything. However, it forgot to mention that if you are not sending email to root account, you are actually sending email externally and the mail simply may not work on that.

How to tackle this has been documented here:
https://wiki.archlinux.org/index.php/S.M.A.R.T.
*Despite it is for Arch Linux, but it works fine to configure Ubuntu.

Basically, you would have to configure ssmtp or any other MTA (Mail Transport Agent) so that Ubuntu can use it to send email to you.

The setup is rather simple, you can get guidance from:
https://wiki.archlinux.org/index.php/SSMTP

I hope this post will help any of you solve this issue quickly, need not to be like me wasting few hours to searching for solution just to get this simple function work.

Sunday, February 17, 2013

How to deal with space in file path?

In modern computing, we are not restricted to use file/folder name with space between each words. This tends to create trouble if we want to mount the path in /etc/fstab

The solution to this is to add "\040" where the space is. For example:
//192.168.0.2/Shared Folder
has to be written as
//192.168.0.2/Shared\040Folder

Saturday, February 16, 2013

[Ubuntu] It's Alacarte time! Menu Editing in Ubuntu

Editing application menu in Lubuntu is not as straightforward as in Windows. Right-clicking only allow adding shortcut to desktop.

Editing .xml to change how the application menu look is not fun to work with and very time consuming.

Very luckily, the is a small utility namely "alacarte" that let you modify it in GUI. To install, simply:
sudo apt-get install alacarte
This is how alacarte look like. Simple & intuitive

[Ubuntu] An Easy Way to Remove Unwanted Locale

There are many unwanted Locale settings file in Ubuntu which can be deleted to save some space.
sudo apt-get install localepurge
Run the command above, a multiple choice DOS-liked user interface will be prompted. Selected those that wish to be kept and all deselected will purge.

Wednesday, February 13, 2013

[Ubuntu] DraftSight installation

DraftSight installation is not as simple as it seems to be even though it comes with .deb file. The dependencies are not fully resolved, leaving out a few modules required by DraftSight missing. The error message that appeared is:
Failed to load modules
If this happened, simply install the following:
  1. Install this first alone:
    sudo apt-get install ia32-libs
  2. Then install:
    sudo apt-get install libdirectfb-extra libxcb-render-util0
If the above do not solve DraftSight start up issue, then try the method discussed in this helpful article:

Become Terminal Pro with Shortcuts Keys

Ever want to be proficient with terminal (linux command line)? Then these are the tips & tricks that you must know:

Become a Command Line with These Time-Saving Shorcuts by lifehacker.com
URL: http://lifehacker.com/5743814/become-a-command-line-ninja-with-these-time+saving-shortcuts 

Share this post if the article has made you a pro, have fun!

Monday, February 4, 2013

[Ubuntu] After upgrade cannot access internet despite connection is up

I upgraded our server last night via apt-get update & apt-get upgrade, when the server reboot it cannot connect to internet and other network segment. It can access only all the resources in the same subnet.

There are a few solutions worth to try:

  • ifdown the network interface and ifup it again
  • when perform upgrade of Ubuntu, the system might modified /etc/resolv.conf to include 127.0.0.1 as nameserver. Sometimes this will mess thing up and you can't get online. You can either delete everything inside, or use google DNS: nameserver 8.8.8.8
  • if you have bonding, you might want to add dns-nameserver 8.8.8.8 8.8.4.4 under your bond0
  • restart your networking: restart networking (this could be different from reboot Ubuntu. Because my connection got fix by restarting the network, while reboot doesn't help at all
If you do not wish to tackle with all this stupid problem, my advice is only upgrade when you need it. As long as your server is running fine and the upgrade is not going to fix any issues, just keep it as it is.

[Ubuntu] Wireless not working when on battery

If you have read my previous post How to release/renew IP when dhclient doesn't work, but you still unable to use your wireless when running your laptop on battery mode, then it could have something to do with the power management in Ubuntu.

The symptom you might get is:
  1. the wireless IP cannot be renew/release
  2. the wireless connection is up, but you can ping local or internet
  3. the wireless takes forever to get an IP from your router
The reason behind is when you're on battery, Ubuntu will activate power saving on your wireless device. This made the device cannot function properly. In this case my wireless device is:
"Broadcom Corporation" "BCM4312 802.11b/g LP-PHY" -r01 "Foxconn International, Inc." "T77H030.00 Wireless Mini PCIe Card"
If you are asking for help, you can identify your network controller by enter this command in terminal (special thanks to Serendah Linux from Ubuntu Malaysia LoCo Team to provide this command):
lspci -mm | grep Network | sed 's/.*"Network controller" //'
There are some solution that propose to deal with the 'wireless' file in the following location
  • /etc/pm/power.d
  • /usr/lib/pm-utils/power.d
but those doesn't work for me, and it might happen to you as well. If that is the case, you can still solve it by manual enter the following command into terminal:
  • iwconfig eth1 power off
Please note that the "eth1" has to be your wireless interface. Some might name after "wlan1". You have to enter the command every time you reboot a new session. I have not found any working method to execute this command during start up, if you do found it, please share with me.

Friday, February 1, 2013

[Ubuntu] How to release/renew IP when dhclient doesn't work.

I have encountered a very weird issue with Ubuntu 12.10 wireless networking where dhclient -r and dhclient cannot work as expected. The wireless device lock to the same IP, and unable to connect to internet or any other shared resources in the network.

Any other methods such as:
  1. Delete the profile in network manager
  2. restart networking service
  3. ifdown and ifup the interface
  4. Manually set IP address & DNS server
  5. Restart the router
Do not work as well. So what's the real fix for this problem? If you ever encounter the same problem as I did, you might try delete all the DHCP lease file located in /var/lib/dhcp/. New one will be generated automatically. Here's how my DHCP folder look alike:


If delete doesn't work for you, give me five because we are having the same issue. When I open the folder, there are multiple files inside, I deleted all (make sure you have turn off you wireless device before doing so) and let the system generates a new one.

After that, open up the new files with root privilege leafpad (or any other text editor), you will see the following:
 lease {  
  interface "eth1";  
  fixed-address 192.168.1.122;  
  option subnet-mask 255.255.255.0;  
  option routers 192.168.1.1;  
  option dhcp-lease-time 50400;  
  option dhcp-message-type 5;  
  option domain-name-servers 202.188.0.133,202.188.1.5;  
  option dhcp-server-identifier 192.168.1.1;  
  option dhcp-renewal-time 25200;  
  option dhcp-rebinding-time 44100;  
  renew 5 2013/02/01 22:24:39;  
  rebind 6 2013/02/02 04:55:53;  
  expire 6 2013/02/02 06:40:53;  
 }  
It's very simple here, modify the 10.0.0.122 192.168.1.122 (Updated: 25 Nov 2014) to some other available IP address, save it and turn on your wireless device. Wait for a few seconds and voila!

Most probably you are now able to online and start surfing. And if this does help, please leave me a comment so at least I know my blog help others. Cheers~!

Thursday, January 31, 2013

[Fedora] Laptop Broadcom Wireless not working?

The downside of Fedora compared to Ubuntu on my laptop is the Broadcom BCM4312 wireless device doesn't install automatically, that mean I'm unable to turn on my wireless for net browsing.

Luckily, how-to instruction is well documented in FedoraForum.org:
http://forums.fedoraforum.org/showthread.php?t=239922

[Ubuntu] Chinese input in Ubuntu 10, 11, 12

I found a very nice article discuss about chinese input in Ubuntu:
http://www.pinyinjoe.com/linux/ubuntu-10-chinese-input-pinyin-chewing.htm

To me, Sun Pinyin layout looks the best to me due to its 9 displays per row, but it is really bad for laptop users that it use preset key of Page Up / Down for navigation.

I have not figure out how to change the preset key, and that force me to revert back to the first PinYin method, which is pretty nice to use and has same navigation keys as Google Pinyin and Unispim Pinyin that I used in Windows.

Wednesday, January 30, 2013

How to Fix Multi-boot - Lost of any OS installed before Ubuntu

Big thanks to Ryugamine Mikado from General Linux Discussion Malaysia for sharing such a nice option to fix the multi-boot!
@Tecsun Yeep hi there oh it actually scans the entire disk for all OS and it has been PROVEN to recover any type of OS (i myself used it once to recover my arch when I accidentally fuk'd up my grub.conf) plus many more options such as recovering partition tables , bootsectors and such but i think it only works with GRUB/GRUB2 ,so if you're using another type of bootloader such as LILO you would have to resort to something else
The GUI method of fixing the multi-boot - lost of any OS installed before Ubuntu is well documented here: https://help.ubuntu.com/community/Boot-Repair

Here's a screenshot of it:

Tuesday, January 29, 2013

[Ubuntu] Lubuntu or Xubuntu?

I like the Unity environment in Ubuntu 12.10, but it tends to run too slow on my aging Acer Aspire 4720z laptop. So should I go for Xubuntu (XFCE 4.1) or Lubuntu (LXDE), the two famous desktop environment?

I searched online and got a very useful article with a very thoughtful chart for comparison, thanks Arindam Sen for his great article:
http://mylinuxexplore.blogspot.com/2012/10/ubuntu-1210-vs-kubuntu-1210-vs-xubuntu.html

I started with XFCE and very quickly I dropped it off and switch to Lubuntu. Why? The keyboard shortcut doesn't seems to work no matter how many times I have configured and save it. So I gave it up just because of this? YES! To have the keyboard shortcut work probably is very crucial. And there are a few small issues like system crashes (unknown reason), despite not very severe but I want to focus on work rather than solving system problems.

Switching to Lubuntu is very welcoming, and things are pretty good except for the keyboard shortcut setup. It's such a shame that Lubuntu doesn't even have a GUI to configure custom keyboard shortcut. Luckily there are Obkey (which can be found on Google Code), and the brilliant xbindkeys.

To get xbindkeys works straight-away is not as clear cut for first time user. But after a while everything seems to work alright. I would discuss further in my next post on the use of xbindkeys, a possible bug that found by me during the setup, as well as how to setup keyboard shortcuts in Lubuntu without any GUI.

Stay tuned!

Friday, January 25, 2013

How to Fix Multi-boot, Fedora Gone after Install Ubuntu

Updated 30 Jan 2013 11.25pm:
A much more user-friendly method with GUI. Click here to see how.


I was installing multi boot environment on my laptop, it will be consist of:
  1. Windows 7 Pro
  2. Fedora 18
  3. Ubuntu 12.10
Fedora & Ubuntu both use Grub2 to multi boot, installing Fedora after Windows work fine, but once Ubuntu was installed only Windows 7 can be seen from the list, Fedora was gone. How do we fix that inside Ubuntu?

There are various fix on internet which can be concluded below:
  1. update-grub: you might have to install grub first before you able to run this command
  2. grub-customizer: this is very handy GUI to manipulate the Grub. It supports Grub2 and it is real intuitive to add new OS onto the Grub menu list.
  3. manual configuration by typing entries: intermediate/advanced user might appreciate this but definitely not for novice user. There are too many things to learn before one can eventually get it run correctly.
The first two methods are the most straightforward method, but it might not work as expected sometimes. My version of getting this solve is pretty simple, despite it required to work with method no. 3.

* To edit grub.conf user is required to open Nautilus with sudo privilege. Make sure you have run sudo nautilus & in terminal to be able to open and edit the configuration file in text editor.
  1. First thing you have to know where the Grub configuration file is stored. It is located under /boot/grub/grub.conf. Open it with a text editor.
  2. Then you have to know where is your Fedora /boot located. We don't need terminal as we love GUI. Go to Dash Home > Disks.
  3. If you follow Fedora installation guide you can easily identify the /boot, which is 25x MB in size. There are two in my Disks Manager, but the already mounted one is for Ubuntu. So the other one is Fedora for sure.

  4. Mount the Fedora /boot by select the partition and press the play button. 
  5. Open the /boot/grub2/grub.conf with text editor.
  6.  Locate the following and COPY the whole content except for the ###BEGIN....### & ### END....###:
  7.  ### BEGIN /etc/grub.d/10_linux ###  
     menuentry 'Fedora' --class fedora --class gnu-linux --class gnu --class os
    . 
    .
    . *this dots mean there are a lot of content in the middle but being skipped
    . for ease of reading purpose
          }  
     }  
     ### END /etc/grub.d/10_linux ###  
  8. After that, switch to your Ubuntu's grub.conf, and paste into ### BEGIN /etc/grub.d/40_custom ###, see screenshot below:

  9. Save the Ubuntu's grub.conf and reboot.
Voila! My Fedora 18 is now shown on the Grub boot menu.

[Ubuntu] How to disable guest & remote login account in 12.10?

Having the Guest and Remote Login account enabled by default is really not my preference. Personally I think these two accounts should be disabled by default especially privacy is getting more & more important to individual nowadays where most of private files are stored digitally.

I'm not sure why Ubuntu chose to enable them, but if you just hate it like I do, you can disabled them by:

Remove guest account:
sudo /usr/lib/lightdm/lightdm-set-defaults -l false
sudo /usr/lib/lightdm/lightdm-set-defaults --allow-guest false

Remove remote login:
sudo /usr/lib/lightdm/lightdm-set-defaults -R false
sudo /usr/lib/lightdm/lightdm-set-defaults--show-remote-login false

Remove both:
sudo /usr/lib/lightdm/lightdm-set-defaults -l false -R false
sudo /usr/lib/lightdm/lightdm-set-defaults --allow-guest false --show-remote-login false

Do remember to reboot after that.

I have once cannot configure it probably with the full command "--allow-guest" and "--show-remote-login" even without typo error. If you do encounter that, simply use the "-l" and "-R".

Thursday, January 3, 2013

[CentOS] Install OpenERP 6.1 on CentOS 6.3

This article is about how to install OpenERP on my newly installed CentOS 6.3:

Here's an article I found online which provide steps by steps guide:
http://intellectseed.wordpress.com/2012/11/06/how-to-install-openerp-on-centos/

[CentOS, Fedora] Yum for novice user

There are a lot to learn about Yum, for novice user below are a few very useful method to get you started with installation using Yum:

  • # yum install XXXXX
This command is to install a known program. Normally a program would end with "x86_64" for 64-bit CentOS / Fedora.
  • # yum search XXXXX
This is very useful when you know the name of the software, but do not know how the repo name it. Wildcard is not supported here, because no matter what you type, it will treat is a "contain", mean if I search for "fire", I could eventually get "Firefox".
  • # yum list XXXXX
List is similar to search, but wildcard is not enabled by default. So if you wanna search for "Firefox", you have to type "fire*".
  • # yum groupinstall XXXXX
Group install is very useful not only to resolve dependencies, but it also helps by installing other features that require by particular software. For example, Libre Office, by default installation, it would sometimes not appear in the Application Menu. By doing groupinstall all LibreOffice program will be added to the application menu automatically.

* I have not really dig into the groupinstall behaviour, so might explain wrongly here. To be precise, here's how yum.baseurl.org explained:
Despite their differing names both of these commands perform the same function. They will attempt to install/update all of the packages in the group that are of the types 'default' or 'mandatory' (by default). (To change this types of packages edit the value of the group_package_types option in yum.conf.) And they will install any additional dependencies needed by any of the installing/updating packages.

  • # yum update
As the name suggest, this is use to update the system to the latest available patches. Worth to mention here, for those who use Ubuntu / Fedora / CentOS together might get confused a bit, as Ubuntu apt-get update is only to update the repository, but not to perform update to the system. Use apt-get upgrade instead.

I hope this will help many who just start playing around with Yum. Have fun!

[CentOS] Installing CentOS 6.3 Minimal Edition: Part 1

In this post I would list down the steps & tasks I performed after during and after successful installation of CentOS minimal edition.

During Installation
I install CentOS 6.3 in a VM via Oracle VirtualBox. The initial graphic RAM given was 12mb, that has caused CentOS setup fail to boot into a GUI installation. Installing from the old DOS-like environment is headache because somehow it does not show up any available drive for me to select to hold the CentOS.


After a few trials, I decided to re-configured and install in GUI environment. The installation went smooth and very quickly it is done and CentOS is up.

* One thing to take note during the installation is to setup the LAN connection otherwise you would not get connection once boot into CentOS. (Special thanks to Sharuzzaman Ahmat Raslan from Facebook General Linux Discussion M'sia for his advice and screenshot)

To setup the LAN, simply click on the "Configure Network" button on the bottom left.

 


After installation
Once CentOS boot up I'm required to login. Key in root and password (set during installation) then we can start to install everything.

****** This step only required if you forgot to setup LAN during installation ******
Before that I would need to bring up the network interface. I used NAT for the VM. The network interface is not up by default, I did ifconfig and only can see "lo". To bring up the network interface simply type:

# ifup eth0

Run ifconfig to check again and now eth0 has already up and running with DHCP.
****** End of network interface section ******

First thing to do is to perform update to overall system.

# yum update

It is easier and more straight forward to work under GUI than terminal mode. So I decided to install the Gnome Desktop Environment & KDE. The reason I install both because there are some KDE tools & programs are useful to me. Before we can install Gnome/KDE, we must first install the "X Windows System". Yum has an option to do groupinstall. It will help you resolve all dependencies, for novice users this come in very handy. Execute the following:

# yum groupinstall -y 'X Window System'

So what is mean by "-y" in the command line above? It means "answer yes to all", so the system will perform every resolved dependencies without getting further permission from me.

To install Gnome, execute:

# yum groupinstall -y 'Desktop'

* A reminder here: Restart is not required after install "X Window System". If one restarts the system, remember to bring up eth0 again.

Once the installation done, execute:

# startx

I'm now in the Gnome Desktop environment. To make sure it run every time we restart the system, simply go /etc/inittab and change the id:3:initdefault: to id:5:initdefault:.

* To change and save the inittab file, we can use:

# vi innittab

press "Insert" on keyboard to enter editing mode. Once done, press ESC and type ":wq".

Reboot with command init 6 and I can now work in desktop environment.

===============================
There are some issue with minimal edition of CentOS that is it comes with very limited tools we can use to configure the OS. The most critical stuff that are missing is text editor such as gEdit / Kedit / Leafpad. Personally I prefer Leafpad, but to install Leafpad it is not as straight forward.

Some other issue:

  1. the network interface is not configure to load automatically when OS starts
  2. Mozilla Firefox is not pre-install
I will cover in Part 2 how to install those missing stuff as well as configure the network interface so it loads with the system.

Until then, have fun with your newly installed CentOS!

===============================
Some useful links for reference: