Cat read error invalid argument

Joined: 28 Mar 2012Posts: 17
View previous topic :: View next topic  
Author Message
Mordillo98
n00b
n00b

Joined: 28 Mar 2012
Posts: 17

PostPosted: Tue Jun 28, 2016 4:44 pm    Post subject: cat: read error: Invalid argument Reply with quote

Hi,

Installed Gentoo with systemd. Everything works great except at boot I get this….

:: Loading from net:

:: Loading from iscsi:

::Loading from crypto:

cat: read error: Invalid argument

cat: read error: Invalid argument

cat: read error: Invalid argument

cat: read error: Invalid argument

cat: read error: Invalid argument

>> Determining root device …

How can I resolve this cat read error thing?

https://s31.postimg.org/7ppx7mf97/Gentoo4_LFS_x86_2016_06_28_12_31_44.png

Thx…

Back to top

View user's profile Send private message

Roman_Gruber
Advocate
Advocate

Joined: 03 Oct 2006
Posts: 3836
Location: Austro Bavaria

PostPosted: Wed Jun 29, 2016 10:13 pm    Post subject: Reply with quote

May I ask!

Does your box boot?

Usually, determining the root device, implies that the kernel is looking for the way to mount your root file system. The kernel needs access to / needs a way to mount and read your root partition. Means => hardware support / file system support build in the kernel and proper kernel parameters in your bootloader.

I assume your box does not goes on after this message. If so you need to specify your root drive and enalbe the support in your kernel. The gentoo handbook is a good starting point for that. Arch wiki has very often a decent guide for stuff too

Back to top

View user's profile Send private message

Mordillo98
n00b
n00b

Joined: 28 Mar 2012
Posts: 17

PostPosted: Thu Jun 30, 2016 1:12 pm    Post subject: Reply with quote

Yup. After all those messages, I boot successfully up to the end.

I am new @ systemd so I tried to figure out if I could get some logs about what it’s trying to load, or if this is related to the encryption module. A good test would be to NOT have the encryption module to load at boot and see as a test, but can’t figure out how.

Back to top

View user's profile Send private message

pilla
Bodhisattva
Bodhisattva

Joined: 07 Aug 2002
Posts: 7729
Location: Underworld

PostPosted: Fri Jul 01, 2016 12:54 am    Post subject: Reply with quote

I would check configuration files for the crypto service… looks like it uses a cat inside itself but some parameter is breaking it.
_________________
«I’m just very selective about the reality I choose to accept.» — Calvin
Back to top

View user's profile Send private message

Display posts from previous:   

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Cat read error invalid argument

Installed Gentoo with systemd. Everything works great except at boot I get this.

:: Loading from net:
:: Loading from iscsi:
::Loading from crypto:
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
>> Determining root device .

How can I resolve this cat read error thing?

Thx. Вернуться к началу

Roman_Gruber
Advocate

Зарегистрирован: 03 окт 2006
Сообщений: 3834
Откуда: Austro Bavaria

Добавлено: ср июн 29, 2016 10:13 pm Заголовок сообщения:
May I ask!

Does your box boot?

Usually, determining the root device, implies that the kernel is looking for the way to mount your root file system. The kernel needs access to / needs a way to mount and read your root partition. Means => hardware support / file system support build in the kernel and proper kernel parameters in your bootloader.

I assume your box does not goes on after this message. If so you need to specify your root drive and enalbe the support in your kernel. The gentoo handbook is a good starting point for that. Arch wiki has very often a decent guide for stuff too

Вернуться к началу

Mordillo98
n00b

Зарегистрирован: 28 мар 2012
Сообщений: 17

Добавлено: чт июн 30, 2016 1:12 pm Заголовок сообщения:
Yup. After all those messages, I boot successfully up to the end.

I am new @ systemd so I tried to figure out if I could get some logs about what it’s trying to load, or if this is related to the encryption module. A good test would be to NOT have the encryption module to load at boot and see as a test, but can’t figure out how.

Вернуться к началу

pilla
Bodhisattva

Зарегистрирован: 07 авг 2002
Сообщений: 7728
Откуда: Underworld

Добавлено: пт июл 01, 2016 12:54 am Заголовок сообщения:
I would check configuration files for the crypto service. looks like it uses a cat inside itself but some parameter is breaking it.
_________________
«I’m just very selective about the reality I choose to accept.» — Calvin

Вернуться к началу

Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах

Copyright 2001-2023 Gentoo Foundation, Inc. Designed by Kyle Manna © 2003; Style derived from original subSilver theme. | Hosting by Gossamer Threads Inc. © | Powered by phpBB 2.0.23-gentoo-p11 © 2001, 2002 phpBB Group
Privacy Policy

Источник

Cat read error invalid argument

Installed Gentoo with systemd. Everything works great except at boot I get this.

:: Loading from net:
:: Loading from iscsi:
::Loading from crypto:
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
>> Determining root device .

How can I resolve this cat read error thing?

Thx.

Вернуться к началу

Roman_Gruber
Advocate

