Linux.com

Community Blogs



Recognize the Linux.com Featured Members

As with most help sites we here are Linux.com are working to build a knowledgeable active community of Linux enthusiasts and Technical Professionals alike, not only to assist others but to also showcase their skills to inspire others and advance their individual careers.

This site has a cool feature that allows us to choose members who's original contributions and many question responses have added value to the Linux and FOSS community. The list of featured members can be viewed by going to http://www.linux.com/community and clicking the "Featured Members" link at the top of the Members section.

The Featured members are not chosen by the quantity of contributions or guru points earned, but by the overall quality of their responses and contributions to the site. All featured members have shown the willingness to take ownership of new inquiries and work their best to assist the requesters until their questions are answered.

Please join me in thanking them for their efforts and time they volunteered to assist others.

 

 

grub restore

ok here goes i installed Ubuntu on my laptop i'm not sure if someone was messing with it or i did something wrong but anyway when i boot up all i get is grub restore what would i type in to get the os to load? i'm new to the site so i'd appreciate if you could e-mail with some help.....( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ) thanks

 

ext4 file recovery with giis-ext4

Introduction
giis-ext4 is designed to protect certain important directories/files on linux systems that are using the ext4 filesystem.
The binary installation of giis-ext4 has only one dependency. That is : sqlite3, which should be available by default on most linux machines.
Installation
Installation of giis-ext4 will need root privileges. You should follow these
steps for both binary and source installation.
Download the latest tar file into your home directory
    wget http://www.giis.co.in/giis/giis-ext4_0.6.tar
Extract the tar file into your home directory, which will create  a new
directory called giis-ext4
    tar -xvf giis-ext4_0.6.tar
Change to the newly created directory
    cd giis-ext4
Now, To install giis-ext4 binary, run the following commands as root-
    sh install_giis_ext4.sh
This script will place the binary in /usr/bin and create the /usr/local/giis/
working directory structure and files.
    
giis-ext4 configuration
Once you have succuessfully installed giis-ext4 from either the binary or source
code, you need to configure it.
Run the following command as root to configure which directories to protect, how
many levels of directory and how often to look for changes.
Lets start the configuration by running
#giis-ext4 --install
Device Found : /dev/mapper/vg_space-lv_root
 giis : Taking snapshot of current File system
 giis-ext4:Installation begins..
 giis-ext4: header table created
 giis-ext4: file table created
 What's the maximum directory depth?4

I want to protect four levels of directory depth like (dir1/subdir1/subdir2/subdir3) so enter "4"
Now it prompts for which directories to protect.
 Enter the dirname name,that you would like to protect(Max. 7 directories)
 Enter dirname:/tools
 Press 1 to add/protect another directory else Press 0 to complete: 1
 Enter dirname:/docs
 Press 1 to add/protect another directory else Press 0 to complete: 0

I want to protect files from two directories namely "tools" and "docs" and entered zero "0" to specify
end of directory.
Check for newly files every 'auto update time' minutes.
Enter auto update time: 20

Here I specified that every 20 minutes the tool should scan "tools" and "docs" directory for any new files or change in exising files.
If it finds new file or changes to existing files , keep track of it.

 Parsing directory  : /tools
 Parsing directory  : /docs
 *Please add following entry into your /etc/crontab file for auto update
 */20 * * * * root /usr/bin/giis-ext4 -u > /dev/null
 giis-ext4:Installation is complete.

Now append the corntab entry as suggested above,so that it runs for every  20 minutes.
Here is contents on tools directory
# ls -l /tools/
total 120
-rwxr-xr-x. 1 root root 60247 2011-03-17 22:56 cloud-seed.py
-rwxr-xr-x. 1 root root   335 2011-03-17 22:56 dbench_test.sh
-rwxr-xr-x. 1 root root   217 2011-03-17 22:56 iozone_test.sh
-rwxr-xr-x. 1 root root  5644 2011-03-17 22:56 kernel_compile.sh
#ls -l /docs/
-rw-r--r--. 1 root root  461 2011-03-17 22:57 bonnie++.txt
-rw-r--r--. 1 root root   66 2011-03-17 22:57 cpio.txt
-rw-r--r--. 1 root root  199 2011-03-17 22:57 dbench.txt
-rw-r--r--. 1 root root  340 2011-03-17 22:57 small_files.txt

