"cat: write error: No space left on device" when I write to a character device using "cat" - linux-device-driver

I am trying to use VS1053, an audio decoder, on Linux 4.14 to play music. This device communicate through SPI bus, and I've developed a driver and registered VS1053 as a character device, thanks for https://github.com/rvp-nl/vs10xx-linux. Here comes the problem.
The way to play music is:
cat musicfile.mp3 > /dev/VS1053_device
When I throw a WAV music file to the device, everything is ok, and music plays well. However, when I throw a mp3 music file to the device, Linux casts an error
cat: write error: No space left on device
I've searched for the reason on many sites. Many said, check free space and free inode on file system, but this is my result:
root#s32v234sbc:~# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/root 956592 10795 945797 2% /
devtmpfs 234285 308 233977 1% /dev
tmpfs 234333 205 234128 1% /run
tmpfs 234333 10 234323 1% /var/volatile
root#s32v234sbc:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 412M 14G 3% /
devtmpfs 916M 0 916M 0% /dev
tmpfs 916M 84K 916M 1% /run
tmpfs 916M 28K 916M 1% /var/volatile
root#s32v234sbc:~#
The music file is limited within 100MB, there is no way that the space is used up.
I tried to write an print file program to substitute "cat", but that doesn't work either. I have no idea why and how this error happened.
I am super grateful if anyone could help me on this!!!

try the below command:
tune2fs -l /dev/VS1053_device | grep -i reserved
And cat is not suitable for the operation you are performing.The MP3 format has all sorts of junk that can lurk at the front and end of the file and this needs to be strippe out.Try with ffmpeg or mp3wrap or aplay

Seems like there is a problem with the driver you are using. When you get "no space left on device" it doesn't mean in this case that the local filesystem is full. Probably it means that there is some problem on local or the other side of the SPI bus. It is possible that the driver you are using receives -ENOSPC status from SPI driver from linux kernel, but your driver doesn't service this error properly. So it will be needed to dig a little into the driver you are using.

Related

Mapping nested device mapper mounts back to their physical drive

Looking for a reliable (and hopefully simple) way to trace a directory in an lvm or other dm mounted fs back to the physical disk it resides on. Goal is to get the model and serial number of the drive no matter where the script wakes up.
Not a problem when the fs mount is on a physical partition, but gets messy when layers of lvm and/or loopbacks are in between. The lsblk tree shows the dm relationships back to /dev/sda in the following example, but wouldn't be very easy or desirable to parse:
# lsblk -po NAME,MODEL,SERIAL,MOUNTPOINT,MAJ:MIN
NAME MODEL SERIAL MOUNTPOINT MAJ:MIN
/dev/loop0 /mnt/test 7:0
/dev/sda AT1000MX500SSD1 21035FEA05B8 8:0
├─/dev/sda1 /boot 8:1
├─/dev/sda2 8:2
└─/dev/sda5 8:5
└─/dev/mapper/sda5_crypt 254:0
├─/dev/mapper/test5--vg-root / 254:1
└─/dev/mapper/test5--vg-swap_1 [SWAP] 254:2
Tried udevadm info, stat and a few other variations, but they all dead end at the device mapper without a way (that I can see) of connecting the dots to the backing disk and it's model/serial number.
Got enough solution by enumerating the base /dev/sd? devices, looping through each one and its partitions with lsblk -ln devpart and looking for the mountpoint in column 7. In the following example, the desired / shows up in the mappings to the /dev/sda5 partition. The serial number (and a lot of other data) for the base device can then be returned with udevadm info /dev/sda:
sda5 8:5 0 931G 0 part
sda5_crypt 254:0 0 931G 0 crypt
test5--vg-root 254:1 0 651G 0 lvm /
test5--vg-swap_1 254:2 0 976M 0 lvm [SWAP]

How to find the correct devicePaths to use in local storage for an Openshift Persistent Volume?

I've seen the docs to create Custom Resources for Local Storage: https://docs.openshift.com/container-platform/4.5/storage/persistent_storage/persistent-storage-local.html#local-volume-cr_persistent-storage-local
But not sure how to populate the spec.storageClassDevices.devicePaths field.
I've tried the lsblk command in one of my nodes and got this response:
sh-4.4# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 250G 0 disk
|-vda1 252:1 0 384M 0 part /boot
|-vda2 252:2 0 127M 0 part /boot/efi
|-vda3 252:3 0 1M 0 part
`-vda4 252:4 0 249.5G 0 part
`-coreos-luks-root-nocrypt 253:0 0 249.5G 0 dm /sysroot
vdb 252:16 0 200G 0 disk
vdc 252:32 0 200G 0 disk
On Linux and other Unix-like systems your block devices are represented in the filesystem as files so each block device has its unique path, the same way as regular file.
Instead of running lsblk you can run df command which will show you those paths however it will show you only the devices which are already mounted.
All block devices on your system start with vd so you can simply run:
ls -l /dev/vd*
to list them all.
So if you want to mount e.g. your vdb and vdc disks, the values for spec.storageClassDevices.devicePaths will be /dev/vdb and /dev/vdc:
spec:
...
storageClassDevices:
- storageClassName: "local-sc"
volumeMode: Filesystem
fsType: xfs
devicePaths:
- /dev/vdb
- /dev/vdc

Unity crashes when creating .exe