Зарегистрирован: 03 окт 2006
Сообщений: 3834
Откуда: Austro Bavaria

Добавлено: ср июн 29, 2016 10:13 pm Заголовок сообщения:
May I ask!

Does your box boot?

Usually, determining the root device, implies that the kernel is looking for the way to mount your root file system. The kernel needs access to / needs a way to mount and read your root partition. Means => hardware support / file system support build in the kernel and proper kernel parameters in your bootloader.

I assume your box does not goes on after this message. If so you need to specify your root drive and enalbe the support in your kernel. The gentoo handbook is a good starting point for that. Arch wiki has very often a decent guide for stuff too

Вернуться к началу

Mordillo98
n00b

Зарегистрирован: 28 мар 2012
Сообщений: 17

Добавлено: чт июн 30, 2016 1:12 pm Заголовок сообщения:
Yup. After all those messages, I boot successfully up to the end.

I am new @ systemd so I tried to figure out if I could get some logs about what it’s trying to load, or if this is related to the encryption module. A good test would be to NOT have the encryption module to load at boot and see as a test, but can’t figure out how.

Вернуться к началу

pilla
Bodhisattva

Зарегистрирован: 07 авг 2002
Сообщений: 7728
Откуда: Underworld

Добавлено: пт июл 01, 2016 12:54 am Заголовок сообщения:
I would check configuration files for the crypto service. looks like it uses a cat inside itself but some parameter is breaking it.
_________________
«I’m just very selective about the reality I choose to accept.» — Calvin

Вернуться к началу

Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах

Copyright 2001-2023 Gentoo Foundation, Inc. Designed by Kyle Manna © 2003; Style derived from original subSilver theme. | Hosting by Gossamer Threads Inc. © | Powered by phpBB 2.0.23-gentoo-p11 © 2001, 2002 phpBB Group
Privacy Policy

Источник

Cat read error invalid argument

Installed Gentoo with systemd. Everything works great except at boot I get this.

:: Loading from net:
:: Loading from iscsi:
::Loading from crypto:
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
cat: read error: Invalid argument
>> Determining root device .

How can I resolve this cat read error thing?

Thx.

Вернуться к началу

Roman_Gruber
Advocate

Зарегистрирован: 03 окт 2006
Сообщений: 3834
Откуда: Austro Bavaria

Добавлено: ср июн 29, 2016 10:13 pm Заголовок сообщения:
May I ask!

Does your box boot?

Usually, determining the root device, implies that the kernel is looking for the way to mount your root file system. The kernel needs access to / needs a way to mount and read your root partition. Means => hardware support / file system support build in the kernel and proper kernel parameters in your bootloader.

I assume your box does not goes on after this message. If so you need to specify your root drive and enalbe the support in your kernel. The gentoo handbook is a good starting point for that. Arch wiki has very often a decent guide for stuff too

Вернуться к началу

Mordillo98
n00b

Зарегистрирован: 28 мар 2012
Сообщений: 17

Добавлено: чт июн 30, 2016 1:12 pm Заголовок сообщения:
Yup. After all those messages, I boot successfully up to the end.

I am new @ systemd so I tried to figure out if I could get some logs about what it’s trying to load, or if this is related to the encryption module. A good test would be to NOT have the encryption module to load at boot and see as a test, but can’t figure out how.

Вернуться к началу

pilla
Bodhisattva

Зарегистрирован: 07 авг 2002
Сообщений: 7728
Откуда: Underworld

Добавлено: пт июл 01, 2016 12:54 am Заголовок сообщения:
I would check configuration files for the crypto service. looks like it uses a cat inside itself but some parameter is breaking it.
_________________
«I’m just very selective about the reality I choose to accept.» — Calvin

Вернуться к началу

Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах

Copyright 2001-2023 Gentoo Foundation, Inc. Designed by Kyle Manna © 2003; Style derived from original subSilver theme. | Hosting by Gossamer Threads Inc. © | Powered by phpBB 2.0.23-gentoo-p11 © 2001, 2002 phpBB Group
Privacy Policy

Источник

Adblock
detector

Writing to a custom character device using

cat 123 > /dev/chardev

gives

cat: write error: Invalid argument

I have changed the permissions to 666 and even tried it with sudo. Still the same results.
Also tried echo in similar way

I use Arch linux 4.8.

Edit: The code for the driver

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/uaccess.h>


//Prototypes
static int __init init(void);
static void __exit cleanup(void);
static int device_open(struct inode *,struct file *);
static int device_release(struct inode *, struct file *);
static ssize_t device_read(struct file *, char *, size_t, loff_t *);
static ssize_t device_write(struct file *, const char *, size_t, loff_t *);

#define SUCCESS 0
#define DEVICE_NAME "chardev" /* Dev name as it appears in /proc/devices*/
#define BUF_LEN 80 /* Max length of the message from the device */

static int Major; //Major number of the devices
static int Device_Open = 0;

static char msg[BUF_LEN]; //Message given when asked
static char *msg_Ptr;

static struct file_operations fops = {
    .read = device_read,
    .write = device_write,
    .open = device_open,
    .release = device_release
};

