Ubuntu Cannot boot: “No init found. Try passing init=bootarg”

Shutting down after a day’s work, the next day my colleague Madhu had a problem with her system. The system was not able to boot up.

The error

 “error: no init found. Try passing init=bootarg”

mount: mounting /dev/disk/by-uuid/***************************** on /root
failed: Invalid argument
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
Target file system doesn’t have /sbin/init
No init found. Try passing init= bootarg

Busybox v1.13.3 (Ubuntu 1:1.13.3-1ubuntu7) built-in shell (ash)
Enter ‘help’ for a list of built-in commands
(initramfs)
_

Booting into “Recovery Mode” as well as choosing the other kernels listed in grub didn’t help at all.

I had no idea what to do and found the following solution in Google.

Solution 1:

Step 1. Boot from the Ubuntu Live CD;

Step 2. Open/Run Terminal;

Step 3. Type: sudo fdisk -l (to get the device name) then press ENTER;

Disk /dev/sda: 120 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: **********

Device Boot Start End Blocks Id System
/dev/sda1 * 1 30238 242886703+ 83 Linux
/dev/sda2 30239 30401 1309297+ 5 Extended
/dev/sda5 30239 30401 1309266 82 Linux swap / Solaris

Step 4. Type: sudo fsck -y/dev/sda1 then press ENTER;

Step 5. Restart the system and boot normally.

And it was all set.

Solution 2:

Step 1. Boot from the Ubuntu Live CD;

Step 2: system > administration > disk utility.

Step 3: select on your local hard disk and “Click on Mount Volume” to mount it back on the disk.

Step 4. Restart the system and boot normally.

And it was all set.

Issues:

After booting with a live cd I get the same error, here is the entire loading screen’s output:

(process:397): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (0)
Killed
stdin: error 0
unable to open ‘/dev/sda’

You could try booting with other versions of Linux Operating system like Fedora, cent-OS etc.

I tried booting from “Fedora 16” and followed the solution 2 and was back to work soon.

Pls comment if u have any other issues. We could work to find the solution.

CVS Server Installation/Configuration

A Simple CVS Server Install/Configuration In 15 minutes

Introduction :

CVS is a version control system, an important component of Source Configuration Management (SCM). Using it, you can record the history of sources files, and documents. It fills a similar role to the free software RCSPRCS, and Aegis packages.

CVS is a production quality system in wide use around the world, including many free software projects.

 While CVS stores individual file history in the same format as RCS, it offers the following significant advantages over RCS:

  • It can run scripts which you can supply to log CVS operations or enforce site-specific polices.
  • Client/server CVS enables developers scattered by geography or slow modems to function as a single team. The version history is stored on a single central server and the client machines have a copy of all the files that the developers are working on. Therefore, the network between the client and the server must be up to perform CVS operations (such as checkins or updates) but need not be up to edit or manipulate the current versions of the files. Clients can perform all the same operations which are available locally.
  • In cases where several developers or teams want to each maintain their own version of the files, because of geography and/or policy, CVS‘s vendor branches can import a version from another team (even if they don’t use CVS), and then CVS can merge the changes from the vendor branch with the latest files if that is what is desired.
  • Unreserved checkouts, allowing more than one developer to work on the same files at the same time.
  • CVS provides a flexible modules database that provides a symbolic mapping of names to components of a larger software distribution. It applies names to collections of directories and files. A single command can manipulate the entire collection.
  • CVS servers run on most unix variants, and clients for Windows NT/95, OS/2 and VMS are also available. CVS will also operate in what is sometimes called server mode against local repositories on Windows 95/NT.

Installation : 

Step 1: yum install cvs*

Step 2: yum install xinetd

Step 3: Create cvs users & create a group say cvsgroup to which we add all cvs users.

           #groupadd  cvsgroup
           #useradd  –G  cvsgroup  sandy
           #passwd sandy

Step 4: Create a cvs directory say /data with proper permissions and owner ship.

        #mkdir /data
        #chmod ug+rwx /data
        #chgrp  cvsgroup  /data

Step 5: Flag /data directory with SGID bit, so the group permissions will be inherited to files and  folders created under /data directory.

        #chmod  g+s  /data

Step 6: Edit /etc/xinet.d/cvs with the below details

  service cvspserver
{
        disable                = no
        port                     = 2401
        socket_type       = stream
        protocol              = tcp
        wait                      = no
        user                      = root
        group                   =  cvsgroup
        passenv                = PATH
        server                   = /usr/bin/cvs
        env                        = HOME=/data
        server_args             = -f –allow-root=/data/repository1   –allow-root=/data/repository2 pserver }

Step 7: Restart the xinetd service.

         # service xinetd  star

Step 8: Initialize the repositories

        # cvs -d /data/repostory1  init

        # cvs -d /data/repostory2  init

Step 9:  Normal Linux users on CVS Server can now be able to login to CVS server using username/password depending on which Client tool you prefer.

Refererence:  The Below Links For More Details

http://www.nongnu.org/cvs/

http://en.wikipedia.org/wiki/Concurrent_Versions_System

Samba file Server Installation and configuration on Centos 6.2

Samba file Server

Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server.

From http://www.samba.org

Prerequisites

1. Disable Selinux

Selinux can be disabled temporarily or permanently

a. Temporarily

# setenforce 0

b. Permanently

Edit /etc/sysconfig/selinux and set SELINUX entry to disabled

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing – SELinux security policy is enforced.

#     permissive – SELinux prints warnings instead of enforcing.

#     disabled – No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted – Targeted processes are protected,

#     mls – Multi Level Security protection.

SELINUXTYPE=targeted

         This needs a server restart to take effect.

2. Disable or add rules to iptables

a. Disable iptables ( Not Recommended)

#service iptables stop

#chkconfig –level 345 iptables off {disable iptable service on server startup}

b. Add rules to allow samba ports for communication.

#  iptables -A INPUT i eth0 -p tcp -m multiport –dports 137,138,139,445 -m state –state NEW,ESTABLISHED -j ACCEPT

# service iptables save

 Installation

1. Yum install samba samba-client samba-common cups-libs.

This will install samba server and dependencies.

2. After Installation a default file configuration file will be created on /etc/samba/smb.conf.

3. Star the service and flag it for automatic restart on sever reboot.

#service smb start

#chkconfig  – -level 35 smb on

4. Now backup your original smb.conf file and we will discuss some simple to complex share definitions.

Smb.conf file is main configuration file of samba file server. The file is organised as sections & Parameters. Some default sections on a samba configuration files are

[global]

The parameters defined in global section apply to the whole server.

[homes]

The parameters defined on this section are useful for samba users connecting to their home share.

[printers]

For printers specific parameters

Now we can have look at few smb.conf files for different purposes

1. A sample smb.conf file for file sharing without username/password

a. Edit /etc/samba/smb.conf with below details(Customise according to your environment)

[global]
          workgroup = MYGROUP
server string = Samba Server Version %v
        log file = /var/log/samba/log.%m
        max log size = 50
        dns proxy = No
        cups options = raw
        security = share
        guest account = nobody
 
[homes]
        comment = Home Directories
        read only = No
        browseable = No
 [shared]
        comment = Shared Stuff
        path = /shared/
        read only = No
        guest ok = Yes

b. Create a directory shared with proper permissions.

#mkdir /shared; chmod ugo=rwx /shared

c. Use testparm command to test the configuration file. And restart the service.

d. Now you will be able to access the share from windows.

2. A fully fledged samba share server with recycle bin capabilities.

    • Samba share(public) accessible to configured users & secured using username/password
      • Create a Linux user name say user1 & add to samba users.
      • Create folder say /public which will be shared by the users.
      • Flag it with appropriate permissions so anyone with access to the share has read/write permissions.

      • Edit smb.conf with the following details

[global]

workgroup = MYGROUP

server string = Samba Server Version %v

log file = /var/log/samba/log.%m

max log size = 1000

dns proxy = No

cups options = raw

security = user

passdb backend = tdbsam

[publicshare]

comment = Public Shared stuff With username/pasword

path = /public

public = yes

writable = yes

directory mask = 0777

Smb.conf explanation

Log_file           == will create a log file under /var/log/samba/log.pcnameaccessing

max log size    ==This option (an integer in kilobytes) specifies the max size the log file should grow to. Samba periodically checks the size and if it is exceeded it will rename the file, adding a .old extension,A size of 0 means no limit.

security & passdb backend  == Backend to store user information in. New installations should use either tdbsam or ldapsam. smbpasswd is available for backwards compatibility. tdbsam requires no further configuration.

directory mask== enable to create a directory inside another user created directory(fully writable)

    • Access for the share from windows using username/password created above.

    • Samba share (sales) accessible to a group of users.
      • Create Linux users say sales1 & sales 2, create a group called sales and add the above users to the group sales. Add the users to samba
      • Make directory /sales with proper permissions and ownership (flag it with SGID bit so group of the parent directory will be inherited to files created in sales directory.

      • Edit smb.conf with the following details

[sales]

comment = Sales Shared Stuff

path = /sales

public = yes

writable = yes

write list = +sales

create mask = 0774

directory mask = 0775

Smb.conf explanation

write list == This is a list of users that are given read-write access to a service. If the connecting user is in this list then they will be given write access, no matter what the read only option is set to. The list can include group names using the +group syntax.(In older Samba version syntax was @groupname)

  • Access for the share from windows using username/password created above.

Sales1

  • SGID permission inherited from Parent directory & directory mask variable in action.

  • Samba home share for each user.

Edit smb.conf with the following details

[homes]

comment = Home Directories

read only = No

browseable = No

  • Access for the home share from windows using username/password .

  • Recycle bin capabilities on public share.

Recycle bin is a nice feature in samba, which helps to retrieve user deleted files very easily. By configuring this option the deleted files are actually moved rather than deleted to a directory specified at smb.conf.

    • Make a directory say sambadeleted and flag with proper permission.
    • Edit smb.conf file with following details.

[publicshare]

comment = Public Shared stuff With username/pasword

path = /public

public = yes

writable = yes

directory mask = 0777

#######Enabling Recycle Bin on samba

vfs object = recycle

recycle:repository = /sambadeleted/%U

recycle:versions = Yes

recycle:keeptree = Yes

recycle:touch = Yes

recycle:maxsize = 0

recycle:exclude = *.tmp

recycle:exclude_dir = /tmp

Smb.conf explanation

recycle:keeptree==preserve directory structure.

recycle:touch== Specifies whether a file’s access date should be updated when the file is moved to the repository.

recycle:maxsize== This option (an integer in kilobytes) specifies the max size the recycled file,A size of 0 means no limit

recycle:repository== . sambadeleted /%U

This specifies where the deleted files will be stored. Therefore anything that is deleted is moved to the directory /sambadeleted. The %U variable is the username of the person currently browsing the share. So for every user that deletes a file there is a directory with their username containing all the files they have deleted.

Refer the link for more details: http://www.samba.org/samba/docs/man/manpages-3/vfs_recycle.8.html

For example:

  • Map the publicshare using lib and sandy as username and create folders createdbylib & createdbysandy respectively. Drop some files in the folders.

  • Delete the folders from the shares(lib can delete folder created by sandy & sandy  can delete folder created by lib)
  • Now check the /sambadeleted directory from server to verify recycle bin functionality

Note : /sambadeleted directory should be created prior and should have proper write permissions for all users

  • The screen shot shows the files in public share and in folders (createdbylib & createdbysandy).
  • Lists the sambadeleted directory which is empty. Then we delete the directories using lib and sandy mapped shares.
  • Lists samabadeleted folder once again. Now we can see the files deleted by users are moved to the recycle folder under the username directory.

Complete smb.conf file

Samba Swat

Samba swat allows a Samba administrator to configure the complex smb.conf file via a Web browser. Samba swat is a xinetd service which is relatively simple to configure.

Prerequisites

    1. Allow swat default port 901 through IPTABLES

# iptables -A INPUT -p tcp –dport  901 -j ACCEPT

Installation & Configuration

    1. Install samba-swat and xinetd rpms.

# yum install samba-swat xinetd

2. Edit /etc/xinetd.d/swat with following details

service swat
{
port            = 901
socket_type     = stream
wait            = no
only_from       = 127.0.0.1 10.0.0.0/24 192.168.10.0/24 ##the networks from you need to access swat page
user            = root
server          = /usr/sbin/swat
log_on_failure  += USERID
disable         = no
}

3. Star the service and flag it for automatic restart on sever reboot.

# service xinetd start

#chkconfig –add 35 xinetd

4. Point the browser to IP address or FQDN of samba server at port 901 and provide servers username/password as credentials.

Samba useful Information’s.

Refer to

  1.  http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-samba-daemons.html
  2. http://www.linuxmanpages.com/man7/samba.7.php

James Mail server

James (Java Apache Mail Enterprise Server) is a 100 % Java based Mail server running on Java 1.5 or later versions.

Author: Libu Das

More Details about Apache James can be found at  http://james.apache.org/server/

Apache James latest version can be downloaded from http://james.apache.org/download.cgi

Installation on Windows

STEP 1: Download the latest version of james and unzip it

Eg: C:\ apache-james-2.3.2.zip

STEP 2: Start James by launching  C:\ apache-james-2.3.2\bin\run.bat

STEP 3: Configure Remote administrator account and server names on C:\james-2.3.2\apps\james\SAR-INF\config.xml

3.1 Add the IP/named address for the server to the

<servernames> tag.

3.2 Change the username and password in the

<administrator_account> tag (root/changeme)

STEP 4: James as Windows service

4.1 From command line goto C:\james-2.3.2\bin and issue the command

Wrapper.exe -i ..\conf\wrapper.conf

4.2 Now you will be able to Control james mail server through service

4.3  To Remove the service

Wrapper.exe -r ..\conf\wrapper.conf

Installation on Linux (Centos 6.3)

STEP 1: Download the latest version of james and unzip it

Eg: unzip apache-james-2.3.2.zip

STEP 2: Goto /james-2.3.2/bin and run run.sh

2.1 chmod u+x  *.sh (flag scripts executable)

2.2  ./run.sh

Step 3: Shut down james and make necessary changes on  /james-2.3.2/apps/james/SAR-INF/config.xml

3.1 Add the IP/named address for the server to the

<servernames> tag.

3.2 Change the username and password in the

<administrator_account> tag (root/changeme)

STEP 4: James as Linux service

4.1 Add the following lines on bin/phoenix.sh

#chkconfig: 2345 80 05

#description: James Mail Server

4.2 Create a link name on /etc/init.d

Ln –s /james-2.3.2/bin/phoenix.sh james

4.3 Chkconfig  –add james

4.4 Chkconfig –level  3 james on (make james automatically start on runlevel  3)

 

Remote Administration

Remote Administration port of james mail server is 4555, Below is some basic administration examples

Checking Mail Function

James SMTP server can be accessed on port 25

Issues and Solutions

1)      James Refuses to start up

Possible solution

a)      Check  any other service like sendmail, postfix are using port 25, if so stop the service

b)      Check for JAVA_HOME  Variable, If not add it in Phoenix.sh or User profile

c)       requested action not taken relaying denied james

add the domain name to servername tag on james-2.3.2/apps/james/SAR-INF/config.xml

d)      On windows if service doesn’t start-up check for IIS service running

Ubuntu Web Server from scratch, free web hosting (LAMP, FTP, Webmin, PHPMyAdmin, SSH)

This tutorial is about installing Web server on Ubuntu server 12.04 on a Virtual machine.

Getting and installing Ubuntu 12.04 Server (would be a command line):

Step 1: Go to http://www.ubuntu.com/download

Step 2: Download Server 12.04 LTS (32 bit or 64 bit)

Step 3: Install this on Virtual box or VMware.  (See how to install OS image as Virtual Machine)

Browse to the location where you have saved your ios image. Then click NEXT.

Step 4: Go to virtual machine Network setting and choose BRIDGE ADAPTER to have internet access.

Start the virtual machine and choose the needed settings for your Ubuntu server.

Language and Keyboard settings. Give in Hostname, Password and other details.

Step 5:   Choose the needed server configuration to be configured when installing the server.

Give in the MYSQL root user password,  and then continue.

Once the installation is complete the machine will reboot.

LAMP stands for Linux, Apache, MySql and PHP. Linux is the operating system, Apache is the webserver , MySql  holds the database system and PHP has lots of nice features for writing codes that can change the execute of  server like login forms etc.

Once the Server is booted up it would prompt for user name and password.

A detailed step by step installation of Ubuntu server can be found in the below link (for starters)

http://www.ubuntugeek.com/step-by-step-ubuntu-12-04-precise-lamp-server-setup.html

 Test the Ubuntu LAMP server:

Open up the browser of a local machine and type in the IP address of the machine.

Testing Open SSH Server:

This can be accessed with the help of an application called “Putty”

(Download it from : http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html )

Give in you server IP address and the hit Open.

You can hit enter notifying that you trust the connection.

Now we are in SSH at port 22.

Installing WEBMIN:

WEBMIN allows in accessing our server remotely and it gives us a GUI interface to effectively interact with the server.

Step 1: Installing additional packages.

sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python

 Step 2: You need to download webmin deb package using the following command

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.580_all.deb

Step 3: Install downloaded package using the following command

sudo dpkg -i webmin_1.580_all.deb

 

This will install webmin now you need to access https://ubuntu-serverip:10000

Ubuntu in particular don’t allow logins by the root user by default. However, the user created at system installation time can use sudo to switch to root. Webmin will allow any user who has this sudo capability to login with full root privileges.

Once you logged in you should see similar to the following screen

The File manager feature helps in access the file structure of the hard drive.

Example:

In the folder       /var /www/ index.html

You can edit the file with edit button on the top.

The webmin enables us to effectively control the server with GUI interface.

Install PHPMYADMIN:

PHPmyadmin: Thishelps us to control the MySql database with a GUI interface.

Step 1:

sudo apt-get install phpmyadmin

Hit OK to continue.

Step 2:  Acces phpmyadmin

Now you need to access 192.168.0.108/phpmyadmin

Enter username and password.

Installing proFTPD using webmin:

On the webmin control panel ,

You need to choose the Un-used Modules à ProFTPD module

Click on the link ro install proFTPD

The above is the ProFTPD server interface, Click on the Default server link to  mak it a default FTP server

Thus the FTP server is setup and we can login to it. We can use FileZilla FTP client to login to the server.

This is how we configure a Ububtu 12.04 server for web service.

Follow

Get every new post delivered to your Inbox.

Join 306 other followers