diff --git a/cpus.c b/cpus.c
index 17b055f..c87035f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1178,7 +1178,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
 
     f = fopen(filename, "wb");
     if (!f) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set_file_open_failed(errp, filename, errno);
         return;
     }
 
@@ -1208,7 +1208,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
 
     f = fopen(filename, "wb");
     if (!f) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set_file_open_failed(errp, filename, errno);
         return;
     }
 
diff --git a/error.c b/error.c
index 990050f..b32d7f5 100644
--- a/error.c
+++ b/error.c
@@ -144,3 +144,47 @@ void error_set_qobject(Error **errp, QObject *obj)
 
     *errp = err;
 }
+
+void error_set_file_open_failed(Error **errp, const char *file_name, int ret)
+{
+    const char *fmt = NULL;
+
+    switch (ret) {
+    case EACCES:
+        fmt = QERR_OPEN_FILE_EACCES;
+        break;
+    case EINTR:
+        fmt = QERR_OPEN_FILE_EINTR;
+        break;
+    case EEXIST:
+        fmt = QERR_OPEN_FILE_EEXIST;
+        break;
+    case EMFILE:
+        fmt = QERR_OPEN_FILE_EMFILE;
+        break;
+    case ENOSPC:
+        fmt = QERR_OPEN_FILE_ENOSPC;
+        break;
+    case EPERM:
+        fmt = QERR_OPEN_FILE_EPERM;
+        break;
+    case EROFS:
+        fmt = QERR_OPEN_FILE_EROFS;
+        break;
+    case ENOTDIR:
+        fmt = QERR_OPEN_FILE_ENOTDIR;
+        break;
+    case EFBIG:
+        fmt = QERR_OPEN_FILE_EFBIG;
+        break;
+    default:
+        /*
+         * EINVAL and ENOTSUP will result in the default
+         *
+         * ENOENT too, it's used by (for instance) bdrv_create_file for
+         * a different purpose then open (2) so just give a generic error.
+         */
+        fmt = QERR_OPEN_FILE_FAILED;
+    }
+    error_set(errp, fmt, file_name);
+}
diff --git a/error.h b/error.h
index 6361f40..f3a80f3 100644
--- a/error.h
+++ b/error.h
@@ -67,4 +67,8 @@ void error_free(Error *err);
  */
 bool error_is_type(Error *err, const char *fmt);
 
+/**
+ * Helper to set error for a open (2) style return code.
+ */
+void error_set_file_open_failed(Error **errp, const char *file_name, int ret);
 #endif
diff --git a/qerror.c b/qerror.c
index f55d435..23c260b 100644
--- a/qerror.c
+++ b/qerror.c
@@ -213,6 +213,42 @@ static const QErrorStringTable qerror_table[] = {
         .desc      = "Could not open '%(filename)'",
     },
     {
+        .error_fmt = QERR_OPEN_FILE_EINTR,
+        .desc      = "Interrupted open of '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EACCES,
+        .desc      = "Cannot access '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EEXIST,
+        .desc      = "File already exists '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EMFILE,
+        .desc      = "Max open files when opening '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_ENOSPC,
+        .desc      = "No space left opening '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EPERM,
+        .desc      = "Permission denied (EPERM) for '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EROFS,
+        .desc      = "Read only filesystem opening '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_ENOTDIR,
+        .desc      = "Directory related error opening '%(filename)'",
+    },
+    {
+        .error_fmt = QERR_OPEN_FILE_EFBIG,
+        .desc      = "File too big opening '%(filename)'",
+    },
+    {
         .error_fmt = QERR_PERMISSION_DENIED,
         .desc      = "Insufficient permission to perform this operation",
     },
diff --git a/qerror.h b/qerror.h
index e26c635..6ab9b8d 100644
--- a/qerror.h
+++ b/qerror.h
@@ -181,6 +181,33 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_OPEN_FILE_FAILED \
     "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
 
+#define QERR_OPEN_FILE_EINTR \
+    "{ 'class': 'OpenFileEINTR', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EACCES \
+    "{ 'class': 'OpenFileEACCES', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EEXIST \
+    "{ 'class': 'OpenFileEEXIST', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EMFILE \
+    "{ 'class': 'OpenFileEMFILE', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_ENOSPC \
+    "{ 'class': 'OpenFileENOSPC', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EPERM \
+    "{ 'class': 'OpenFileEPERM', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EROFS \
+    "{ 'class': 'OpenFileEROFS', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_ENOTDIR \
+    "{ 'class': 'OpenFileENOTDIR', 'data': { 'filename': %s } }"
+
+#define QERR_OPEN_FILE_EFBIG \
+    "{ 'class': 'OpenFileEFBIG', 'data': { 'filename': %s } }"
+
 #define QERR_PERMISSION_DENIED \
     "{ 'class': 'PermissionDenied', 'data': {} }"
 
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7b2be2f..4e5ef7f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -134,7 +134,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E
     slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
     fh = fopen(path, mode);
     if (!fh) {
-        error_set(err, QERR_OPEN_FILE_FAILED, path);
+        error_set_file_open_failed(err, path, errno);
         return -1;
     }
 