static int __init init(){
    Major = register_chrdev(0,DEVICE_NAME,&fops);
    if(Major < 0){
        printk(KERN_ALERT "Failure in registering the device. %dn", Major);
        return Major;
  }
    printk(KERN_INFO "%s registered with major %d n",DEVICE_NAME,Major);
    printk(KERN_INFO "create a device with 'mknod /dev/%s c %d 0'n",DEVICE_NAME,Major);
    printk(KERN_INFO "Try to cat and echo the file and shit man.n");
    return SUCCESS;
}

static void __exit cleanup(){
    unregister_chrdev(Major, DEVICE_NAME);
    printk(KERN_ALERT "Unregistered the device %s i guess? n"DEVICE_NAME);
}   

static int device_open(struct inode *inode,struct file *file){
    static int counter = 0;
    if(Device_Open)
        return -EBUSY;

    Device_Open++;
    sprintf(msg, "I already told you %d times Hello world!n", counter++);
    msg_Ptr = msg;
    try_module_get(THIS_MODULE);
    return SUCCESS;
}

static int device_release(struct inode *inode,struct file *file){
    Device_Open--;
    module_put(THIS_MODULE);
    return 0;
}

static ssize_t device_read(struct file *filp, char *buffer, size_t length, loff_t * offset){
    int bytes_read = 0;
    if(*msg_Ptr == 0)
        return 0;
    while(length && *msg_Ptr){
        put_user(*(msg_Ptr++),buffer++);
        length--;   
        bytes_read++;
    }
    return bytes_read;
}

static ssize_t device_write(struct file *filp,const char *buff, size_t len, loff_t *off){
    printk(KERN_ALERT "You cannot write to this device.n");
    return -EINVAL;
}

module_init(init);
module_exit(cleanup);

So here we can see that i have even used a device_write function and assigned it in the fops struct to .write. So isn’t it supposed to accept write command and print that statement in the log?

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • New to Ubuntu
  • [ubuntu] cat write error invalid argument

  1. cat write error invalid argument

    hi, i am trying to:
    abc@abc-linux:~/Desktop$ cat «sample.au» > /dev/snd/seq

    but it says:cat write error invalid argument

    do you see what the problem is?


  2. Re: cat write error invalid argument

    Do you have write permissions for that file? Try running the command with sudo.


  3. Re: cat write error invalid argument

    Quote Originally Posted by drmrgd
    View Post

    Do you have write permissions for that file? Try running the command with sudo.

    yes i tried it with sudo but same error occured.


  4. Re: cat write error invalid argument

    I don’t think «cat» is the command you need here. Try using «echo» instead. And use double redirector if you want to add to existing file instead of replacing all information.

    Code:

    abc@abc-linux:~/Desktop$ sudo echo "sample.au" >> /dev/snd/seq

    Break it, fix it, learn something.
    People who never make mistakes seldom make anything!


  5. Re: cat write error invalid argument

    Quote Originally Posted by Miljet
    View Post

    I don’t think «cat» is the command you need here. Try using «echo» instead. And use double redirector if you want to add to existing file instead of replacing all information.

    Code:

    abc@abc-linux:~/Desktop$ sudo echo "sample.au" >> /dev/snd/seq

    i tried echo but the error is same:echo: write error: Invalid argument


  6. Re: cat write error invalid argument

    /dev/snd/seq is a character special file — I think this is more likely why you’re getting the error (and why it’s ‘invalid argument’ not ‘permission denied’)

    What exactly are you trying to do? I don’t really know anything about sound but afaik there are some alsa utilities for this kind of thing at a higher level (amidi? aplaymidi?)

    [btw if it was a permissions issue then ‘sudo cat’ wouldn’t help because it’s the redirect of stdout that needs elevated write permissions — you could use a ‘sudo tee’ instead of the ‘>’ or wrap the whole command in a sudo sh ‘cat …’ however iirc the default is for /etc/snd/seq to be rw for members of the audio group so provided user is a member of ‘audio’ there should be no permission issue]


  7. Re: cat write error invalid argument

    Quote Originally Posted by steeldriver
    View Post

    /dev/snd/seq is a character special file — I think this is more likely why you’re getting the error (and why it’s ‘invalid argument’ not ‘permission denied’)

    What exactly are you trying to do? I don’t really know anything about sound but afaik there are some alsa utilities for this kind of thing at a higher level (amidi? aplaymidi?)

    [btw if it was a permissions issue then ‘sudo cat’ wouldn’t help because it’s the redirect of stdout that needs elevated write permissions — you could use a ‘sudo tee’ instead of the ‘>’ or wrap the whole command in a sudo sh ‘cat …’ however iirc the default is for /etc/snd/seq to be rw for members of the audio group so provided user is a member of ‘audio’ there should be no permission issue]

    this is an example of accessing devices in a pdf document.it should play the file but it didnt via this codes:

    Code:

    sudo cat  sample.au  >  /dev/snd/seq


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

Понравилась статья? Поделить с друзьями: