Ошибка read only file system 30

i have problem with googledrive credentials in AWS Lambda , after i deploy my .zip file before calling the function on the local machine , all is work , but after i deploy zip in AWS after ~30min i having lambda function error

  "errorMessage": "[Errno 30] Read-only file system: 'drive-python-quickstart.json'",
"errorType": "OSError",
  "stackTrace": [
    [
      "/var/task/lambda_function.py",
      33,
      "lambda_handler",
      "pageSize=10,fields="nextPageToken, files(id, name)").execute()"
    ],
    [
      "/var/task/oauth2client/_helpers.py",
      133,
      "positional_wrapper",
      "return wrapped(*args, **kwargs)"
    ],
    [
      "/var/task/googleapiclient/http.py",
      835,
      "execute",
      "method=str(self.method), body=self.body, headers=self.headers)"
    ],
    [
      "/var/task/googleapiclient/http.py",
      162,
      "_retry_request",
      "resp, content = http.request(uri, method, *args, **kwargs)"
    ],
    [
      "/var/task/oauth2client/transport.py",
      186,
      "new_request",
      "credentials._refresh(orig_request_method)"
    ],
    [
      "/var/task/oauth2client/client.py",
      761,
      "_refresh",
      "self._do_refresh_request(http)"
    ],
    [
      "/var/task/oauth2client/client.py",
      802,
      "_do_refresh_request",
      "self.store.locked_put(self)"
    ],
    [
      "/var/task/oauth2client/file.py",
      79,
      "locked_put",
      "f = open(self._filename, 'w')"
    ]
  ]
}

in file file.py i have this code :

 def locked_put(self, credentials):
    """Write Credentials to file.
    Args:
        credentials: Credentials, the credentials to store.
    Raises:
        IOError if the file is a symbolic link.
    """
    self._create_file_if_needed()
    _helpers.validate_file(self._filename)
    f = open(self._filename, 'w')
    f.write(credentials.to_json())
    f.close()

def locked_delete(self):
    """Delete Credentials file.
    Args:
        credentials: Credentials, the credentials to store.
    """
    os.unlink(self._filename)

i try to set f = open(self._filename, ‘w’) set to ‘r’, but it doesn’t help , maybe whom know how can i fix it ? Please suggest.

When I try to save something or rename a file/folder it say this error » Read-only file system» or run something as root in the terminal it say this error

sudo: unable to open /var/lib/sudo/"My User Name"/0: Read-only file system 
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/  
E: The package lists or status file could not be parsed or opened.

When I make a Folder the error dialog in the details with Nautilus is this:

Error creating directory: Read-only file system

I would show you I picture of it but it isn’t even letting my save onto my flash drive. Please help me.

Seth's user avatar

Seth

56.9k43 gold badges144 silver badges198 bronze badges

asked Apr 28, 2013 at 2:35

MathCubes's user avatar

0

This worked for me:

First, run this command with sudo permission:

sudo fsck -n -f

Then reboot the machine.


The options -f and -n are documented directly under man fsck, but under the filesystem-specific fsck subcommand. The fs-specific-options part alludes to this:

SYNOPSIS

fsck [-lsAVRTMNP]
     [-r [fd]]
     [-C [fd]]
     [-t fstype]
     [filesystem...]
     [--]
     [fs-specific-options]

From man fsck.ext4 (a.k.a. e2fsck):

-f — Force checking even if the file system seems clean.

-n — Open the file system read-only, and assume an answer of no to all questions. Allows e2fsck to be used non-interactively. This option may not be specified at the same time as the -p or -y options.

Further comments to option -n from this Unix & Linux stackexchange answer:

If you meant fsck -n, then the filesystem-specific programs are called and passed the -n option, which for most of them means “look but don’t touch”. If the filesystem is mounted, fsck will usually find spurious errors, because a mounted filesystem tends to be in an inconsistent state as write operations are happening. It won’t lock up your system, but it won’t report anything useful either.

David Foerster's user avatar

answered Jan 6, 2017 at 17:24

user639154's user avatar

user639154user639154

3693 silver badges2 bronze badges

8

When the system enters a read-only state, it does so to prevent damage to the system. Make sure your HDD is working properly and/or backup your data before doing anything.

I suggest to boot a live USB/DVD, open GParted, and use the check/repair feature.

This is the command to enable writing:

sudo mount -o rw,remount /

David Foerster's user avatar

answered Apr 28, 2013 at 2:41

GM-Script-Writer-62850's user avatar

9

If you are dual booting Windows with Ubuntu and you do not have any error in dmesg, then the problem could very well be caused by Windows.

In Windows go to Control Panel → Power Options and disable Fast Startup. Now boot into Ubuntu.

David Foerster's user avatar

answered Jul 16, 2018 at 16:09

Prejith P's user avatar

Prejith PPrejith P

1011 silver badge2 bronze badges

7

When accessing an HDD from different OS (Windows & Linux) the disk could contain an unclean file system. So the metadata cached in the OS, deny mounting the disk

To try to correct the mistakes, identify the path of your partition disk in the Disk app (i.e: /dev/sdb1 found by lsblk) and use ntfsfix.

sudo ntfsfix /dev/sdb1

If the disk is not mounted automatically, so:

$ sudo mkdir /media/[mount point]
$ sudo mount -o rw /dev/sdb1 /media/[mount point]

If you get the error Read-only file system then you should delete the following directories from Windows:

  • .Tash-1000
  • $RECYCLE.BIN/

In Git Bash as Admin:

Identify your disk. In my case is /f

$ cd /f
$ rm -R $RECYCLE.BIN/ && rm -R .Tash-1000

GL

Amin Ya's user avatar

answered Jul 18, 2020 at 4:22

Braian Coronel's user avatar

If someone using dual OS(Ubuntu, Windows) like me, NTFS filesystem is the main reason of this problem. Inspect the path of disk like «/dev/sda3», unmount the disk and run:

sudo ntfsfix /dev/sda3

answered May 24, 2022 at 5:45

sundowatch's user avatar

sundowatchsundowatch

2631 gold badge4 silver badges12 bronze badges

2

In my case, I have a common drive between Windows and Ubuntu.

On Ubuntu, I had installed trash-cli and had trashed some files.
When I booted in Windows, I did some defragmentation on that drive.
But when I went back to Ubuntu, then it started giving me Read-only file system error on any write operation.

After reading @Braian Coronel’s answer, I went back to Windows and permanently deleted .Trash-1000 folder which solved my issue.

answered Dec 22, 2021 at 17:35

Hrishikesh Kadam's user avatar


0

1

Пытаюсь установить любой линукс с флешки на древний ноут с 4гб памяти SSD 2-ядра проц интел. Мне выдает ошибку во время установки что-то типа errno 30 read-only file system.
Но при этом я без проблем могу поставить виндовс на этот ноут. Я не понимаю в чем дело. Я пробовал делать ручную разметку. Я думал что это связано с UEFI но ноут очень древний там нету этого UEFI.
SSD рабочий я ставил на него линукс с другого компа и подключал к ноуту. Но все равно через какое-то время на нем линукс крушиться и выпадает в initramfs BusyBox после каких-то манипуляций с обновлением.
Почему я без проблем могу поставить виндовс, а линукс не получается.

#python #matplotlib

#питон #matplotlib

Вопрос:

Я пытаюсь написать программу, которая создаст диаграмму matplotlib и сохранит файл png. Я пытался использовать этот savefig() метод (подробнее здесь), но он выдает следующую ошибку:

 OSError: [Errno 30] Read-only file system: 'image.png'
 

Вот мой код:

 fig = plt.figure()
    plt.title("Bar (Spreading of transactions)")
    plt.plot(bar_x, bar_y)
    plt.savefig("image.png")
 

Позже мне нужно будет сохранить этот файл во временном файле и получить к нему доступ с помощью Flask.

Комментарии:

1. попробуйте заменить «image.png» на «./image.png» (или с полным путем)

2. Судя по «Desktop» в имени вашего файла, я предполагаю, что вы используете Windows. Попробуйте создать каталог, в который вы уверены, что сможете записывать, а затем использовать абсолютный путь, включая букву диска, как было предложено выше. Что-то вроде "C:/MyDir/MyFile.png" .

3. О! И если прямые косые черты могут быть проблемой, измените их на обратные косые черты, но добавьте букву «r», начинающую строку. Что — то вроде r"C:MyDirMyFile.png".

4. Похоже, что вы находитесь в файловой системе, доступной только для чтения, поэтому вы не можете сохранить в ней изображение, поскольку это не операция чтения. Оформить заказ (этот пост)[ askubuntu.com/questions/47538 / … Сообщение находится на Ubuntu, но я думаю, что это даст вам еще одну возможность решить вашу проблему.

5. Некоторые начальные шаги, чтобы попытаться (1) определить местоположение, которое вы пытаетесь сохранить image.png — это должен быть текущий рабочий каталог, из которого вы запускаете python. (2) попробуйте создать файл в этом месте из terminal ( touch test.txt ). Если вы по-прежнему получаете сообщение об ошибке только для чтения, вы знаете, что вам нужно изменить права доступа к каталогу или попробовать сохранить его в другом месте. Если это сработает, то (3) попробуйте выполнить запись в файл в этом расположении из интерпретатора python (например with open('test.txt', 'w') as f: f.write("testing") ). Это сообщит вам, может ли python выполнять запись в этот каталог

Ответ №1:

Это проблема с разрешениями. Вы можете указать путь, по которому пользователь, которого вы используете, имеет разрешение на запись.

Вы можете проверить разрешения с ls -l /the/path/of/your/choice помощью . Чтобы рекурсивно предоставить разрешение на запись в этот каталог chmod u w -R /the/path/of/your/choice
( u для пользователя, которому принадлежит каталог, w добавить разрешение на запись и -R рекурсивно выполнить это)

Ответ №2:

Я думаю, что это может быть проблема с разрешениями, а не проблема с python. Вам нужно будет изменить разрешения папки, в которую вы пытаетесь выполнить запись. В терминале используйте chmod:

 chmod -R 777 /absolute/path/to/your/folder
 

Если вы не уверены, каков абсолютный путь, перейдите в свой каталог (с помощью терминала cd ) и введите pwd .

OSX обычно поставляется с «терминалом». Если вы не уверены, где его найти, нажмите «command» «пробел» и введите «terminal» в строке поиска.

Ответ №3:

Подождите, savefig () не следует использовать в качестве метода вашего рисунка? например, одна из моих программ использует ее следующим образом :

 def save(name):
    fig = plt.figure(num=1,figsize=(10,10), clear=True)
    #change axis color to white so they wont appear on the figure
    plt.rcParams['xtick.color'] = 'w'
    plt.rcParams['ytick.color'] = 'w'
    plt.rcParams['text.color'] = 'w'
    plt.rcParams['axes.labelcolor'] = 'w'
    #display the image on the figure
    plt.imshow(gist_rainbow(map))
    #save the figure
    fig.savefig(name)
 

таким образом, вызов этой функции like save("image.png") сохранит изображение map , которое хранится в матрице с плавающими значениями, преобразованной в RGBA благодаря цветовой карте matplotlib gist_rainbow, но вы можете просто использовать ее для сохранения всего, что отображается на вашем рисунке между объявлением fig и вызовом savefig() метода.
Кроме того, если файл уже существует и вы хотите его перезаписать, это может быть вопрос разрешений. В этом случае вам следует попытаться запустить ls -la команду для нескольких файлов вашей файловой системы в поисках конкретных ограничений.

Комментарии:

1. Эй! Но gist_rainbow это даже не из matplotlib. Я попытался импортировать его, но он не существует. Так что я не уверен в том, что мне следует делать.

2. Это так, но это пользовательское имя, которое вам нужно сделать from matplotlib import cm gist_rainbow = cm.get_cmap(name="gist_rainbow") ( get_cmap функция возвращает вызываемый объект, который вы можете присвоить переменной с любым именем) PS: вы можете узнать больше о matplotlib colormap здесь

3. Это не отвечает на вопрос

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Closed

egorikem opened this issue

Jul 28, 2019

· 2 comments

Comments

@egorikem

Just following along the «tutorial» setup, and this happens.

Code

void initDb() async {
    store = StoreRef.main();
    db = await databaseFactoryIo.openDatabase(dbPath, version: 1);
}

Result

E/flutter (25210): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Cannot create file, path = '/sample.db' (OS Error: Read-only file system, errno = 30)
E/flutter (25210): #0      _wrap.<anonymous closure> (package:sembast/src/io/file_system_io.dart:102:7)
E/flutter (25210): #1      _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter (25210): #2      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (25210): #3      _FutureListener.handleError (dart:async/future_impl.dart:144:20)
E/flutter (25210): #4      Future._propagateToListeners.handleError (dart:async/future_impl.dart:651:47)
E/flutter (25210): #5      Future._propagateToListeners (dart:async/future_impl.dart:672:24)
E/flutter (25210): #6      Future._completeWithValue (dart:async/future_impl.dart:483:5)
E/flutter (25210): #7      Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:513:7)
E/flutter (25210): #8      _rootRun (dart:async/zone.dart:1124:13)
E/flutter (25210): #9      _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (25210): #10     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (25210): #11     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (25210): #12     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (25210): #13     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

Manifest

Manifest looks ok to me:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

@egorikem
egorikem

changed the title
OS Error: Read-only file system, errno = 30

OS Error: Read-only file system, errno = 30

Jul 28, 2019

@egorikem

Ok then, the solution has been found. However I do believe that the missing line absolutely shall be added to the tutorial

store = StoreRef.main();
final appDocDir = await getApplicationDocumentsDirectory();
db = await databaseFactoryIo.openDatabase(join(appDocDir.path, dbPath), version: 1);

@alextekartik

2 participants

@alextekartik

@egorikem

Понравилась статья? Поделить с друзьями:
  • Ошибка r02 на стиральной машине bosch
  • Ошибка read of address 00000008
  • Ошибка r02 на nikon d90
  • Ошибка read from disk utorrent
  • Ошибка r01 на котле беретта