Error reading lock file etc network interfaces swp not enough data read

I am getting this error while opening /etc/profile file using nano. Error reading lock file /etc/.profile.swp: Not enough data read How can I fix this?

I am getting this error while opening /etc/profile file using nano.

Error reading lock file /etc/.profile.swp: Not enough data read

How can I fix this?

Zanna's user avatar

Zanna

68.2k55 gold badges210 silver badges320 bronze badges

asked Jul 25, 2017 at 9:12

Vaibhav Phadke's user avatar

5

Try to remove the hidden file .[yourfilename].swp, which is stored in the same folder as the file that you are trying to open.
In your case try the shell command rm /etc/.profile.swp.

This issue also occurs with nano 2.7.4, and must be something to do with how nano handles a corrupted swapfile.

Hope this helped

storm's user avatar

storm

4,8836 gold badges33 silver badges48 bronze badges

answered Sep 21, 2017 at 8:50

sunwalker's user avatar

sunwalkersunwalker

5513 silver badges2 bronze badges

1

The problem is linked to a bug in an older version of nano as seen here.

As per the report, the affected version was nano-2.4.2. You should run nano --version to ascertain your current version and update accordingly.

A more detailed report of the actual issue can be found here.

answered Jul 25, 2017 at 9:47

The Pizza Overlord's user avatar

2

Was happening for me because I was out of disk space, I cleared up some space, deleted the swap file and it worked.

answered Dec 8, 2017 at 20:04

Anthony's user avatar

AnthonyAnthony

1211 silver badge3 bronze badges

This happened for me because of a log file that wasn’t rotating, it took the entire disk space, I solved it by truncating this log file, then removing the .swp file.

answered Aug 25, 2019 at 6:47

AyuMu's user avatar

AyuMuAyuMu

111 bronze badge

0

For me this was because of running docker container logs.
Worked fine after deleting them.
Logs location: /var/lib/docker/containers/
rm -rf /var/lib/docker/containers/*

Note: this will delete all the log generated till today, you may choose to deleted not required and also take backup to avoid logs data loss.

answered May 23, 2022 at 8:44

Sunil Dhayal's user avatar

Please try this one (run this on the current folder):

find . -name "*.swp" -delete

Keep in mind that as @pbhj commented:

[…] this will find all files below the current root, ending in .swp, and delete them. Which should work to remove temporary nano files, but might have unintended consequences.

BeastOfCaerbannog's user avatar

answered Sep 6, 2022 at 20:38

Arunjith R S's user avatar

2

Before you get into this article, you may find here are the most frequent solved problems here it is.

This article covers a detailed step by step solution and there are significant reasons this content serves your purpose. Success 

I’m happy to share the piece of tip here that worked for me and saved my time a lot. 

Let’s begin now,  

Introduction

Before begin, a bit to describe my development work here is the project developed in PHP Laravel Framework with LAMP (Linux Apache, MySQL and Php). The completed Php project is deployed in AWS Server instance in where Linux Ubuntu 18.4 OS installed.

Over a period of time, php project captures error logs increased size and occupied disk space in server instance. 

  • Software Involved
  • Linux — Ubuntu 18.4
  • Linux Command Terminal
  • PHP — Laravel Framework
  • MySQL

As you may have encountered these terms like error writing lock file no space left on device, swp: Not enough data read, .swp file. There could be lot of reasons why we encounter «Not enough space left«. 

Similarly here are the most frequent search terms as you and me searched a lot to get here.

Error reading lock file /etc/.profile.swp  Not enough data read

Error reading lock file /etc/.default.swp Not enough data read

Error reading lock file /etc/.rc.local.swp Not enough data read

As said above .swp file may be the one causing the error. In your case .swp could be profile or default or local.

Problem Description

This is what happened in my case,

I logged into server instance where my php project is deployed which is Ubuntu 18.4, and opened command Terminal (Ctrl + Alt + T).  I navigated to project folder.

When exactly this error thrown?

There was a random common error in php project, if you are php background I’m sure you know it .env file and its purposes.

.env file stores all the configurations databases, SSL certificates credentials etc of the project.

 As said in above box, I actually did not configure correctly, setting to APP_DEBUG=true in .env file is fine for development.

APP_DEBUG = true

Whereas when you deploy your project in server it is highly not recommended to set as true. It should be set to false as below

APP_DEBUG = false

Why setting to false is important?

Its because when you set APP_Debug = true in .env file means when you encounter error in application the exception thrown in browser along with whole .env file expose everything as plain text.

Imagine anyone sees the error can also read your database user name and password.

Apart from above suggested let’s get into the main problem description,

In the project folder .env file resides in root folder, now I try to open it (to change APP_DEBUG=false) in command line editor in terminal with this command $ sudo nano .env

$ sudo nano .env

After executing the command error show as «Error reading lock file ./..env.swp not enough data read«. This is because any file you open with any editor .swp file gets created. And in here, log file size huge and space on device is insufficient to open the file in editor. 

If you have searched google many sites suggested different approach that did not help as much, that’s the only reason I’m providing helping hand, explore more here

Get Set Solution helps everyone with details steps with google search.

Solve Error reading lock file

So how I get rid of not enough data read on device? Let’s move to solution section.

Solution

The simple solution is provided in image below. 

These are the 4 steps to do 

  • 1. Navigate to your Project folder
  • 2. Find if you have hidden .swp files in folder
  • 3. Delete the .swp files
  • 4. Ensure you have deleted or not

STEP 1 : Navigate to your Project Folder 

I have placed my project folder in /home/ubuntu/projects/generator.

/home is home directory

/ubuntu is user account 

/projects is the folder name 

/generator is the actual php application 

STEP : 2  Find if you have hidden .swp files 

As circled 1 in image, execute this command find . -name «*.swp»

$ find . -name «*.swp»

the result will be as below as circled 2 list of .swp files available in my project

.swp files

STEP 3 : Delete the .swp files

As circled 3 in image, execute the command find . -name «*.swp» -delete 

$ find . -name «*.swp» -delete

After executing command, you find all the .swp files are deleted 

STEP 4:  Ensure you have deleted .swp files are not 

Just execute the same command find . -name «*.swp» this takes to next line that indicates you have deleted .swp files successfully

If you have missed all 4 steps, you can refer to below image described.

 

Solved Error reading lock file not enough space on disk

So what’s next move?

Now you can proceed to open .env file using this command, that’s all done.

$ sudo nano .env

Я получаю эту ошибку при открытии /etc/profile файл с помощью нано.

Error reading lock file /etc/.profile.swp: Not enough data read

Как я могу зафиксировать это?

задан
20 September 2018 в 12:00

поделиться

4 ответа

Попробуйте удалить скрытый файл . [Yourfilename] .swp , который хранится в той же папке, что и файл, который вы пытаетесь открыть.
В вашем случае попробуйте команду оболочки rm /etc/.profile.swp.

Эта проблема также возникает с nano 2.7.4 и должна быть связана с тем, как nano обрабатывает поврежденный файл подкачки.

Надеюсь, это помогло

ответ дан storm
23 November 2019 в 01:51

поделиться

Проблема связана с ошибкой в ​​более старой версии nano , как показано здесь .

Согласно отчету, уязвимая версия было нано-2.4.2 . Вы должны запустить nano --version , чтобы узнать текущую версию и обновить ее соответствующим образом.

Более подробный отчет о реальной проблеме можно найти здесь .

ответ дан The Pizza Overlord
23 November 2019 в 01:51

поделиться

Это случилось со мной, потому что у меня не было дискового пространства, я очистил некоторое пространство, удалил файл подкачки, и это сработало.

ответ дан Anthony
23 November 2019 в 01:51

поделиться

Это случилось со мной из-за того, что файл журнала не вращался, он занимал все место на диске, я решил это, усекнув этот файл журнала, а затем удалив файл .swp.

ответ дан AyuMu
23 November 2019 в 01:51

поделиться

Другие вопросы по тегам:

Похожие вопросы:

  • #3

@bbgeek17 Thank you for the reply. There is plenty of storage space on all drives, but you bring up a good point… There was an episode previously where syslog file overfilled the boot SSD with errors from an USB device. I deleted the syslog file, removed the device and all was forgotten. I wonder if the fstab.swp was created during this time and is a remnant of that issue? Based on your google search article, it sounds like the correct action is to rm the fstab.swp file. I will give it another 24hrs for other replies before I dare to delete an important system file and then report back to you.

I also attempted to edit etc/fstab with vi and received the following error thus supporting idea of fstab.swp file conflicting with fstab:

Code:

E325: ATTENTION
Found a swap file by the name "/etc/.fstab.swp"
          owned by: root   dated: Mon Jul 12 21:34:36 2021
         [cannot be read]
While opening file "/etc/fstab"
             dated: Wed Jun  2 20:04:31 2021

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /etc/fstab"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/.fstab.swp"
    to avoid this message.
"/etc/fstab" 5 lines, 207 characters

In the end, I think your articles recommendation to delete .fstab.swp is the most logical. Maybe a mv command versus rm to start. Incidentally, I did a DuckDuckGo search and that article did not appear. Maybe I should start using Google again.

Thanks for your feedback!

Last edited: Sep 30, 2021

Have you come across the ‘could not get lock’ error in ubuntu linux? If that’s the case, then read this guide to solve this issue.

3ответа

Попробуйте удалить скрытый файл .[yourfilename].swp, который хранится в той же папке, что и файл, который вы пытаетесь открыть.
В вашем случае попробуйте команду оболочки rm /etc/.profile.swp,

Эта проблема также возникает в nano 2.7.4 и должна быть связана с тем, как nano обрабатывает поврежденный файл подкачки.

Надеюсь, это помогло

sunwalker 21 сен ’17 в 08:502017-09-21 08:50

2017-09-21 08:50

Проблема связана с ошибкой в ​​старой версии nano как видно здесь.

Согласно отчету, уязвимая версия была nano-2.4.2, Ты должен бежать nano –version чтобы узнать вашу текущую версию и обновить соответственно.

Более подробный отчет о фактической проблеме можно найти здесь.

2017-07-25 09:47

Это происходило для меня, потому что у меня не было места на диске, я очистил немного места, удалил файл подкачки, и это сработало.

Antoine 08 дек ’17 в 20:042017-12-08 20:04

2017-12-08 20:04

Это произошло для меня из-за файла журнала, который не вращался, он занял все дисковое пространство, я решил это, обрезав этот файл журнала, а затем удалив файл.swp.

AyuMu 25 авг ’19 в 09:472019-08-25 09:47

2019-08-25 09:47

Источник: http://ask-ubuntu.ru/questions/389065/oshibka-pri-otkryitii-etcprofile-oshibka-chteniya-fajla-blokirovki-etcprofileswp

./. interfaces.swp: Not enough data read

In trying to modify my /etc/network/interfaces file on my home web server, I fat-fingered something, apparently.

Now, trying to modify the file in nano, I get a blank buffer with the message:

Code:

Error reading lock file ./.interfaces.swp: Not enough data read.

I can’t connect to my network.

I have tried: Rebooting, removing /etc/network/interfaces, recreating it. I’m still getting the message.

(This is not the buffer underflow bug with nano 2.4.2, since I’m using 2.5)

Edit: Sigh … Created a dummy file with garbage in it and called it interfaces.swp. Am now able to edit interfaces.

Last edited by QIII; September 19th, 2017 at 04:40 AM.

Please read

The Forum Rules

and

The Forum Posting Guidelines

A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.

This universe is crazy. I’m going back to my own.

Источник: http://ubuntuforums.org/showthread.php?t=2371795

Method 1: Try Again or Reboot.

Using the apt command for installing different applications mostly works. However, you could still run into an error or two on a bad day. Accordingly, if you’re facing the ‘could not get lock’ error in Ubuntu Linux, then maybe this method might work out for you.

There are no complications with this procedure as you just have to wait for about 10 minutes and go for the installation again. However, if that doesn’t work either, you can try rebooting your system after enabling the automatic updates.

If that sounds confusing, try following these steps:

  1. Start by clicking the Show Applications button on the bottom-right side of the screen.
  2. From there, you are to type “Updates” in the search box.

  1. Next, you need to click on Software & Updates from the available options and head to the “Updates” tab.
  2. From there, you’ll be able to set the update schedule as you deem fit.

could not get lock error on ubuntu linux

  1. Lastly, you can restart your computer and see if the installation works now.

Although waiting or rebooting the system might work, there are plenty of cases where you’d have to try another method to fix this issue.

Источник: http://saintlad.com/could-not-get-lock-error-on-ubuntu-linux/

Ошибка read only file system в Linux

В этой небольшой статье мы рассмотрим как исправить read only file system Linux перемонтировав файловую систему для записи. Первым делом надо определиться с точкой монтирования, для которой надо разрешить запись. Попытаемся создать файл в корневом каталоге:

touch /file

Ошибка, файловая система корневого каталога доступна только для чтения. Чтобы посмотреть все точки монтирования доступные в системе выполните в терминале:

mount | grep /dev/sd

В данном случае, корневая файловая система и есть точкой монтирования. Но у вас, например, возникнут проблемы с созданием файла в домашней папке, то надо будет уже перемонтировать /home. Смотрите внимательно. Когда точка монтирования выбрана, осталось её примонтировать с правами на запись:

sudo mount -o remount,rw /

Или для /home:

sudo mount -o remount,rw /home

После этого вы сможете создать файл без каких-либо проблем. После завершения работы, во избежание повреждения данных при перезагрузке, желательно перемонтировать файловую систему обратно в режим только для чтения:

sudo mount -o remount,ro /

Теперь вы знаете что означает эта ошибка и как с ею справится. Если у вас остались вопросы, спрашивайте в комментариях!

Об авторе

Основатель и администратор сайта losst.ru, увлекаюсь открытым программным обеспечением и операционной системой Linux. В качестве основной ОС сейчас использую Ubuntu. Кроме Linux, интересуюсь всем, что связано с информационными технологиями и современной наукой.

Источник: http://losst.ru/kak-ispravit-read-only-file-system-v-linux

Issue description

The fail2ban service returns:

.fail2ban-serve[610]: fail2ban.utils [610]: ERROR 7fe5847617b0 — stderr: “Fatal: can’t open lock file /run/xtables.lock: Read-only file system”

Steps to reproduce

Open up port 22 to the Internet and wait for someone to attack your machine or just simulate an attack yourself.

services.fail2ban.enable = true;

Источник: http://github.com/NixOS/nixpkgs/issues/41422

Эта ошибка обычно возникает, когда процесс обновляет систему, а вы пытаетесь получить доступ к системе для выполнения какой-либо другой операции. Например, система Ubuntu блокирует доступ «dpkg», чтобы операционная система не завершила процесс обновления. Это также может произойти из-за произвольного процесса, который постоянно работает в фоновом режиме и сохраняет задействованным «/var/lib/dpkg».

Эти процессы не позволяют вам устанавливать новые приложения или выполнять команды. Есть несколько способов решить эту проблему. Сначала тщательно диагностируйте проблемы, а затем приступайте к их исправлению. Давайте разберемся, как исправить эту проблему.

Источник: http://andreyex.ru/linux/kak-reshit-oshibku-could-not-open-lock-file-var-lib-dpkg-lock-frontend/

Expected behaviour:

No fatal messages.

Источник: http://github.com/NixOS/nixpkgs/issues/41422

Technical details

Stable branch, but likely in all NixOS versions.

  • system: “x86_64-linux”
  • host os: Linux 4.9.86, NixOS, 18.03.git.03ba84e (Impala)
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.0.2
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

The text was updated successfully, but these errors were encountered:

Источник: http://github.com/NixOS/nixpkgs/issues/41422

( 1 оценка, среднее 5 из 5 )

Понравилась статья? Поделить с друзьями:
  • Error proxy banned
  • Error providing payment details try to create a new order or contact technical support
  • Error prototype for does not match any in class
  • Error protocol swift
  • Error protocol security negotiation or connection failure