Invalid argument error in httptunnel client
sudo hts -F localhost:10000 81 nc -l -p 10000
sudo htc -F 7777 server_ip_address:81 telnet 127.0.0.1 7777
Trying 127.0.0.1. Connected to 127.0.0.1. Escape character is '^]'. Connection closed by foreign host.
Nov 6 01:41:37 r1y4n-PC htc[1695]: htc (httptunnel) 3.3 started with arguments: Nov 6 01:41:37 r1y4n-PC htc[1695]: me = htc Nov 6 01:41:37 r1y4n-PC htc[1695]: device = (null) Nov 6 01:41:37 r1y4n-PC htc[1695]: host_name = server_ip_address Nov 6 01:41:37 r1y4n-PC htc[1695]: host_port = 81 Nov 6 01:41:37 r1y4n-PC htc[1695]: proxy_name = (null) Nov 6 01:41:37 r1y4n-PC htc[1695]: proxy_port = 8080 Nov 6 01:41:37 r1y4n-PC htc[1695]: proxy_buffer_size = 0 Nov 6 01:41:37 r1y4n-PC htc[1695]: proxy_buffer_timeout = -1 Nov 6 01:41:37 r1y4n-PC htc[1695]: content_length = 102400 Nov 6 01:41:37 r1y4n-PC htc[1695]: forward_port = 7777 Nov 6 01:41:37 r1y4n-PC htc[1695]: max_connection_age = 300 Nov 6 01:41:37 r1y4n-PC htc[1695]: use_std = 0 Nov 6 01:41:37 r1y4n-PC htc[1695]: strict_content_length = 0 Nov 6 01:41:37 r1y4n-PC htc[1695]: keep_alive = 5 Nov 6 01:41:37 r1y4n-PC htc[1695]: proxy_authorization = (null) Nov 6 01:41:37 r1y4n-PC htc[1695]: user_agent = (null) Nov 6 01:41:37 r1y4n-PC htc[1695]: debug_level = 0 Nov 6 01:41:49 r1y4n-PC htc[1695]: http_write_request: write error: Invalid argument Nov 6 01:41:49 r1y4n-PC htc[1695]: couldn't open tunnel: Invalid argument Nov 6 01:41:49 r1y4n-PC htc[1695]: exit with status = 1
What causes the http_write_request: write error: Invalid argument ?
How can I tunnel my connection correctly?
Both server and client are Ubuntu 14.04 Thanks
How to resolve Python OSError: [Errno 22] Invalid argument on Linux
I am trying to execute this program taken from the online python documentation(https://docs.python.org/3.6/library/mmap.html) and its about the implementation of mmap.
import mmap # write a simple example file with open("hello.txt", "wb") as f: f.write(b"Hello Python!\n") with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file mm = mmap.mmap(f.fileno(), 0) # read content via standard file methods print(mm.readline()) # prints b"Hello Python!\n" # read content via slice notation print(mm[:5]) # prints b"Hello" # update content using slice notation; # note that new content must have same size mm[6:] = b" world!\n" # . and read again using standard file methods mm.seek(0) print(mm.readline()) # prints b"Hello world!\n" # close the map mm.close()
user@logger$ python3 mmap1.py Traceback (most recent call last): File "mmap1.py", line 9, in mm = mmap.mmap(f.fileno(), 0) OSError: [Errno 22] Invalid argument user@logger$ python mmap1.py Traceback (most recent call last): File "mmap1.py", line 9, in mm = mmap.mmap(f.fileno(), 0) mmap.error: [Errno 22] Invalid argument user@logger$ which python /usr/bin/python user@logger$ python --version Python 2.7.15rc1 user@logger$ python3 --version Python 3.6.7
user@logger$ uname -a Linux user-vm 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
On windows, using PyCharm I am able to get this program executed without any issues. On a virtual machine Linux, however, I get these errors. What am I missing. Thank you.
Mounting cifs drive gives: mount error(22): Invalid argument
Two possible problems: your source is an URL which either may not resolve or is not advertising Samba; and, the uid/gid need to be expressed numerically. Have you read the referred man page?
Mount should really return a better error message. Knowing which argument is invalid would make this error message so much more helpful.
Mount gives a generic error because the details are in the log. As it is said below, use tail -f /var/log/kern.log to understand what’s going on.
9 Answers 9
maybe this helps with this, mount error(22): Invalid argument . possible error is the argument/s (mode) on mount command.
- check your logs on the errors encountered.
This worked for me. I found the error CIFS not working, kernel upgrade:No dialect specified on mount and resolved it by [adding] vers=1.0 to my /etc/fstab(bbs.archlinux.org/viewtopic.php?id=230952). I suspect it is caused by using kernel 4.13.
Jeez, thank goodness for stackoverflow. Same problem on ubuntu. I added vers=2.0 and it works. Current mount.cifs is at 6.4. Probably some enhancements to credentials but not digging into CIFS now.
Another possible cause is the presence of sec=ntlm in /etc/fstab and it’s incompatibility with newer SMB protocols like SMB3.
While not the OP’s case, this can also cause mount error(22): Invalid argument errors, as it did for me after upgrading an old server.
Even though kern.log includes a suggestion to specify vers=1.0 on mount , it may be safer to remove or change sec=ntlm instead. Perhaps use the defaults to allow automatic negotiation of the SMB version and security, or specify compatible options such as vers=3.0,sec=ntlmssp .
Obviously this depends on your SMB server’s features, but I would try and avoid vers=1.0 unless necessary.
Unable to format disk: Invalid argument
I am trying to format an external hard disk in Ubuntu 18.04 following the description given here. However, after having deleted all partitions in fdisk and created a new one, and entered w to write it to disk, I get the following output:
Command (m for help): w The partition table has been altered. Failed to remove partition 1 from system: Invalid argument Failed to remove partition 2 from system: Invalid argument Failed to remove partition 3 from system: Invalid argument Failed to remove partition 4 from system: Invalid argument Failed to add partition 1 to system: Invalid argument The kernel still uses the old partitions. The new table will be used at the next reboot. /dev/sdc1: close device failed: Input/output error
The disk is potentially damaged! How to figure out if there is a way to format (part) of the disk, or if the disk is really damaged beyond any use? (I am able to access MOST of the content on the disk, so the disk cannot be that damaged. But I am unable to repair/reformat it). So what can I do?
2 Answers 2
By the looks of it you have successfully created a new partition table. The errors point to the aftermath jobs of closing the device. Since you have deleted previous partitions it cannot remove partition 1,2,3,4 because they don’t exist anymore. And likewise cannot load the new table as removal of old ones failed. You should just reboot and start formatting it.
To be able to answer this question, one would have to see how you went about making your changes including how fdisk was invoked. With fdisk, you can follow your progress by using the ‘p’ (print) command to view the partition table, use it to see if your commands to delete partitions and create new (command ‘n’) partitions actually did what you thought it should. You can create a completely new partition table with the ‘o’ command (for a DOS type of table). Use the command ‘v’ to verify the table, if there are no errors, you should be able to write it out to the disk.
Keep in mind, only a partition can be ‘formatted’. What is your reason to redo the partition tables and format the disk? Are you getting read/write errors with this disk? If that is the case, you should replace the disk, it won’t get better.
Sorry to go on here, but I went and looked at the your source of information.
Ahh! I just looked at the directions for using fdisk, that you refered to, it leaves out an important step, choosing the type of partition that you want, using the ‘t’ command to change (set) the partition type. Use 83 for a «normal» linux partition, use 82 for a linux swap partition. Use the ‘l’ command to list the values for different OS’s. You may also want to toggle whether the disk is bootable or not, using the ‘a’ command. Hope this helps!
mount: mounting /dev/sda2 on /mnt/sda2 failed: Invalid argument
I’m following this tutorial. But I got stuck at step 9, somehow I’m not able to mount my USB. Every time I try to mount my USB I get the following error:
root@OpenWrt:~# mount /dev/sda2 /mnt/sda2 mount: mounting /dev/sda2 on /mnt/sda2 failed: Invalid argument
The USB seems to be OK and connected but somehow I’m not able to mount the sda2 (ext4) partition. The partitions seems to be OK as well:
root@OpenWrt:~# blkid /dev/mtdblock2: TYPE="squashfs" /dev/sda1: UUID="e39964e8-1b51-4b1f-b034-0147fa394eea" TYPE="swap" /dev/sda2: UUID="157cfc0d-f33d-4103-950d-6ae01baa7177" TYPE="ext4"
root@OpenWrt:~# dmesg | grep sda [ 9.360000] sd 0:0:0:0: [sda] 7987200 512-byte logical blocks: (4.08 GB/3.80 GiB) [ 9.370000] sd 0:0:0:0: [sda] Write Protect is off [ 9.370000] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00 [ 9.370000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 9.400000] sda: sda1 sda2 [ 9.410000] sd 0:0:0:0: [sda] Attached SCSI removable disk [ 41.850000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities [ 41.870000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities [ 41.880000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400) [ 270.660000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities [ 270.670000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities [ 270.670000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400) [ 585.040000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities [ 585.050000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities [ 585.060000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400) [ 586.540000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities [ 586.550000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities [ 586.560000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400) [ 651.570000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities [ 651.580000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities [ 651.590000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sda: 4089 MB, 4089446400 bytes 255 heads, 63 sectors/track, 497 cylinders, total 7987200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 1 7987199 3993599+ ee GPT