can't install lvm2 on ubuntu 16.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am trying to expand the size of one of the virtual machines I use. For that reason, I need to install the pvcreate command to be able of creating a physical volume.



When I try to install it, I get the following errors:Errors



Notes:



Reading the output and looking for some information and other questions like this one, I understand I need to update the operating system, but I can't manage do it.



Errors that I have encountered:



1) "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." (solved)



2) Read-only file system enter image description here



3) "Unexpected inconsistency. Run fsck manually." (solved by running the command 'fsck -M /dev/sda1'; '/dev/sda1' is where my root is mounted on) enter image description here



Things that I have tried:



1) https://askubuntu.com/questions/909719/dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-linux-ge



Note: Before upgrading I have marked as hold some packages related to mariadb to avoid some conflicts due to unmet dependencies when upgrading.



Output:



rafa@ubuntu:~$ sudo apt update
Hit:1 http://tedeco.fi.upm.es/mirror/mariadb/repo/10.0/ubuntu xenial
InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Ign:5 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109
kB]
Err:7 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty Release
404 Not Found
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107
kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11
Metadata [67.7 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64
Icons [72.3 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64
DEP-
11 Metadata [108 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11
64x64 Icons [150 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-
11 Metadata [320 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11
64x64 Icons [231 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64
DEP-11 Metadata [247 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11
64x64 Icons [333 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64
DEP-11 Metadata [5,960 B]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-
11 64x64 Icons [14.3 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64
DEP-11 Metadata [3,328 B]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64
DEP-11 Metadata [5,104 B]
Reading package lists... Done
E: The repository 'http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu
trusty Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is
therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user
configuration details.
rafa@ubuntu:~$ sudo apt-mark hold mariadb*

mariadb-common set on hold.
mariadb-client-10.0 set on hold.
mariadb-server set on hold.
mariadb-client set on hold.
mariadb-client-core-10.0 set on hold.
mariadb-server-10.0 set on hold.
mariadb-plugin-connect set on hold.
mariadb-galera-server-10.0 set on hold.
mariadb-connect-engine-10.0 set on hold.
mariadb-plugin-mroonga set on hold.
mariadb-plugin-oqgraph set on hold.
mariadb-oqgraph-engine-10.0 set on hold.
mariadb-plugin-spider set on hold.
mariadb-plugin-tokudb set on hold.
mariadb-server-core-10.0 set on hold.
mariadb-galera-server set on hold.
mariadb-test set on hold.
mariadb-test-data set on hold.
mariadb-test-10.0 set on hold.
mariadb-galera-test set on hold.
mariadb-galera-test-10.0 set on hold.
mariadb-client-10.0-dbgsym set on hold.
mariadb-client-core-10.0-dbgsym set on hold.
mariadb-connect-engine-10.0-dbgsym set on hold.
mariadb-galera-server-10.0-dbgsym set on hold.
mariadb-galera-test-10.0-dbgsym set on hold.
mariadb-oqgraph-engine-10.0-dbgsym set on hold.
mariadb-server-10.0-dbgsym set on hold.
mariadb-server-core-10.0-dbgsym set on hold.
mariadb-test-10.0-dbgsym set on hold.

rafa@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer
required:
libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libdrm-common libllvm6.0 libqmi-glib5
The following packages have been kept back:
mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-
server mariadb-server-10.0 mariadb-server-core-10.0
The following packages will be upgraded:
amd64-microcode apparmor appstream apt apt-transport-https apt-utils
avahi-autoipd avahi-daemon avahi-utils base-files bind9-host binutils
bsdutils console-setup console-setup-linux
desktop-file-utils dnsutils dpkg fonts-opensymbol friendly-recovery
fwupd fwupdate fwupdate-signed ghostscript ghostscript-x gir1.2-
gdkpixbuf-2.0 gir1.2-packagekitglib-1.0
gnome-accessibility-themes gnome-software gnome-software-common gnome-
themes-standard gnome-themes-standard-data grub-common grub-pc grub-pc-
bin grub2-common gtk2-engines-pixbuf gvfs
gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-fuse gvfs-libs
hdparm hicolor-icon-theme ifupdown initramfs-tools initramfs-tools-bin
initramfs-tools-core iproute2 isc-dhcp-client
isc-dhcp-common keyboard-configuration klibc-utils libapparmor-perl
libapparmor1 libappstream-glib8 libappstream3 libapt-inst2.0 libapt-
pkg5.0 libaudit-common libaudit1 libavahi-client3
libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
libbind9-140 libblkid1 libcryptsetup4 libdfu1 libdns-export162 libdns162
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libdrm2 libegl1-mesa libfdisk1 libfwup0 libfwupd1 libgbm1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-
glx libglapi-mesa libglib2.0-0
libglib2.0-bin libglib2.0-data libgnutls-openssl27 libgnutls30 libgs9
libgs9-common libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libisc-
export160 libisc160 libisccc140 libisccfg140 libklibc
liblcms2-2 liblcms2-utils libldap-2.4-2 liblwres141 libmbim-glib4
libmbim-proxy libmm-glib0 libmount1 libnm-glib-vpn1 libnm-glib4 libnm-
gtk-common libnm-gtk0 libnm-util2 libnm0
libnma-common libnma0 libopencv-core2.4v5 libopencv-imgproc2.4v5
libpackagekit-glib2-16 libpam-modules libpam-modules-bin libpam-runtime
libpam-systemd libpam0g libparted2 libpci3
libplymouth4 libpulse-mainloop-glib0 libpulse0 libpulsedsp libpython-
stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libqmi-
proxy libreoffice-base-core libreoffice-calc
libreoffice-common libreoffice-core libreoffice-gtk libreoffice-math
libreoffice-style-elementary libreoffice-style-galaxy libreoffice-writer
libseccomp2 libslang2 libsmartcols1
libsmbclient libsnapd-glib1 libsnmp-base libsnmp30 libsystemd0 libudev1
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9
libuuid1 libva1 libwayland-egl1-mesa
libxatracker2 linux-firmware linux-libc-dev logrotate lshw mesa-vdpau-
drivers modemmanager mount mysql-common network-manager network-manager-
gnome oracle-java8-installer
oracle-java8-set-default parted pciutils plymouth plymouth-label
plymouth-theme-ubuntu-text pulseaudio pulseaudio-module-x11 pulseaudio-
utils python python-apt-common python-minimal
python2.7 python2.7-minimal python3-apt python3-uno python3-update-
manager python3-urllib3 resolvconf rfkill samba-libs shared-mime-info
snapd snapd-login-service squashfs-tools systemd
systemd-sysv ubuntu-core-launcher ubuntu-minimal ubuntu-mono ubuntu-
standard udev unattended-upgrades uno-libs3 update-manager update-
manager-core update-notifier update-notifier-common
ure util-linux uuid-runtime va-driver-all wireless-regdb x11-common xdg-
user-dirs xorg xserver-common xserver-xorg-core-hwe-16.04 xserver-xorg-
legacy-hwe-16.04
xserver-xorg-video-amdgpu-hwe-16.04 xserver-xorg-video-ati-hwe-16.04
xserver-xorg-video-intel-hwe-16.04 xserver-xorg-video-nouveau-hwe-16.04
xserver-xorg-video-radeon-hwe-16.04
230 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 213 MB/223 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

...
(All the Get requests)
...

Fetched 213 MB in 8min 44s (406 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration
file
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


The most important part is the last:



 dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


2) Reboot



3) Install the package linux-headers-4.15.0-34-generic



4) Install the package linux-headers-generic-hwe-16.04



5) Install the package linux-modules-4.15.0-generic



6) Reinstall those packages using the command 'sudo apt/apt-get install --reinstall package_name'



7) I have checked that anything I try to do with the apt/apt-get command, I can't uninstall some package without getting the error 'Read only file system'.



Example: To remove the snapd package:



(reportingApp) rafa@ubuntu:~/Documents/projects/reporting/reporting_project$ 
sudo apt-get autoremove --purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
snapd* ubuntu-core-launcher*
0 upgraded, 0 newly installed, 2 to remove and 234 not upgraded.
After this operation, 57.9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only file
system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - pkgDPkgPM::Go
(30: Read-only file system)


How can I solve this error?










share|improve this question



















  • 1




    "Read-only file system"
    – Ipor Sircer
    Sep 25 at 15:27










  • Did you remount the root file system as rw after running fsck in the busybox environment?
    – eyoung100
    Sep 25 at 17:19










  • @eyoung100 No, I didn't. Thanks for your response. I will try it.
    – Rafael VC
    Sep 26 at 7:24










  • If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
    – telcoM
    Sep 26 at 7:58










  • @telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
    – Rafael VC
    Sep 26 at 15:41














up vote
0
down vote

favorite












I am trying to expand the size of one of the virtual machines I use. For that reason, I need to install the pvcreate command to be able of creating a physical volume.



When I try to install it, I get the following errors:Errors



Notes:



Reading the output and looking for some information and other questions like this one, I understand I need to update the operating system, but I can't manage do it.



Errors that I have encountered:



1) "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." (solved)



2) Read-only file system enter image description here



3) "Unexpected inconsistency. Run fsck manually." (solved by running the command 'fsck -M /dev/sda1'; '/dev/sda1' is where my root is mounted on) enter image description here



Things that I have tried:



1) https://askubuntu.com/questions/909719/dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-linux-ge



