Linux tips & techniques for developers and system administrators.
There is a problem with Ubuntu and other distributions when you set up a system with a RAID-1 setup. The installer only installs Grub to the first drive. If the first drive fails, then even if all your data is on the second drive you won’t be able to boot from it.
The following script fixes this problem by installing Grub to both drives. Just paste it into a file, save it, make it executable and run it.
This script only works for Grub, not Grub-2
The only thing you may need to change is HDDEV, it needs to be the first two letters of the device name. It is usually either “sd” or “hd”
echo “device (hd0) /dev/”$HDDEV”a” >$f
echo “root (hd0,0)” >>$f
echo “setup (hd0)” >>$f
echo “device (hd0) /dev/”$HDDEV”b” >>$f
echo “root (hd0,0)” >>$f
echo “setup (hd0)” >>$f
echo “quit” >>$f
grub –no-floppy <$f
Ubuntu OpenVPN Boot Fix (2.2 KiB, 486 hits)
OpenVPN is a free, open-source, enterprise-level VPN. It runs on most if not all Linux systems as well as Windows.
On Linux, if an NFS filesystem is auto-mounted over the VPN, a race condition can occur where the system will try to mount all the auto-mount filesystems BEFORE OpenVPN is started.
Similarly, at shutdown, OpenVPN is normally shut down before the filesystems are unmounted. This will cause an indefinite hang when the system then tries to unmount the NFS filesystems which are mounted over the VPN.
The attached scripts are designed to fix these problems. These scripts have been tested on Ubuntu 8.04, but should work on most if not all Debian systems. Minor modifications will need to be made for RedHat/CentOS systems.
This script fixes several problems with the OpenVPN setup.
1. The boot problems occur because of the order in which services are started. OpenVPN is installed as a normal service, which means that the networking is
started, and then the system tries to mount the networked filesystems before OpenVPN is started. Since the filesystems are only available via OpenVPN,
problems are created.
These changes do the following:
- Start OpenVPN immediately after the networking is started, as a high priority system service. This is done by putting the OpenVPN script into the rcS.d directory instead of the normal rc[0-6].d directories.
- The startup script “openvpn-wait4active” will wait until tun0 and tap0 are started. Once they are started, it will again attempt to mount all filesytems. The openvpn-wait4active mounts each entry in /etc/fstab which is marked as a networked filesystem. This ensures that all the networked filesystems are properly mounted. Then the boot sequence is allowed to proceed.
- The shutdown/reboot problems occur because the shutdown/reboot sequence turns off the networking BEFORE the filesystems are unmounted. This causes a hang when the samba client tries to unmount the filesystem. Since the samba client cannot access the network, it causes CIFS errors. The solution is to unmount the networked filesystems before the network is shut off. This is performed by the shutdown script “openvpn-unmount”, which finds and unmounts all NFS and CIFS filesystems.
- The fstab has had the following modifications:
a. dmask has been changed to dir_mode, since dmask is depreciated
b. fmask has been changed to file_mode, since fmask is depreciated
Ubuntu OpenVPN Boot Fix (2.2 KiB, 486 hits)
I recently ordered an F-35 Lightning II from Hobby-Lobby. I ordered this model because of the big wing area and the vectored thrust, which will (among other things) enable the plane to slow down a lot for landing.
I expect the plane in a week or so, once I have it I’ll post some pics of it unassembled, assembled, and hopefully flying.
Here is a picture and a video put on YouTube by Hobby-Lobby:
One of the goals of a good system administrator is being able to respond to problems before they affect operations. To this end we use various monitoring tools. Over time I have successfully used the following:
“mon” is a tool for monitoring the availability of services, and sending alerts on prescribed events. Services are defined as anything tested by a “monitor” program, which can be something as simple as pinging a system, or as complex as analyzing the results of an application-level transaction. Alerts are actions such as sending emails, making submissions to ticketing systems, or triggering resource fail-over in a high-availability cluster.
Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.
Zabbix offers advanced monitoring, alerting and visualisation features today which are missing in other monitoring systems, even some of the best commercial ones.
Cacti is a complete network graphing solution designed to harness the power of RRDTool‘s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
Munin is a networked resource monitoring tool that can help analyze resource trends and “what just happened to kill our performance?” problems. It is designed to be very plug and play. A default installation provides a lot of graphs with almost no work.
OpenNMS is an award winning network management application platform with a long track record of providing solutions for enterprises and carriers.
Of these, I have used Mon, Nagios, and Zabbix more than any of the others. Zabbix is, for me, the newest one, and I am currently migrating from a Nagios-based solution to a Zabbix solution.
A short comparision of these three tools (this table is excerpted from Wikapedia):
|Name||IP SLA Reports||Logical Grouping||Trending||Trend Prediction||Auto Discovery||Agent||SNMP||Syslog||Plugins||Triggers / Alerts||WebApp||Distributed Monitoring||Inventory||Data Storage Method||License||Maps||Access Control>||IPv6|
|Cacti||Yes||Yes||Yes||Yes||Via plugin||No||Yes||Yes||Yes||Yes||Full Control||Yes||Yes||RRDtool, MySQL||GPL||Plugin||Yes||Yes|
|Nagios||Via plugin||Yes||Yes||No||Via plugin||Supported||Via plugin||Via plugin||Yes||Yes||Full Control||Yes||Via plugin||Flat file, SQL||GPL||Yes||Yes||Yes|
|OpenNMS||Yes||Yes||Yes||Unknown||Yes||Supported||Yes||Yes||Yes||Yes||Full Control||Yes||Limited||JRobin, PostgreSQL ||GPL||Yes||Yes||Limited|
MySQL, PostgreSQL, SQLiteGPLYesYesYesNameIP SLA ReportsLogical GroupingTrendingTrend PredictionAuto DiscoveryAgentSNMPSyslogPluginsTriggers / AlertsWebAppDistributed MonitoringInventoryData Storage MethodLicenseMapsAccess ControlIPv6
- Product Name
- The name of the software, linked to its Wikipedia article. Any
software listed without being linked to its article, demonstrating its
notability, will be removed.
- IP SLAs Reports
- Feature reports on IP
- Logical Grouping
- Support arranging the hosts or devices it monitors into
- Provide trending of network data over time
- Trend Prediction
- The software feature algorithms designed to predict future
- Auto Discovery
- The software automatically discover hosts or network devices it
is connected to
- The product rely on a software agent that must run on hosts it is
monitoring, so that data can be pushed back to a central server.
“Supported” means that an agent may be used, but is not mandatory. An SNMP daemon does not
count as an agent.
- Able to retrieve and report on SNMP statistics
- Able to receive and report on Syslogs
- Architecture of the software based on a number of ‘plugins’ that
provide additional functionality
- Capable of detecting threshold violations in network data, and
alerting the administrator in some form.
- Runs as a web-based application
- No: There is no web-based frontend for this software.
- Viewing: Network data can be viewed in a graphical web-based
- Acknowledging: Users can interact with the software through
the web-based frontend to acknowledge alarms or manipulate other
- Reporting: Specific reports on network data can be configured
by the user and executed through the web-based frontend.
- Full Control: ALL aspects of the product can be controlled
through the web-based frontend, including low-level maintenance tasks
such as software configuration and upgrades.
- Distributed Monitoring
- Able to leverage more than one server to distribute the load of
- Keeps a record of hardware and/or software inventory for the
hosts and devices it monitors
- Data Storage Method
- Method used to store the network data it monitors.
- License released under (e.g. GPL, BSD_license, etc.)
- Features graphical network maps that represent the hosts and
devices it monitors, and the links between them.
- Access Control
- Features user-level security, allowing an administrator to
prevent access to certain parts of the product on a per-user or
- Supports monitoring IPv6
hosts and/or devices, receiving IPv6 data, and running on an
The site seemed to have a number of good tools, so I did some digging at the Internet Archive and was able to recover the site pages and code. If you have need for graphing, vector graphics, drag ‘n drop, or popups, these pages can be very valuable. They certainly helped me.
I’ve recreated the site here, and now present it to you for your perusal:
Vsftp is probably the most secure and fastest FTP server for UNIX-like systems. I won’t go into extolling it’s virtues, that is done on many other pages. One in particular is:
One of the things that is confusing is creating a new user. I’ve listed step by step instructions below to help:
To create a new user on the FTP server:
First ssh as root to the server:
To create a “db4″ format file, first create a plain text files with the
usernames and password on alternating lines.
For example, for two users:
Then issue the following commands:
db_load -T -t hash -f vusers.txt vsftpd-virtual-user.db
chmod 600 vsftpd-virtual-user.db
chmod 000 vusers.txt
Finally, create the directory (using the two IDs above):
and set the owner/group:
chown ftp.ftp /var/ftp/test /var/ftp/pub
Checkinstall is a utility that builds a .deb, .rpm or Slackware package from a third party source code tarball. This allows you to introduce such third party software using the standard package management features of your distribution. In contrast, the conventional instructions for installing such software packages puts your package manager out of sync with the actual collection of software installed on your Linux box.
The current version of checkinstall is a year old (as of October, 2009), and doesn’t work on the current versions of Fedora 14 or Ubuntu 10.10. There are actually two problems; one is that the library calls have changed in the latest version of glibc, and the second is that the rpmbuild command is missing a parameter.
The attached file is a patched version which fixes these problems. My gratitude goes to the Ubuntu Maverick developers who did the initial patching for the glibc problem.
Updated, the old version didn’t properly access the checkinstallrc file.
checkinstall-1.6.2-2.tar.gz (383.7 KiB, 678 hits)
Welcome to LinuxNotes.us
This site is intended to share various tricks and techniques I’ve come across and used in my wanderings in the Linux ecosphere. I will also be sharing open-source code on this site as time permits.