ua->catalog->db_port, ua->catalog->db_socket,
                              ua->catalog->mult_db_connections);
    if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
-      bsendmsg(ua, _("Could not open database \"%s\".\n"),
+      bsendmsg(ua, _("Could not open catalog database \"%s\".\n"),
                  ua->catalog->db_name);
       if (ua->db) {
          bsendmsg(ua, "%s", db_strerror(ua->db));
 
    } else {
       mode = OPEN_READ_WRITE;
    }
+   /* Try autolabel if enabled */
+   if (dev->open(dcr, mode) < 0) {
+      try_autolabel(dcr);
+   }
    while (dev->open(dcr, mode) < 0) {
       Dmsg1(150, "open_device failed: ERR=%s\n", dev->bstrerror());
       if ((dev->is_file() && dev->is_removable()) || dev->is_dvd()) {
 
    int name_max;
    char *mount_point;
    VOLUME_CAT_INFO dcrVolCatInfo, devVolCatInfo;
+   char VolumeName[MAX_NAME_LENGTH];
    struct stat statp;
    bool found = false;
    POOL_MEM fname(PM_FNAME);
    int len;
 
    
+   bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
    name_max = pathconf(".", _PC_NAME_MAX);
    if (name_max < 1024) {
       name_max = 1024;
        */
       dcrVolCatInfo = dcr->VolCatInfo;     /* structure assignment */
       devVolCatInfo = VolCatInfo;          /* structure assignment */
+      bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
       /* Check if this is a valid Volume in the pool */
       bstrncpy(dcr->VolumeName, result->d_name, sizeof(dcr->VolumeName));
       if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
    closedir(dp);
    
 get_out:
+   if (!found) {
+      /* Restore VolumeName we really wanted */
+      bstrncpy(dcr->VolumeName, VolumeName, sizeof(dcr->VolumeName));
+   }
    sm_check(__FILE__, __LINE__, false);
    return found;
 }
 
 
 #undef  VERSION
 #define VERSION "1.39.31"
-#define BDATE   "10 December 2006"
-#define LSMDATE "10Dec06"
+#define BDATE   "12 December 2006"
+#define LSMDATE "12Dec06"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2006 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2006"       /* year for copyright messages in progs */
 
               Technical notes on version 1.39  
 
 General:
+12Dec06
+
 10Dec06
 kes  Remove typedef uLong for HP in baconfig.h.  It broke things.
 lf   Fix job byte reporting -- the digest code runs in verify.c and