Monthly Archives: February 2008

Arkeia backup fails with “Drive is reserved”

source: support arkeia

Drive locked or reserved
Question
The backup fails with “Drive is locked”?
The backup fails with “Drive is reserved”?
Answer
Arkeia uses lock files to prevent other processes from accessing
and obtaining an Arkeia resource that is in use by a running process.
The drive defintion file also contains the PID of the Arkeia Backup
Process (arkbkp). When the PID is active, the drive is considered
locked or reserved.

CAUSE #1

The drive definition file in locked in the Arkeia Configuration

Message : drive list is locked
Message : drive master file is locked

Arkeia uses lock (.lck files), to prevent different process
from accessing the file at the same time.

CAUSE #2

The drive is reserved by an Arkeia process:

Message : Drive “drivename” is already reserved, try later ..

Arkeia processes reserves the drive in order to use it for I/O operations.
The PID of the process is added in the Drive Definition file. (ex: PID “432432”).

SOLUTIONS:

1) If the drive definition file is locked, then no other process can access this file.

To remove this lock, you must stop all running processes:

– Stop all backup and restore jobs
– Exit the Arkeia GUI
– Stop Arkeia using /opt/arkeia/bin/arkboot stop
– Kill all remaining processes
ps -ef |grep ark
kill -15 PID
– Now start Arkeia and the GUI

2) The drive is reserved by an Arkeia process:

Sometimes the drive is reserved while the process which reserved as terminated
or hung.
To correct the issue, you must remove the PID from the file.

– Check the drvxxxx.lst file for the PID
cd /opt/arkeia/server/dbase/f3drv
cat drvxxxxx/drvxxxxx.lst | grep PID
– Check the process list to see if the PID is still active.
Mormally it is arkbkp or arkrst.
ps -ef |grep ark
– kill the process if you know it is hung or not active.
– Now delete the PID line from the drvxxxxxx.lst file
– Restart Arkeia using:
/opt/arkeia/bin/arkboot stop
/opt/arkeia/bin/arkboot start

EOF

Redirecting output of the bash keyword time

time command > timelog doesn’t work, because time outputs to stderr
time command 2> timelog doesn’t work either, because time actually is a bash keyword, and it’s always run in a subshell

Redirecting the output of time can be achieved by executing the whole command in a block, then redirecting its output:
{ time command; } 2> timelog

Note: Linux also provides a time binary (/usr/bin/time), but with a different output (and might be less efficient ?)

source

Convert a pkcs12 to pem (ca crt, crt, key)

$ openssl pkcs12 -in pkcs12file.p12 -out pemfile.pem
(by default, pkcs12 will ask for an import password, to decrypt the p12 file (just press Enter if you don’t have a password), and finally a passphrase to encrypt your key)

pemfile.pem now contains your CA certificate, your client certificate, and your (encrypted) key.

Lock all MySQL databases

Lock a database:
$ mysql -u user -p
mysql> FLUSH TABLES WITH READ LOCK;
This closes all open tables and locks all tables for all databases with a read lock until you execute UNLOCK TABLES.

Unlock:
mysql> UNLOCK TABLES;

(to lock a single table: LOCK TABLES table READ;)

Cleaning Apple Mail’s Envelope Index

Apple Mail keeps a lot of junk in a SQLite database named Envelope Index. Since it’s a database, it tends to grow with time, and deleted records are not handled very efficiently. You might want to clean it a bit from time to time, and Mail might even seem a little faster after that.

1. Quit Mail

2. Launch a terminal, and type this command :

sqlite3 ~/Library/Mail/Envelope\ Index vacuum

source

Resolving apt-get gpg issues

You run apt-get update, and it complains about some missing key IDs:

W: There is no public key available for the following key IDs:
B5D0C804ADB11277
W: GPG error: http://volatile.debian.org etch/volatile Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EC61E0B0BBE55AB3
W: You may want to run apt-get update to correct these problems

B5D0C804ADB11277 and EC61E0B0BBE55AB3 are the missing gpg pub keys. Fetch them with gpg, and import them into apt :

gpg --keyserver subkeys.pgp.net --recv-key B5D0C804ADB11277
gpg -a --export B5D0C804ADB11277 | apt-key add -
apt-get update

OR (new and improved!)

apt-key advanced --keyserver subkeys.pgp.net --recv-keys B5D0C804ADB11277
apt-get update

or, with a different server: apt-key advanced --keyserver pgp.mit.edu --recv-keys

Recover mysql root password

– Stop mysql
# /etc/init.d/mysql stop

– Lauch mysql with –skip-grant-tables (WARNING: your mysql server will launch without any password authentication, so please protect it first with a firewall or something if it’s world accessible)
# mysqld_safe --skip-grant-tables

– Login as root without a password
$ mysql -u root

– Change the password
mysql> use mysql;
mysql> update user set password=PASSWORD("your_new_root_password") where User='root';
mysql> flush privileges;
mysql> quit

– Stop mysql
# /etc/init.d/mysql stop

– Start mysql again to re-enable authentication
# /etc/init.d/mysql start