For example here is md5sum of a file-
# md5sum /docs/small_files.txt
0669d98fe55c5e76f8c1841c9f08bf7f  /docs/small_files.txt

Say by mistake , I deleted a file named "small_files.txt"
#rm -rf /docs/small_files.txt
Now the file is gone. Its inode is freed.
Suddenly I realize , in fact small_files.txt was input for another shell script.
Now what would you do?
Relax,since you have configured giis-ext4 for this directory. You may still have chance to recover the file.
Recovering files
# giis-ext4 --recover
 Device Found : /dev/mapper/vg_space-lv_root
 press 1: get all user files
 press 2: get specific user files
 press 3: get specific file type
 press 4: get specific file
 press 5: get it by deleted date
 Enter your option:4

Since we know the exact file name that we wanted to recover - I selected option 4 and entered the file na,e
 Enter the Filename Name....small_files.txt
 Verifing inode:8126486|
 **giis-ext4 : Recovery completed.Please check /usr/local/giis/giis.log for more details and /usr/local/giis/got_it/ for files **

Lets check the log file-
# cat /usr/local/giis/giis.log
/docs/small_files.txt -- recovered on -- Thu Mar 17 23:22:37 2011

good.It says file "small_files.txt" recorded and placed under /docs directory.
Is it true-
# ls -l /docs/small_files.txt
-rw-r--r--. 1 root root 340 2011-03-17 23:29 /docs/small_files.txt

 

 


Yes,seems like the recovered file with same size.
But does it contains same data? Lets verify with md5sum-


# md5sum /docs/small_files.txt
0669d98fe55c5e76f8c1841c9f08bf7f  /docs/small_files.txt

cool.Seems like perfect match.
Other interesting recovery options -
 press 1: get all user files
 press 2: get specific user files
 press 3: get specific file type
 press 4: get specific file
 press 5: get it by deleted date

We have seen how option 4 works.The option 1,just recovers all possible files which are deleted from configured directories.
Option 2 ,will allow to recover files based on its owner.If you want to recover files belong to "Elija".Simply enter the name with option2.
Enter your option:2
 Enter the User Name....Elija

With option 3,you can recover particular type of files. Say you want to recover only pdf  files.
Enter your option:3
 Make sure you use % before extentions - sql injection :)
 Enter the file extention  ( %.txt or  %.c or %.cpp ...) :%.pdf

Option 5,It allows you to recover files based on delete dates!.You can recover all files deleted on specific date or within two date ranges or
recover all files deleted after/before a date.
 press 5: get it by deleted date
 Enter your option:5
Get Files by Deleted Date:
    Press 0 : Deleted on
    Press 1 : Deleted After
    Press 2 : Deleted Before
    Press 3 : Deleted Between

Override auto-update time-
While installing,we configured the update time as 20 minutes.
For example, I created an important file -wants to make its protected by giis-ext4,
I'm impatient and can't wait till 20 minutes.You can add it like-
# giis-ext4 --update
 Device Found : /dev/mapper/vg_space-lv_root
 giis : Updating snapshot of current File system
 Parsing directory  : /tools
inode<7602199>Record already exists
 Parsing directory  : /docs
 giis-ext4:Update is complete.

Now the newly created file is added into giistable.
Viewing list of deleted files with "--list"
Say we deleted couple of files-
# rm -rf /docs/ffsb.txt
#rm -rf /tools/iozone_test.sh
# giis-ext4 --list
 Device Found : /dev/mapper/vg_space-lv_root
 Verifing inode:
File:iozone_test.sh was deleted from /tools/iozone_test.sh.
File:ffsb.txt was deleted from /docs/ffsb.txt.

giis-ext4 recognizes the two files are missing from its inventory.

Th-th-th-that's all folks!  :)

 

Enabling Slackware 13.1 to Boot to the X Login Screen by Default

I did some playing around with slackware to get a better understanding of how linux functions behind the curtains. To be honest, there's a little frustrations of not choosing slackware as the first linux distro to use. Better late than never.

Understanding linux, can be tricky when every function, component, device is in the form of a script, file or something of that nature. Meaning, most of the time, you are trying to understand code. Like a friend has told me, "think it is easy until you've proven it to be difficult".

On that note, I wanted slackware, instead of booting to the terminal (which it does by default), to boot to the gui UI.  To accomplish this, you need to change a few things in a script file. What script file?

In linux, scripts called "runlevels" determine how a linux system should act when it boots, either, in multi-user mode, single user mode, terminal(default) or the X11 mode. They are numbered in a format like rcO.d, rc1.d all the way to rc6.d.  If you used other distros like ubuntu, fedora and opensuse, you will notice they all boot to a X11 login screen, which basically mean, it is using a runlevel that tells the system to boot in X11. All we need to do is find that runlevel. The run level to boot any linux distro to X11 is called rc4.d.

In slackware, all runlevels, and initialization scripts are stored in a directory called rc.d located in etc/rc.d. In that directory, you will see the runlevel script that boots slackware into the X11 mode. Now, you don't change the runlevel rc4.d located in rc.d directly. In stead you will have to find a script file named inittab that slackware reads to find the scripts used to initialize itself. Sounds confusing, it did to me.

What you need to do, is open inittab in your favorite text editor as root and change one line in the file. When  you open the file you will see a bullet list of default runlevels with a heading named "These are the default runlevels in slackware". At the very bottom of the list are the runlevels and initiation script slackware will use to boot.

The first line of code under the list is the "default run level, do not set to 0 or 6". The code line is separated with semicolons: "id:3:initdefault". The number 3 represents the runlevel slackware will use. You are going to change that number to 4 and save the file. It is always good to make a backup copy of the file before you do any changes. Or, like I like to do it, do all your testings on a beta machine or in a virtual machine. When you are done, reboot the system. In a few seconds your system will boot to an X11 login screen. Remenber, exploring and breaking means learning. 

 

What are the original WWF tips on paper efficiency?

The embarassing saga of the "green" .WWF file format that ignores Linux and is ignored by the WWF itself continues...

 

Creating a Debian Live USB Flash Drive with Persistence for Non-Techies

This tutorial aims at showing a fast, straightforward way of creating a  USB flash drive with Debian live installed (on it) using the persistence feature. It means that you can automatically save changes back to the USB flash drive before shutting your machine down.There are many more options not covered in this article which are explained in detail in Debian-live's manual. You can find it here.
Read more... Comment (11)
 

Is E-Voting a solution? To which problem?

"promoting e-voting just because it can be done with Free Software continues to not make sense. If the software running the system were open it would still not solve any of the problems listed above, or give citizens any meaningful advantage. In the real world, having the source code of a voting machine would change nothing at all at the voting booth"

Continues here.

 

Wanted: little known examples for Digital Citizens Basics course

next month I'll start with a Digital Citizens Basics online course, open to everybody, which will also introduce FOSS. I already have LOTS of examples for all the topics of the course, but surely I have missed, or will miss in the future, something that may be worthwhile to discuss with my students.

If you know of specific and little-known examples of the problems covered in the course program, thanks in advance if you'll want to send me relevant links, either in comments to this post or by email at This e-mail address is being protected from spambots. You need JavaScript enabled to view it . Thanks!

 

How to create lists of WordPress posts from the command line

