Unix invalid argument связка ключей

mount: mounting /dev/sda2 on /mnt/sda2 failed: Invalid argument

The error message comes from this line in <Linux kernel source code>/fs/ext4/super.c:

if (ext4_has_unknown_ext4_ro_compat_features(sb)) { ext4_msg(sb, KERN_ERR, «couldn’t mount RDWR because of » «unsupported optional features (%x)», (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP));

The placeholder for the number in the error message is %x, so the number 400 in the actual error message is hexadecimal 0x400. And it is one if the features identified by the EXT4_FEATURE_RO_COMPAT_ constants.

The definitions for those constants can be found in <Linux kernel source code>/fs/ext4/ext4.h:

#define EXT4_FEATURE_RO_COMPAT_DATA_CSUM 0x0400

The dir_n feature mentioned by sourcejedi is 0x20, not 0x400:

#define EXT4_FEATURE_RO_COMPAT_DIR_N 0x0020

So, the MR3020 could not mount the filesystem in read/write mode because its operating system cannot handle ext4 data checksums. So you’ll need to turn that feature off using the Linux system you used to create the USB stick. Move the USB stick back to that system (don’t mount the ext4 filesystem) and run:

tune2fs -O^data_csum /dev/sdX2

(replace X with whatever is the actual identifier of the USB stick in your Linux system.)

After running this command successfully, the data_csum feature will be disabled in the USB stick’s ext4 filesystem, and the MR3020 should now be able to use it.

answered Apr 11 ’18 at 5:40

Читайте также:  Парез голосовой связки прогноз

telcoMtelcoM

53.1k11 gold badge6868 silver badges132132 bronze badges

It seems the mount attempt only tries ext3 and ext2, not ext4. You do have ext4 in your kernel right? (It’s listed in /proc/filesystems.) Could it be that you have /dev/sda2 listed in /etc/fstab as ext3?

answered Oct 31 ’16 at 22:33

3

I have this problem too on an TL-MR3020 v3 and I solved it by creating an ext3 partition instead of ext4, and I successfully mounted the drive.

This is the steps I took (following the steps on the OpenWRT website, just replacing ext4 with ext3):

root@OpenWrt:~# mkfs.ext3 /dev/sda1 mke2fs 1.44.5 (15-Dec-2018) /dev/sda1 contains a ext4 file system created on Sun Sep 27 06:13:56 2020 Proceed anyway? (y,N) y Creating filesystem with 511744 4k blocks and 128000 inodes Filesystem UUID: 2bbb533d-925f-43fb-946a-4190fe612186 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting rmation: done root@OpenWrt:~# block detect | uci import fstab root@OpenWrt:~# uci set fstab.@mount[0].enabled=’1′ && uci set fstab.@global[0].anon_mount=’1′ && uci commit fstab root@OpenWrt:~# /etc/init.d/fstab boot root@OpenWrt:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 2.5M 2.5M 0 100% /rom tmpfs 29.3M 1.1M 28.2M 4% /tmp /dev/mtdblock4 3.8M 1.2M 2.5M 33% /overlay overlayfs:/overlay 3.8M 1.2M 2.5M 33% / tmpfs 512.0K 0 512.0K 0% /dev /dev/sda1 1.9G 3.0M 1.8G 0% /mnt/sda1 root@OpenWrt:~#

I know this is an old question, but maybe it will help someone

answered Sep 27 ’20 at 6:30

Did you format it with ext4 after creating the partition?

mkfs.ext4 /dev/sda2

Then try mounting or mounting with ext4 by explicitly specifying the filesystem type mount -t ext4 /dev/sda2 /mnt/sda2

Читайте также:  Повреждение связок пальца симптомы

answered Apr 11 ’18 at 3:08

Not the answer you’re looking for? Browse other questions tagged mount ext4 dd-wrt or ask your own question.

Источник

Socket, accept() function, Invalid argument

I am getting an error «Invalid argument» when i call the accept() on the server side of a client-server application. I don’t get what is wrong and if you see what is wrong let me know please. Thanks.

#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main(int argc, char* argv[]) { int sockfd, newsockfd, portno, len; struct sockaddr_in server, client; if(argc < 2){ perror(«Add more arguments»); } sockfd = socket(AF_UNIX,SOCK_STREAM,0); if(sockfd < 0){ perror(«Error at socket()»); } f(«Socketfd: %dn»,sockfd); bzero((char *)&server, sizeof(server)); portno = atoi(argv[1]); server.sin_family = AF_UNIX; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(portno); if(bind (sockfd, (struct sockaddr *)&server, sizeof(server)) <0){ perror(«Error at bind ()-server»); } listen(sockfd,5); int readval; char buffer[256]; for(;;){ len = sizeof(client); newsockfd = accept (sockfd, (struct sockaddr *)&server,&len); if (newsockfd == -1){ perror(«Erroare at accept()»); } else do{ readval = (sockfd,buffer,sizeof(buffer)); if (readval < 0 ){ perror(«Error at reading()»); } else if (readval == 0){ f(«End conection»); } else{ f(«Mesage is: %sn», buffer); } }while (readval > 0); close(newsockfd); } return 0; }

simonc

40k1111 gold badges7878 silver badges100100 bronze badges

asked Jan 14 ’13 at 11:42

Dimofte AlexDimofte Alex

5311 gold badge11 silver badge44 bronze badges

4

You have to use sockaddr_un instead of sockaddr_in for Unix domain sockets OR substitute AF_UNIX with AF_INET.

Plus, check the return of listen.

Plus change this line

readval = (sockfd,buffer,sizeof(buffer));

with

readval = read(newsockfd,buffer,sizeof(buffer));

because data is going to be sent through the newly created socket and not on the listening one

Plus, as mentioned by @trojanfoe, subst the server with the client structure into the accept() call

Читайте также:  Паховые связки у женщин расположение фото

answered Jan 14 ’13 at 12:02

Davide BerraDavide Berra

6,07911 gold badge2626 silver badges4444 bronze badges

This line:

newsockfd = accept (sockfd, (struct sockaddr *)&server, &len);

Should be:

newsockfd = accept (sockfd, (struct sockaddr *)&client, &len);

From the manpage:

The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket’s address family (see socket(2) and the respective protocol man pages). When addr is NULL, nothing is filled in; in this case, addrlen is not used, and should also be NULL.

Also check the return value from listen().

answered Jan 14 ’13 at 11:50

trojanfoetrojanfoe

116k1818 gold badges197197 silver badges233233 bronze badges

2

I ran into a similar issue before and it was due to not having the read in a loop. Here is an example I did before.

while (1) { new_sockfd = accept(sockfd, (struct sockaddr *) &client_addr, &sin_size); if (new_sockfd == -1) perror(«accepting connection»); f(«server: got connection from %s port %dn», inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); recv_length = recv(new_sockfd, &buffer, DATA, 0); while (recv_length > 0) { f(«RECV: %d bytesn», recv_length); dump(buffer, recv_length); recv_length = recv(new_sockfd, &buffer, DATA, 0); } close(new_sockfd); }

answered Jan 19 ’16 at 19:16

jarrjarr

10222 silver badges77 bronze badges

Not the answer you’re looking for? Browse other questions tagged c linux sockets or ask your own question.

Источник