Note: Before upgrading I have marked as hold some packages related to mariadb to avoid some conflicts due to unmet dependencies when upgrading.



Output:



rafa@ubuntu:~$ sudo apt update
Hit:1 http://tedeco.fi.upm.es/mirror/mariadb/repo/10.0/ubuntu xenial
InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Ign:5 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109
kB]
Err:7 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty Release
404 Not Found
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107
kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11
Metadata [67.7 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64
Icons [72.3 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64
DEP-
11 Metadata [108 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11
64x64 Icons [150 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-
11 Metadata [320 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11
64x64 Icons [231 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64
DEP-11 Metadata [247 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11
64x64 Icons [333 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64
DEP-11 Metadata [5,960 B]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-
11 64x64 Icons [14.3 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64
DEP-11 Metadata [3,328 B]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64
DEP-11 Metadata [5,104 B]
Reading package lists... Done
E: The repository 'http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu
trusty Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is
therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user
configuration details.
rafa@ubuntu:~$ sudo apt-mark hold mariadb*

mariadb-common set on hold.
mariadb-client-10.0 set on hold.
mariadb-server set on hold.
mariadb-client set on hold.
mariadb-client-core-10.0 set on hold.
mariadb-server-10.0 set on hold.
mariadb-plugin-connect set on hold.
mariadb-galera-server-10.0 set on hold.
mariadb-connect-engine-10.0 set on hold.
mariadb-plugin-mroonga set on hold.
mariadb-plugin-oqgraph set on hold.
mariadb-oqgraph-engine-10.0 set on hold.
mariadb-plugin-spider set on hold.
mariadb-plugin-tokudb set on hold.
mariadb-server-core-10.0 set on hold.
mariadb-galera-server set on hold.
mariadb-test set on hold.
mariadb-test-data set on hold.
mariadb-test-10.0 set on hold.
mariadb-galera-test set on hold.
mariadb-galera-test-10.0 set on hold.
mariadb-client-10.0-dbgsym set on hold.
mariadb-client-core-10.0-dbgsym set on hold.
mariadb-connect-engine-10.0-dbgsym set on hold.
mariadb-galera-server-10.0-dbgsym set on hold.
mariadb-galera-test-10.0-dbgsym set on hold.
mariadb-oqgraph-engine-10.0-dbgsym set on hold.
mariadb-server-10.0-dbgsym set on hold.
mariadb-server-core-10.0-dbgsym set on hold.
mariadb-test-10.0-dbgsym set on hold.

rafa@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer
required:
libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libdrm-common libllvm6.0 libqmi-glib5
The following packages have been kept back:
mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-
server mariadb-server-10.0 mariadb-server-core-10.0
The following packages will be upgraded:
amd64-microcode apparmor appstream apt apt-transport-https apt-utils
avahi-autoipd avahi-daemon avahi-utils base-files bind9-host binutils
bsdutils console-setup console-setup-linux
desktop-file-utils dnsutils dpkg fonts-opensymbol friendly-recovery
fwupd fwupdate fwupdate-signed ghostscript ghostscript-x gir1.2-
gdkpixbuf-2.0 gir1.2-packagekitglib-1.0
gnome-accessibility-themes gnome-software gnome-software-common gnome-
themes-standard gnome-themes-standard-data grub-common grub-pc grub-pc-
bin grub2-common gtk2-engines-pixbuf gvfs
gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-fuse gvfs-libs
hdparm hicolor-icon-theme ifupdown initramfs-tools initramfs-tools-bin
initramfs-tools-core iproute2 isc-dhcp-client
isc-dhcp-common keyboard-configuration klibc-utils libapparmor-perl
libapparmor1 libappstream-glib8 libappstream3 libapt-inst2.0 libapt-
pkg5.0 libaudit-common libaudit1 libavahi-client3
libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
libbind9-140 libblkid1 libcryptsetup4 libdfu1 libdns-export162 libdns162
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libdrm2 libegl1-mesa libfdisk1 libfwup0 libfwupd1 libgbm1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-
glx libglapi-mesa libglib2.0-0
libglib2.0-bin libglib2.0-data libgnutls-openssl27 libgnutls30 libgs9
libgs9-common libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libisc-
export160 libisc160 libisccc140 libisccfg140 libklibc
liblcms2-2 liblcms2-utils libldap-2.4-2 liblwres141 libmbim-glib4
libmbim-proxy libmm-glib0 libmount1 libnm-glib-vpn1 libnm-glib4 libnm-
gtk-common libnm-gtk0 libnm-util2 libnm0
libnma-common libnma0 libopencv-core2.4v5 libopencv-imgproc2.4v5
libpackagekit-glib2-16 libpam-modules libpam-modules-bin libpam-runtime
libpam-systemd libpam0g libparted2 libpci3
libplymouth4 libpulse-mainloop-glib0 libpulse0 libpulsedsp libpython-
stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libqmi-
proxy libreoffice-base-core libreoffice-calc
libreoffice-common libreoffice-core libreoffice-gtk libreoffice-math
libreoffice-style-elementary libreoffice-style-galaxy libreoffice-writer
libseccomp2 libslang2 libsmartcols1
libsmbclient libsnapd-glib1 libsnmp-base libsnmp30 libsystemd0 libudev1
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9
libuuid1 libva1 libwayland-egl1-mesa
libxatracker2 linux-firmware linux-libc-dev logrotate lshw mesa-vdpau-
drivers modemmanager mount mysql-common network-manager network-manager-
gnome oracle-java8-installer
oracle-java8-set-default parted pciutils plymouth plymouth-label
plymouth-theme-ubuntu-text pulseaudio pulseaudio-module-x11 pulseaudio-
utils python python-apt-common python-minimal
python2.7 python2.7-minimal python3-apt python3-uno python3-update-
manager python3-urllib3 resolvconf rfkill samba-libs shared-mime-info
snapd snapd-login-service squashfs-tools systemd
systemd-sysv ubuntu-core-launcher ubuntu-minimal ubuntu-mono ubuntu-
standard udev unattended-upgrades uno-libs3 update-manager update-
manager-core update-notifier update-notifier-common
ure util-linux uuid-runtime va-driver-all wireless-regdb x11-common xdg-
user-dirs xorg xserver-common xserver-xorg-core-hwe-16.04 xserver-xorg-
legacy-hwe-16.04
xserver-xorg-video-amdgpu-hwe-16.04 xserver-xorg-video-ati-hwe-16.04
xserver-xorg-video-intel-hwe-16.04 xserver-xorg-video-nouveau-hwe-16.04
xserver-xorg-video-radeon-hwe-16.04
230 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 213 MB/223 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

...
(All the Get requests)
...

Fetched 213 MB in 8min 44s (406 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration
file
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


The most important part is the last:



 dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


2) Reboot



3) Install the package linux-headers-4.15.0-34-generic



4) Install the package linux-headers-generic-hwe-16.04



5) Install the package linux-modules-4.15.0-generic



6) Reinstall those packages using the command 'sudo apt/apt-get install --reinstall package_name'



7) I have checked that anything I try to do with the apt/apt-get command, I can't uninstall some package without getting the error 'Read only file system'.



Example: To remove the snapd package:



(reportingApp) rafa@ubuntu:~/Documents/projects/reporting/reporting_project$ 
sudo apt-get autoremove --purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
snapd* ubuntu-core-launcher*
0 upgraded, 0 newly installed, 2 to remove and 234 not upgraded.
After this operation, 57.9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only file
system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - pkgDPkgPM::Go
(30: Read-only file system)


How can I solve this error?










share|improve this question



















  • 1




    "Read-only file system"
    – Ipor Sircer
    Sep 25 at 15:27










  • Did you remount the root file system as rw after running fsck in the busybox environment?
    – eyoung100
    Sep 25 at 17:19










  • @eyoung100 No, I didn't. Thanks for your response. I will try it.
    – Rafael VC
    Sep 26 at 7:24










  • If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
    – telcoM
    Sep 26 at 7:58










  • @telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
    – Rafael VC
    Sep 26 at 15:41












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to expand the size of one of the virtual machines I use. For that reason, I need to install the pvcreate command to be able of creating a physical volume.



When I try to install it, I get the following errors:Errors



Notes:



Reading the output and looking for some information and other questions like this one, I understand I need to update the operating system, but I can't manage do it.



Errors that I have encountered:



1) "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." (solved)



2) Read-only file system enter image description here



3) "Unexpected inconsistency. Run fsck manually." (solved by running the command 'fsck -M /dev/sda1'; '/dev/sda1' is where my root is mounted on) enter image description here



Things that I have tried:



1) https://askubuntu.com/questions/909719/dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-linux-ge



