We are running Gentoo on sparc64: srv-1 root # uname -a Linux srv-1 2.4.27-sparc #1 SMP Fri Dec 31 08:43:34 PST 2004 sparc64 sun4u TI UltraSparc II (BlackBird) GNU/Linux The first step in installing RAID 5 is to figure out what devices you have available: srv-1 root # dmesg | grep SCSI SCSI subsystem driver […]
Configuring Software RAID 5 on GNU/Linux
Moving Files with Caps using Bash
We recently ran into an issue where there were legacy all-caps files in a directory, and we needed to move them. The remaining files were all lower-case. It turns out that when there are subdirectories involved, it is not as easy to move just the all-caps files, rather than the subdirectories. Here is an example […]
Installing Lilo on Red Hat Enterprise Linux 4
There are a lot of reasons to run GRUB. We feel there are also a lot of reasons to run LILO. If you do install LILO, the boot process will instantly become traditional. Red Hat hides much of the boot process by default, including the SELinux messages. Yes, sure, you could reconfigure it, but the […]
How to Test for a Particular User From Bash
You can test for a particular user with the id test: [usr-1@srv-1 ~]$ if [ `id -u` = 0 ]; then echo root; fi [usr-1@srv-1 ~]$ su Password: [root@srv-1 usr-1]# if [ `id -u` = 0 ]; then echo root; fi root [root@srv-1 usr-1]# Here, we simply test for root, userid=0, and echo root if […]
Linux Kernel Memory Management
One seemingly innocent question is, “what is the active memory statistic in top?”. That is, what does this mean: Mem: 508476k av, 456424k used, 52052k free, 0k shrd, 86780k buff 173524k active, 131488k inactive Swap: 2048276k av, 0k used, 2048276k free 218144k cached It is fine to understand why all of the memory is used […]
Writing a Bash For Loop
The power to our lab machines is controlled by a device we built in 2001. It uses the serial port to control a bank of relays. For more information on the device and how to build it, see this article. Now, it turns out that we often need to simply turn on all machines and […]
Disable Ping (ICMP) Responses With Linux
This is a kernel parameter that you can set with /etc/sysctl.conf by adding two lines: # tail -n 2 /etc/sysctl.conf net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.icmp_echo_ignore_all = 1 Apply the changes by using the sysctl -p command: # sysctl -p . . . net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.icmp_echo_ignore_all = 1 # There are various security reasons why you […]
Sprogram Terminated Error after Gentoo Emerge
We recently upgraded our Sparc64 Gentoo box. When we rebooted we got an error at the console when trying to boot that just said Sprogram terminated. It turns out that this was caused by an error with the SILO boot records. See this article for more information on installing SILO. To get our system to […]
Upgrading Linux Kernel on Gentoo Sparc64
We had a troublesome upgrade of our Gentoo Sparc64 box. After emerge world the system wouldn’t boot because the boot files were changed without re-running SILO. We fixed this in this article. Anyway, even though we went through this trouble, it appears that the emerge downloaded the 2.4.31 sources, messed with our boot files, but […]
JDK on GNU/Linux on Sparc64
If you need to run Java on GNU/Linux running on Sparc64 hardware, your best bet is to get the Blackdown source. This is easy with Gentoo: srv-1 opt # emerge jdk Calculating dependencies …done! >>> emerge (1 of 2) dev-java/java-config-1.2.11 to / >>> Downloading http://distfiles.gentoo.org/distfiles/java-config-1.2.11.tar.bz2 –10:00:21– http://distfiles.gentoo.org/distfiles/java-config-1.2.11.tar.bz2 => `/usr/portage/distfiles/java-config-1.2.11.tar.bz2′ Resolving distfiles.gentoo.org… 216.165.129.135, 64.50.236.52, 156.56.247.195 Connecting […]
Forcing Installs with Up2date
If you have trouble with dependencies running up2date, the Red Hat update system, you can force download and installs by downloading the packages regardless of dependencies and then forcing the install. Be careful when you do this, or course. The system is there to make sure you install the correct packages, so if up2date tells […]
Rebuilding the RPM Database
Be very careful messing with your RPM database. You can cause serious system failure if you mess up your RPM packages. One trick that works for us is to rebuild the RPM database: [root@www root]# cd /var/lib/rpm/ [root@www rpm]# ls Basenames __db.003 Installtid Provideversion Sha1header Conflictname Dirnames Name Pubkeys Sigmd5 __db.001 Filemd5s Packages Requirename Triggername […]
Crontab Locations on Red Hat, Fedora, and CentOS
On Red Hat/Fedora/CentOS, you can’t simply look at that output of crontab -l to see what is scheduled to run as root, even if you are running as root. For instance: # crontab -l 0 0 * * * /bin/some/command # cat /var/spool/cron/root 0 0 * * * /bin/some/command # There can be another system […]
Listing and Counting Processes with a Certain Name
The -C option can be used with ps to display certain processes: $ ps -C httpd PID TTY TIME CMD 726 ? 00:00:00 httpd 732 ? 00:00:00 httpd 6064 ? 00:00:00 httpd 19452 ? 00:00:00 httpd 21047 ? 00:00:00 httpd 21048 ? 00:00:00 httpd 21049 ? 00:00:00 httpd 21060 ? 00:00:00 httpd 30127 ? 00:00:00 […]
Using Yum To Install Dependencies
Always reluctant to try something new when we are comfortable with the tools we currently use, we haven’t used yum before. We had a problem with installing the net-snmp-devel package with up2date because of some dependencies. We were able to use yum to quickly install the package we needed along with the dependencies on our […]
Embedding Text in Find Output
We recently did a migration of large files to another server, and needed to create a bunch of redirect commands to point at the new location. This turned out to be quite easy with find. First, we need to find the files over 570K: find . -size +570k -printf ‘%k %p\n’ The quotes after printf […]
Setting the Root Password on Ubuntu
There is, generally, no need to use root for Ubuntu, since everything is done via sudo. If you wish, though, you can set the root password by typing: sudo su Enter the user password, and then: passwd Enter the root password you wish to use. Now, you can log on as root if you wish.
Using Strace to Debug Code
We wrote about strace in this article to find the files a program opened. The manpage for strace is here. Strace can be used to debug code as well. We have an application we are writing in REALbasic. In case you haven’t heard of this before, it is a cross platform compiler that is a […]
Logical OR With Grep
Say you have a file that has seventeen entries that look like this: [usr-1@srv-1 ~]$ cat nmapout.txt Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2006-05-05 13:41 PDT Interesting ports on 10.50.100.1: (The 1656 ports scanned but not shown below are in state: closed) PORT STATE SERVICE 22/tcp open ssh 111/tcp open rpcbind 6000/tcp open X11 […]
Substring Replacement With BASH
If you need to rename a substring of a bunch of filenames to something else, use a command like this: for i in server*.html; do mv $i ${i/server/workstation} ; done This changes all serverblah.html files to workstationblah.html. For more on BASH, see the BASH Manpage.