WordPress is a great online publishing system. One of its strengths, as far as I am concerned, is the administration interface, which I find flexible, efficient and easy to use. However, sometimes even that interface isn’t flexible enough. Recently, for example, I needed a quick way to create and insert into another Web page an HTML list of all and only the posts I had published in a certain date range. If you only have four of five posts to manage it’s OK, but what when, as in my case, there are many tenths of them?

 

Here's how I do it.

 

I'm Part of That 3%, I Must Confess

I ran across an entertaining little bit while surfing around the Tech News Daily site this morning. It reminded me of a humorous computer story of my own.

Most of my online tech pals know what I'm talking about when I mention the night the Slacker danced the Irish jig. I'm not much of a dancer, but this one night I danced up a storm on my kitchen floor... on top of my computer tower. Heh!

Yeah... it was a sight to see; a 265 lbs, 6'2" man stomping maniacally on his computer tower that he had just recently scooped off the desk and slammed to the ground... along with all the hardwired peripherals and knick-knacks.

So yeah... I'm in that 3% group who have totally lost their cool and let an inanimate bunch of plastic, silicon, and metal get the best of me.

About nine percent of people have taken their frustrations out on the computer by hitting it with an object, such as a baseball bat or a fist. Only three percent have actually thrown a computer to the ground or against a piece of furniture, such as a desk.*

"What ever could have brought this about?" you might ask. If you can seriously ask that question, you've never used a computer before in your entire life. Here's what happened, though... I had been having some buggy issues with an installation of Linux. I kept losing my configuration preferences and such.

It was really beginning to torque me up. It had been going on for about two weeks. It came to a head one evening shortly after another crash of a fresh installation. That's when the dance party started. WOO-HOO! Everybody dance now! THUMP! THUMP! THUMP!

After a reassembly into another tower box and some more calm-minded troubleshooting, I tracked the issue to an intermittently failing Seagate hard drive that I had just recently bought and installed on this system. That was the very first... and the VERY LAST Seagate drive I even owned/used. I've mellowed over the years, though. I don't blame Seagate anymore for my near-stroke. I'd buy one nowadays... if the price was right.

But not everyone reacts this way when faced with a computer issue. On the other end of the spectrum, about 38 percent of people said they would never yell at their computer because it's "too sensitive." Instead, they encourage it to keep working with positive words.*

*From the above mentioned article.

If you're one of the above mentioned 38%, you really should seek some professional help. :crazy

Later...

~Eric

> A republish from my Nocturnal Slacker blog @ LockerGnome.com

 

 

 

ctags utility - to edit/see source files in vi/vim

Dear All,

Gonna tell you about the ctags utility and how to use it in your project.
I am taking the example on Ubuntu 10.10 for C++ project

Step 1. Install ctags tool via Synaptic Manager

Step 2. To know which languages does ctags support fire the below command
ctags --list-languages --list-type
it will give you the whole list of languages for whcih cross refernce for variables, subroutines/functions etc. available use it accordingly vi/vim supports everything.

step 3. In the source directory where your Definition/Declaration files are present:

run the following command
ctags *.cpp *.h or ctags -R ( it wil recursivley generate the tag file)
you can name your own tag file  with the option -f or -o otherwise default tag file named tags would be generated.

step 4. now open any  source file  in vi / vim editor and  go to the Ex. mode(:)
type the command 'tag functionname' (the name of the function whose definition you want to look for) short form ( : ta functionname) right after this command you will be taken to the file containing the definition of the functionname there you can make the changes or go thru the definition save it (:w) or use :set autowrite feature . type : ctrl+ l or ctrl +o to come back to the original file.

for more info read man ctags:
please comment / suggest cheers!!!!!!!!!!!11enjoy:)))))))))))

 
Page 9 of 116

Upcoming Training Courses

  1. LF331 Developing Linux Device Drivers
    03 Jun » 07 Jun - Virtual
    Details
  2. LF411 Embedded Linux Development
    24 Jun » 28 Jun - Silicon Valley
    Details
  3. LF422 High Availability Linux Architecture
    15 Jul » 18 Jul - New York
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board