When I build the game and try to execute it I get this error:
Test.exe caused an Access Violation (0xc0000005)
in module Test.exe at 0033:93f8d26a.
Error occurred at 2016-11-22_091146.
83% memory in use.
3980 MB physical memory [677 MB free].
6857 MB paging file [1326 MB free].
134217728 MB user address space [134217031 MB free].
Read from location 00000890 caused an access violation.
I guess I need more RAM (I am using a 83%). What should I do to be able to play the game?
Is it a problem of not having enough RAM or I can fix doing something in unity?

OpenWRT: Cant install packages - memory issue

I switched from default firmware to OpenWrt for my: TP-Link TL-WR1043N/ND v1 and have the problem that I am not able to install any new packages.
What I did:
Flash OpenWrt
Installed Luci (no problem there)
And than when I try to install anything else I get:
Collected errors:
* xsystem: wget: vfork: Out of memory.
* opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/packages/luci/luci-app-wshaper_git-15.338.68695-3bae3c7-1_all.ipk, wget returned -1.
* opkg_install_pkg: Failed to download luci-app-wshaper. Perhaps you need to run 'opkg update'?
* opkg_install_cmd: Cannot install package luci-app-wshaper.
The important thing seems to be : * xsystem: wget: vfork: Out of memory. And yep I did try reboot and 'update' several times.
But under Luci -> Software I can see:
And here is my DF output:
root#OpenWrt:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 2048 2048 0 100% /rom
tmpfs 14052 1128 12924 8% /tmp
/dev/mtdblock3 4736 936 3800 20% /overlay
overlayfs:/overlay 4736 936 3800 20% /
tmpfs 512 0 512 0% /dev
root#OpenWrt:~#
OpenWRT Router Link: https://wiki.openwrt.org/toh/tp-link/tl-wr1043nd
Manufacturer Link: http://www.tp-link.com/en/download/TL-WR1043ND_V1.html
Please does anyone have any idea what could cause the issue? I know the solution could be using an external USB but I want to aviod this at all costs + I cannot imagine that this router would have space just for luci :)
Go into /etc/opkg/distfeeds.conf and comment out everything but base and luci, the first two.
No idea why, but opkg started using tons of RAM with all of those enabled, which they are by default.
Thats my distfeeds. At first try have some troubles with install udpxy, after comment some points in conf, all works.
$ cat /etc/opkg/distfeeds.conf
src/gz designated_driver_base http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/base
#src/gz designated_driver_kernel http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/kernel
#src/gz designated_driver_telephony http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/telephony
src/gz designated_driver_packages http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/packages
#src/gz designated_driver_routing http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/routing
src/gz designated_driver_luci http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/luci
src/gz designated_driver_management http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/management
# src/gz designated_driver_targets http://downloads.openwrt.org/snapshots/trunk/brcm63xx/generic/packages/targets

`error: service 'BloxPager' did not start. Aborting.`

I install the LogicBlox 3.10, using Ubuntu 14.04 64 bit
When I try to do lb-services start
it prompts me
error: service 'BloxPager' did not start. Aborting.
Following in the content in ~/lb_deployment/logs/current/BloxPagerDaemon.log
<2015/11/27 05:33:51.079> ERROR. Shared memory is critically low and will prevent reliable functioning
<2015/11/27 05:33:51.079> ERROR. of the pager daemon. Details follow.
<2015/11/27 05:33:51.079> ERROR. To force pager daemon start, set "LB_PAGER_FORCE_START" in your environment.
<2015/11/27 05:33:51.079> ERROR. * There is a problem with your machine configuration that could cause
<2015/11/27 05:33:51.079> ERROR. * performance or stability problems with large databases. This machine has
<2015/11/27 05:33:51.079> ERROR. * 8.3 Gb of memory, but only 4.2 Gb of memory is available as free disk
<2015/11/27 05:33:51.079> ERROR. * space in /dev/shm. Ideally there would be 5.5 Gb of free space there.
<2015/11/27 05:33:51.079> ERROR. * There is a simple fix. (1) By default linux configures /dev/shm to be
<2015/11/27 05:33:51.079> ERROR. * half the size of physical memory, which is too little for LogicBlox.
<2015/11/27 05:33:51.079> ERROR. * To increase it, edit (as root) the file /etc/fstab. On the line for
<2015/11/27 05:33:51.079> ERROR. * tmpfs, replace the word "defaults" with "size=7g". This change
<2015/11/27 05:33:51.079> ERROR. * will take effect on reboot. (2) If /etc/fstab is already
<2015/11/27 05:33:51.079> ERROR. * configured properly, there are stale files in /dev/shm that should
<2015/11/27 05:33:51.079> ERROR. * be removed. Or, another pager daemon is running (under a different
<2015/11/27 05:33:51.079> ERROR. * unix userid) that is using some shared memory
In /etc/fstab, the content is
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=c5a6aaa0-9337-496f-b2d0-eda2d6e6c87e / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=e8cee437-3b01-4c83-abf6-6cd996e9e21f none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
How should I change it?
Btw, in /dev/shm, I have tried deleting everything other than LB_ubuntu, and it did not seem to work.
A quick Google search turns up:
http://forums.fedoraforum.org/showthread.php?t=275653
The thread describes how to alter the default size of /dev/shm when there is not yet an entry in /etc/fstab.
Have you tried the LB_PAGER_FORCE_START setting?
Adding the following line to your .bashrc will prevent the warning
export LB_PAGER_FORCE_START=""