Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Monday, November 9, 2015

Problem Updating Repo List in Ubuntu 12.10

The sources list has been changed to old-releases. To replace the sources list easily, use the following command:

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

If you have choose another mirror then your sources list might contain us.archive.ubuntu.com, then the above changes would still be invalid. You would need to remove the us. from it. Using the command below will help remove it:

sudo sed -i -e 's/us.old-releases.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

Wednesday, June 17, 2015

Missing mdadm array after reboot

It is heart-attack when you reboot your linux storage server and realized mdadm array gone missing!
  • RAID volume not showing in gnome-disks.*
  • gparted reports empty partition on all the RAID disks
sudo mdadm --examine --scan -v shows:
mdadm: looking for devices for /dev/md0
mdadm: Cannot assemble mbr metadata on /dev/sda
mdadm: Cannot assemble mbr metadata on /dev/sdb
mdadm: Cannot assemble mbr metadata on /dev/sdc
mdadm: Cannot assemble mbr metadata on /dev/sdd
mdadm: Cannot assemble mbr metadata on /dev/sde
sudo mdadm --examine /dev/sd*  or mdadm --query /dev/sd* shows:
mdadm: No md superblock detected on /dev/sd*
sudo mdadm --assemble /dev/sd[b-f] shows:
mdadm: device /dev/sdb exists but is not an md array.
mdadm: No arrays found in config file or automatically
If you go into /etc/mdadm/mdadm.conf (Debian / Ubuntu) or /etc/mdadm.conf (Fedora), you would realize there is no ARRAY being defined. In some system the mdadm.conf simply does not exist.

No matter how hard you try, the mdadm array just won't show up. There are numerous suggestion on the web, being the most common is to add an auto examine during boot in the mdadm.conf:
 sudo mdadm --examine --scan --config=mdadm.conf >> /etc/mdadm/mdadm.conf
However the above simply does not work for me. I have also try adding the ARRAY manually by doing the following, in which the UUID is the first hdd used for the array (to show the UUID, use blkid. Strange enough I could not get the UUID of my GPT hdd in Ubuntu, and only can get by using Fedora):
ARRAY /dev/md0 metadata=1.2 UUID="0db0c336:f56bd888:2f9e92e4:c1d64c09" >> /etc/mdadm/mdadm.conf
It does not work as well. I have no other solution except try to re-create the array again. Be very careful of this step, I'm more daring to take this step because I already backup my data one day before I lost the array. When you re-create the array, BE SURE to use --assume-clean and make sure the parameter set is EXACTLY the same as what you used to create it the first time. In my case, it is very simple and straightforward:
mdadm --create --assume-clean --level=6 --raid-devices=5 /dev/md0 /dev/sd[b-f]
The RAID array is being created and immediately I got all my data back!! It is advisable to backup your data now and once the backup is done, do a data scrubbing to ensure it is running well.

I hope you will be as lucky as I do, to have all the data back without losing great memory and important works.


External link that I used as reference:


* If it is shown, then you are lucky because it simply changes its name from /dev/md0 to something like /dev/md127. You can still use it by changing the mounting command to the new array name.

Wednesday, January 7, 2015

[Fedora] Fix Yum Update crashed at the middle of updat

If the problem you having is duplicates packages, simply refer to the following info to attempt the fix:

sudo yum check all                # tells you of any problems
sudo package-cleanup --problems   # lists all known package problems
sudo package-cleanup --dupes      # lists duplicate packages
sudo package-cleanup --cleandupes # actually cleans up duplicates
sudo yum check all                # run again to check for remaining problems
sudo yum-complete-transaction --cleanup-only


Thanks to https://destefano.wordpress.com/2013/08/13/yum-update-fail/#comment-2714

Sunday, August 31, 2014

[Alt] key problem when remote desktop Windows via Remmina

If you are using Xfce 4 and encounter the following problems using [Alt] key inside Microsoft Windows remote desktop session:

  • [Alt] key does not work as per expected
  • clicking [Alt] + mouse middle button move you away from your remote desktop session
then you should try this simple and straight forward trick before going too technical.
  • Go Settings > Settings Manager > Window Manager Tweaks > Accessibility > "Key used to grab and move windows" > set it to "None"

Voila! Now it should works like charm. Otherwise... you might have to Google around and read about re-map key, etc.. Good luck!

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:

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.

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

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.

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, 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:

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, 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:

Sunday, December 30, 2012

[Fedora 17] How to disable xscreensaver?

Under LXDE, I have disabled screen saver in KDE System Settings, but why I couldn't get rid of the "xscreensaver"?

It  is because the xscreensaver is not control by the setting in KDE system, but it is control by going to Application Menu > Preference > Screensaver.

Choose Disable Screensaver from the drop down menu. Bingo!