Note: Before upgrading I have marked as hold some packages related to mariadb to avoid some conflicts due to unmet dependencies when upgrading.



Output:



rafa@ubuntu:~$ sudo apt update
Hit:1 http://tedeco.fi.upm.es/mirror/mariadb/repo/10.0/ubuntu xenial
InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Ign:5 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109
kB]
Err:7 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty Release
404 Not Found
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107
kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11
Metadata [67.7 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64
Icons [72.3 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64
DEP-
11 Metadata [108 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11
64x64 Icons [150 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-
11 Metadata [320 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11
64x64 Icons [231 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64
DEP-11 Metadata [247 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11
64x64 Icons [333 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64
DEP-11 Metadata [5,960 B]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-
11 64x64 Icons [14.3 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64
DEP-11 Metadata [3,328 B]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64
DEP-11 Metadata [5,104 B]
Reading package lists... Done
E: The repository 'http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu
trusty Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is
therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user
configuration details.
rafa@ubuntu:~$ sudo apt-mark hold mariadb*

mariadb-common set on hold.
mariadb-client-10.0 set on hold.
mariadb-server set on hold.
mariadb-client set on hold.
mariadb-client-core-10.0 set on hold.
mariadb-server-10.0 set on hold.
mariadb-plugin-connect set on hold.
mariadb-galera-server-10.0 set on hold.
mariadb-connect-engine-10.0 set on hold.
mariadb-plugin-mroonga set on hold.
mariadb-plugin-oqgraph set on hold.
mariadb-oqgraph-engine-10.0 set on hold.
mariadb-plugin-spider set on hold.
mariadb-plugin-tokudb set on hold.
mariadb-server-core-10.0 set on hold.
mariadb-galera-server set on hold.
mariadb-test set on hold.
mariadb-test-data set on hold.
mariadb-test-10.0 set on hold.
mariadb-galera-test set on hold.
mariadb-galera-test-10.0 set on hold.
mariadb-client-10.0-dbgsym set on hold.
mariadb-client-core-10.0-dbgsym set on hold.
mariadb-connect-engine-10.0-dbgsym set on hold.
mariadb-galera-server-10.0-dbgsym set on hold.
mariadb-galera-test-10.0-dbgsym set on hold.
mariadb-oqgraph-engine-10.0-dbgsym set on hold.
mariadb-server-10.0-dbgsym set on hold.
mariadb-server-core-10.0-dbgsym set on hold.
mariadb-test-10.0-dbgsym set on hold.

rafa@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer
required:
libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libdrm-common libllvm6.0 libqmi-glib5
The following packages have been kept back:
mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-
server mariadb-server-10.0 mariadb-server-core-10.0
The following packages will be upgraded:
amd64-microcode apparmor appstream apt apt-transport-https apt-utils
avahi-autoipd avahi-daemon avahi-utils base-files bind9-host binutils
bsdutils console-setup console-setup-linux
desktop-file-utils dnsutils dpkg fonts-opensymbol friendly-recovery
fwupd fwupdate fwupdate-signed ghostscript ghostscript-x gir1.2-
gdkpixbuf-2.0 gir1.2-packagekitglib-1.0
gnome-accessibility-themes gnome-software gnome-software-common gnome-
themes-standard gnome-themes-standard-data grub-common grub-pc grub-pc-
bin grub2-common gtk2-engines-pixbuf gvfs
gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-fuse gvfs-libs
hdparm hicolor-icon-theme ifupdown initramfs-tools initramfs-tools-bin
initramfs-tools-core iproute2 isc-dhcp-client
isc-dhcp-common keyboard-configuration klibc-utils libapparmor-perl
libapparmor1 libappstream-glib8 libappstream3 libapt-inst2.0 libapt-
pkg5.0 libaudit-common libaudit1 libavahi-client3
libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
libbind9-140 libblkid1 libcryptsetup4 libdfu1 libdns-export162 libdns162
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libdrm2 libegl1-mesa libfdisk1 libfwup0 libfwupd1 libgbm1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-
glx libglapi-mesa libglib2.0-0
libglib2.0-bin libglib2.0-data libgnutls-openssl27 libgnutls30 libgs9
libgs9-common libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libisc-
export160 libisc160 libisccc140 libisccfg140 libklibc
liblcms2-2 liblcms2-utils libldap-2.4-2 liblwres141 libmbim-glib4
libmbim-proxy libmm-glib0 libmount1 libnm-glib-vpn1 libnm-glib4 libnm-
gtk-common libnm-gtk0 libnm-util2 libnm0
libnma-common libnma0 libopencv-core2.4v5 libopencv-imgproc2.4v5
libpackagekit-glib2-16 libpam-modules libpam-modules-bin libpam-runtime
libpam-systemd libpam0g libparted2 libpci3
libplymouth4 libpulse-mainloop-glib0 libpulse0 libpulsedsp libpython-
stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libqmi-
proxy libreoffice-base-core libreoffice-calc
libreoffice-common libreoffice-core libreoffice-gtk libreoffice-math
libreoffice-style-elementary libreoffice-style-galaxy libreoffice-writer
libseccomp2 libslang2 libsmartcols1
libsmbclient libsnapd-glib1 libsnmp-base libsnmp30 libsystemd0 libudev1
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9
libuuid1 libva1 libwayland-egl1-mesa
libxatracker2 linux-firmware linux-libc-dev logrotate lshw mesa-vdpau-
drivers modemmanager mount mysql-common network-manager network-manager-
gnome oracle-java8-installer
oracle-java8-set-default parted pciutils plymouth plymouth-label
plymouth-theme-ubuntu-text pulseaudio pulseaudio-module-x11 pulseaudio-
utils python python-apt-common python-minimal
python2.7 python2.7-minimal python3-apt python3-uno python3-update-
manager python3-urllib3 resolvconf rfkill samba-libs shared-mime-info
snapd snapd-login-service squashfs-tools systemd
systemd-sysv ubuntu-core-launcher ubuntu-minimal ubuntu-mono ubuntu-
standard udev unattended-upgrades uno-libs3 update-manager update-
manager-core update-notifier update-notifier-common
ure util-linux uuid-runtime va-driver-all wireless-regdb x11-common xdg-
user-dirs xorg xserver-common xserver-xorg-core-hwe-16.04 xserver-xorg-
legacy-hwe-16.04
xserver-xorg-video-amdgpu-hwe-16.04 xserver-xorg-video-ati-hwe-16.04
xserver-xorg-video-intel-hwe-16.04 xserver-xorg-video-nouveau-hwe-16.04
xserver-xorg-video-radeon-hwe-16.04
230 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 213 MB/223 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

...
(All the Get requests)
...

Fetched 213 MB in 8min 44s (406 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration
file
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


The most important part is the last:



 dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


2) Reboot



3) Install the package linux-headers-4.15.0-34-generic



4) Install the package linux-headers-generic-hwe-16.04



5) Install the package linux-modules-4.15.0-generic



6) Reinstall those packages using the command 'sudo apt/apt-get install --reinstall package_name'



7) I have checked that anything I try to do with the apt/apt-get command, I can't uninstall some package without getting the error 'Read only file system'.



Example: To remove the snapd package:



(reportingApp) rafa@ubuntu:~/Documents/projects/reporting/reporting_project$ 
sudo apt-get autoremove --purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
snapd* ubuntu-core-launcher*
0 upgraded, 0 newly installed, 2 to remove and 234 not upgraded.
After this operation, 57.9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only file
system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - pkgDPkgPM::Go
(30: Read-only file system)


How can I solve this error?










share|improve this question















I am trying to expand the size of one of the virtual machines I use. For that reason, I need to install the pvcreate command to be able of creating a physical volume.



When I try to install it, I get the following errors:Errors



Notes:



Reading the output and looking for some information and other questions like this one, I understand I need to update the operating system, but I can't manage do it.



Errors that I have encountered:



1) "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." (solved)



2) Read-only file system enter image description here



3) "Unexpected inconsistency. Run fsck manually." (solved by running the command 'fsck -M /dev/sda1'; '/dev/sda1' is where my root is mounted on) enter image description here



Things that I have tried:



1) https://askubuntu.com/questions/909719/dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-linux-ge



