How to fix ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/gasket-dkms.0.crash' in Ubuntu 22.04 machine?
Hey In my node application I have a INSTALL.sh file where I have the below code :
#!/bin/bash
ARCH=$(uname -m)
if [ -x "$(command -v apt)" ]; then
echo "Install Coral TPU Drivers?"
echo "(y)es or (N)o"
read installTheStuffHomie
if [ "$installTheStuffHomie" = "y" ] || [ "$installTheStuffHomie" = "Y" ]; then
echo "Installing Coral TPU Drivers..."
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update -y
sudo apt-get install gasket-dkms libedgetpu1-std -y
sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"
sudo groupadd apex
sudo adduser $USER apex
sudo apt-get install zlib1g-dev libjpeg-dev libpng-dev -y
sudo apt-get install python3-pip -y
pip3 install Cython
pip3 install Pillow==9.5.0
if [ "$ARCH" = "x86_64" ]; then
# for x86/x64
echo "x86/x64 tflite runtime Installing..."
wget https://cdn.shinobi.video/installers/python3/2023-10-12/tflite_runtime-2.5.0.post1-cp310-cp310-linux_x86_64.whl
pip3 install tflite_runtime-2.5.0.post1-cp310-cp310-linux_x86_64.whl
rm tflite_runtime-2.5.0.post1-cp310-cp310-linux_x86_64.whl
elif [ "$ARCH" = "aarch64" ]; then
# for arm
echo "AARCH64 tflite runtime Installing..."
wget https://cdn.shinobi.video/installers/python3/2023-10-12/tflite_runtime-2.5.0-cp310-cp310-linux_aarch64.whl
pip3 install tflite_runtime-2.5.0-cp310-cp310-linux_aarch64.whl
rm tflite_runtime-2.5.0-cp310-cp310-linux_aarch64.whl
else
echo "Architecture : $ARCH"
echo "Trying to install tflite runtime from apt..."
sudo apt-get install python3-pycoral -y
pip3 install --extra-index-url https://google-coral.github.io/py-repo/ pycoral
fi
# for both x86/x64 and arm
wget https://cdn.shinobi.video/installers/python3/2023-10-12/pycoral-2.0.0-cp310-cp310-linux_x86_64.whl
pip3 install pycoral-2.0.0-cp310-cp310-linux_x86_64.whl
rm pycoral-2.0.0-cp310-cp310-linux_x86_64.whl
chown root:apex /dev/apex_0 && chmod 777 /dev/apex_0
echo "------------------------------"
echo "Reboot is required. Do it now?"
echo "------------------------------"
echo "(y)es or (N)o. Default is No."
read rebootTheMachineHomie
if [ "$rebootTheMachineHomie" = "y" ] || [ "$rebootTheMachineHomie" = "Y" ]; then
sudo reboot
fi
fi
else
echo "Debian based systems can only install this driver. Try Ubuntu 22.04.3."
fi
For testing it's working, I run the choose to run the file by clicking y in UI and it starts to get downloading. But When the gasket-dkms
package portion comes it gets failed and throws error as below:
The following NEW packages will be installed:
gasket-dkms
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/48.0 kB of archives.
After this operation, 256 kB of additional disk space will be used.
Selecting previously unselected package gasket-dkms.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 285272 files and directories currently installed.)
Preparing to unpack .../gasket-dkms_1.0-18_all.deb ...
Unpacking gasket-dkms (1.0-18) ...
Setting up gasket-dkms (1.0-18) ...
Loading new gasket-1.0 DKMS files...
Building for 6.5.0-26-generic 6.5.0-27-generic
Building initial module for 6.5.0-26-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/gasket-dkms.0.crash'
Error! Bad return status for module build on kernel: 6.5.0-26-generic (x86_64)
Consult /var/lib/dkms/gasket/1.0/build/make.log for more information.
dpkg: error processing package gasket-dkms (--configure):
installed gasket-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
gasket-dkms
The user `root' is already a member of `apex'.
Reading package lists...
As per suggestions given, I have seen the make.log
file using the below command:
cat /var/lib/dkms/gasket/1.0/build/make.log
The below is the result:
DKMS make.log for gasket-1.0 for kernel 6.5.0-27-generic (x86_64)
Wednesday 10 April 2024 12:31:12 PM IST
make: Entering directory '/usr/src/linux-headers-6.5.0-27-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
CC [M] /var/lib/dkms/gasket/1.0/build/gasket_core.o
CC [M] /var/lib/dkms/gasket/1.0/build/gasket_ioctl.o
CC [M] /var/lib/dkms/gasket/1.0/build/gasket_interrupt.o
CC [M] /var/lib/dkms/gasket/1.0/build/gasket_page_table.o
CC [M] /var/lib/dkms/gasket/1.0/build/gasket_sysfs.o
CC [M] /var/lib/dkms/gasket/1.0/build/apex_driver.o
/var/lib/dkms/gasket/1.0/build/gasket_core.c: In function ‘gasket_register_device’:
/var/lib/dkms/gasket/1.0/build/gasket_core.c:1841:41: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
1841 | class_create(driver_desc->module, driver_desc->name);
| ~~~~~~~~~~~^~~~~~~~
| |
| struct module *
In file included from ./include/linux/device.h:31,
from ./include/linux/cdev.h:8,
from /var/lib/dkms/gasket/1.0/build/gasket_core.h:11,
from /var/lib/dkms/gasket/1.0/build/gasket_core.c:12:
./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
230 | struct class * __must_check class_create(const char *name);
| ~~~~~~~~~~~~^~~~
/var/lib/dkms/gasket/1.0/build/gasket_core.c:1841:17: error: too many arguments to function ‘class_create’
1841 | class_create(driver_desc->module, driver_desc->name);
| ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
230 | struct class * __must_check class_create(const char *name);
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:251: /var/lib/dkms/gasket/1.0/build/gasket_core.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/usr/src/linux-headers-6.5.0-27-generic/Makefile:2039: /var/lib/dkms/gasket/1.0/build] Error 2
make: *** [Makefile:234: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.5.0-27-generic'
I have also tried uninstalling the package using the below command and tried running the INSTALL.sh file again but it didn't work.
sudo apt remove gasket-dkms
I need help to fix this issue. Thanks in advance.
Answers
The error you're encountering during the installation of gasket-dkms
seems to be related to a compatibility issue between the kernel headers and the gasket
driver code. Specifically, the error message indicates a problem with passing arguments to the class_create
function.
Here are a few steps you can take to troubleshoot and potentially resolve this issue:
-
Check Kernel Version: Verify that the kernel version on your system is compatible with the
gasket-dkms
package. It's possible that the package is not compatible with the kernel version you are using. You can check the kernel version using the command:uname -r
-
Update Kernel Headers: Make sure that the kernel headers on your system are up-to-date. You can install the appropriate kernel headers package for your kernel version using the package manager. For example, on Ubuntu, you can use the following command to install the headers for the current kernel:
sudo apt-get install linux-headers-$(uname -r)
-
Check for Driver Updates: Check if there are any updates available for the
gasket
driver or related packages. Sometimes, driver updates include fixes for compatibility issues with specific kernel versions. -
Review Kernel Module Code: If you have access to the source code for the
gasket
driver module (gasket_core.c
in this case), you can review the code and see if there are any compatibility issues with the kernel headers. You may need to modify the code to resolve the compilation errors. -
Contact Support: If you continue to encounter issues, consider reaching out to the maintainers or support channels for the
gasket-dkms
package. They may be able to provide further assistance or guidance on resolving compatibility issues.
By following these steps, you should be able to diagnose and resolve the issue with installing the gasket-dkms
package on your system.