Note: Before upgrading I have marked as hold some packages related to mariadb to avoid some conflicts due to unmet dependencies when upgrading.



Output:



rafa@ubuntu:~$ sudo apt update
Hit:1 http://tedeco.fi.upm.es/mirror/mariadb/repo/10.0/ubuntu xenial
InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Ign:5 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109
kB]
Err:7 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu trusty Release
404 Not Found
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107
kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11
Metadata [67.7 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64
Icons [72.3 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64
DEP-
11 Metadata [108 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11
64x64 Icons [150 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-
11 Metadata [320 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11
64x64 Icons [231 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64
DEP-11 Metadata [247 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11
64x64 Icons [333 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64
DEP-11 Metadata [5,960 B]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-
11 64x64 Icons [14.3 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64
DEP-11 Metadata [3,328 B]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64
DEP-11 Metadata [5,104 B]
Reading package lists... Done
E: The repository 'http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu
trusty Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is
therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user
configuration details.
rafa@ubuntu:~$ sudo apt-mark hold mariadb*

mariadb-common set on hold.
mariadb-client-10.0 set on hold.
mariadb-server set on hold.
mariadb-client set on hold.
mariadb-client-core-10.0 set on hold.
mariadb-server-10.0 set on hold.
mariadb-plugin-connect set on hold.
mariadb-galera-server-10.0 set on hold.
mariadb-connect-engine-10.0 set on hold.
mariadb-plugin-mroonga set on hold.
mariadb-plugin-oqgraph set on hold.
mariadb-oqgraph-engine-10.0 set on hold.
mariadb-plugin-spider set on hold.
mariadb-plugin-tokudb set on hold.
mariadb-server-core-10.0 set on hold.
mariadb-galera-server set on hold.
mariadb-test set on hold.
mariadb-test-data set on hold.
mariadb-test-10.0 set on hold.
mariadb-galera-test set on hold.
mariadb-galera-test-10.0 set on hold.
mariadb-client-10.0-dbgsym set on hold.
mariadb-client-core-10.0-dbgsym set on hold.
mariadb-connect-engine-10.0-dbgsym set on hold.
mariadb-galera-server-10.0-dbgsym set on hold.
mariadb-galera-test-10.0-dbgsym set on hold.
mariadb-oqgraph-engine-10.0-dbgsym set on hold.
mariadb-server-10.0-dbgsym set on hold.
mariadb-server-core-10.0-dbgsym set on hold.
mariadb-test-10.0-dbgsym set on hold.

rafa@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer
required:
libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libdrm-common libllvm6.0 libqmi-glib5
The following packages have been kept back:
mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-
server mariadb-server-10.0 mariadb-server-core-10.0
The following packages will be upgraded:
amd64-microcode apparmor appstream apt apt-transport-https apt-utils
avahi-autoipd avahi-daemon avahi-utils base-files bind9-host binutils
bsdutils console-setup console-setup-linux
desktop-file-utils dnsutils dpkg fonts-opensymbol friendly-recovery
fwupd fwupdate fwupdate-signed ghostscript ghostscript-x gir1.2-
gdkpixbuf-2.0 gir1.2-packagekitglib-1.0
gnome-accessibility-themes gnome-software gnome-software-common gnome-
themes-standard gnome-themes-standard-data grub-common grub-pc grub-pc-
bin grub2-common gtk2-engines-pixbuf gvfs
gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-fuse gvfs-libs
hdparm hicolor-icon-theme ifupdown initramfs-tools initramfs-tools-bin
initramfs-tools-core iproute2 isc-dhcp-client
isc-dhcp-common keyboard-configuration klibc-utils libapparmor-perl
libapparmor1 libappstream-glib8 libappstream3 libapt-inst2.0 libapt-
pkg5.0 libaudit-common libaudit1 libavahi-client3
libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
libbind9-140 libblkid1 libcryptsetup4 libdfu1 libdns-export162 libdns162
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libdrm2 libegl1-mesa libfdisk1 libfwup0 libfwupd1 libgbm1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-
glx libglapi-mesa libglib2.0-0
libglib2.0-bin libglib2.0-data libgnutls-openssl27 libgnutls30 libgs9
libgs9-common libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libisc-
export160 libisc160 libisccc140 libisccfg140 libklibc
liblcms2-2 liblcms2-utils libldap-2.4-2 liblwres141 libmbim-glib4
libmbim-proxy libmm-glib0 libmount1 libnm-glib-vpn1 libnm-glib4 libnm-
gtk-common libnm-gtk0 libnm-util2 libnm0
libnma-common libnma0 libopencv-core2.4v5 libopencv-imgproc2.4v5
libpackagekit-glib2-16 libpam-modules libpam-modules-bin libpam-runtime
libpam-systemd libpam0g libparted2 libpci3
libplymouth4 libpulse-mainloop-glib0 libpulse0 libpulsedsp libpython-
stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libqmi-
proxy libreoffice-base-core libreoffice-calc
libreoffice-common libreoffice-core libreoffice-gtk libreoffice-math
libreoffice-style-elementary libreoffice-style-galaxy libreoffice-writer
libseccomp2 libslang2 libsmartcols1
libsmbclient libsnapd-glib1 libsnmp-base libsnmp30 libsystemd0 libudev1
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9
libuuid1 libva1 libwayland-egl1-mesa
libxatracker2 linux-firmware linux-libc-dev logrotate lshw mesa-vdpau-
drivers modemmanager mount mysql-common network-manager network-manager-
gnome oracle-java8-installer
oracle-java8-set-default parted pciutils plymouth plymouth-label
plymouth-theme-ubuntu-text pulseaudio pulseaudio-module-x11 pulseaudio-
utils python python-apt-common python-minimal
python2.7 python2.7-minimal python3-apt python3-uno python3-update-
manager python3-urllib3 resolvconf rfkill samba-libs shared-mime-info
snapd snapd-login-service squashfs-tools systemd
systemd-sysv ubuntu-core-launcher ubuntu-minimal ubuntu-mono ubuntu-
standard udev unattended-upgrades uno-libs3 update-manager update-
manager-core update-notifier update-notifier-common
ure util-linux uuid-runtime va-driver-all wireless-regdb x11-common xdg-
user-dirs xorg xserver-common xserver-xorg-core-hwe-16.04 xserver-xorg-
legacy-hwe-16.04
xserver-xorg-video-amdgpu-hwe-16.04 xserver-xorg-video-ati-hwe-16.04
xserver-xorg-video-intel-hwe-16.04 xserver-xorg-video-nouveau-hwe-16.04
xserver-xorg-video-radeon-hwe-16.04
230 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 213 MB/223 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

...
(All the Get requests)
...

Fetched 213 MB in 8min 44s (406 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration
file
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


The most important part is the last:



 dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only
file system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin -
pkgDPkgPM::Go (30: Read-only file system)


2) Reboot



3) Install the package linux-headers-4.15.0-34-generic



4) Install the package linux-headers-generic-hwe-16.04



5) Install the package linux-modules-4.15.0-generic



6) Reinstall those packages using the command 'sudo apt/apt-get install --reinstall package_name'



7) I have checked that anything I try to do with the apt/apt-get command, I can't uninstall some package without getting the error 'Read only file system'.



Example: To remove the snapd package:



(reportingApp) rafa@ubuntu:~/Documents/projects/reporting/reporting_project$ 
sudo apt-get autoremove --purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
snapd* ubuntu-core-launcher*
0 upgraded, 0 newly installed, 2 to remove and 234 not upgraded.
After this operation, 57.9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic-hwe-
16.04': Structure needs cleaning
touch: cannot touch '/var/lib/update-notifier/dpkg-run-stamp': Read-only file
system
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - pkgDPkgPM::Go
(30: Read-only file system)


How can I solve this error?







ubuntu dpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 1 at 21:48









Jeff Schaller

33.3k850112




33.3k850112










asked Sep 25 at 15:18









Rafael VC

62




62







  • 1




    "Read-only file system"
    – Ipor Sircer
    Sep 25 at 15:27










  • Did you remount the root file system as rw after running fsck in the busybox environment?
    – eyoung100
    Sep 25 at 17:19










  • @eyoung100 No, I didn't. Thanks for your response. I will try it.
    – Rafael VC
    Sep 26 at 7:24










  • If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
    – telcoM
    Sep 26 at 7:58










  • @telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
    – Rafael VC
    Sep 26 at 15:41












  • 1




    "Read-only file system"
    – Ipor Sircer
    Sep 25 at 15:27










  • Did you remount the root file system as rw after running fsck in the busybox environment?
    – eyoung100
    Sep 25 at 17:19










  • @eyoung100 No, I didn't. Thanks for your response. I will try it.
    – Rafael VC
    Sep 26 at 7:24










  • If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
    – telcoM
    Sep 26 at 7:58










  • @telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
    – Rafael VC
    Sep 26 at 15:41







1




1




"Read-only file system"
– Ipor Sircer
Sep 25 at 15:27




"Read-only file system"
– Ipor Sircer
Sep 25 at 15:27












Did you remount the root file system as rw after running fsck in the busybox environment?
– eyoung100
Sep 25 at 17:19




Did you remount the root file system as rw after running fsck in the busybox environment?
– eyoung100
Sep 25 at 17:19












@eyoung100 No, I didn't. Thanks for your response. I will try it.
– Rafael VC
Sep 26 at 7:24




@eyoung100 No, I didn't. Thanks for your response. I will try it.
– Rafael VC
Sep 26 at 7:24












If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
– telcoM
Sep 26 at 7:58




If you have to run fsck on the root filesystem, you should always reboot afterwards. Even when the root filesystem is in read-only mode, the kernel may cache parts of its content. Then fsck will make changes to the filesystem while those parts are still cached. If you then switch the filesystem to read/write mode, there is a chance that the kernel ends up updating something in the filesystem based on cached data that is actually stale because fsck changed things. This problem is unique to the root filesystem: other filesystems you can fully unmount for the fsck operation.
– telcoM
Sep 26 at 7:58












@telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
– Rafael VC
Sep 26 at 15:41




@telcoM Thanks for your response. I always reboot after running the fsck command and fix manually all the problems (typing 'y' for yes)
– Rafael VC
Sep 26 at 15:41















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471360%2fcant-install-lvm2-on-ubuntu-16-04%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471360%2fcant-install-lvm2-on-ubuntu-16-04%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay