Invalid argument

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Invalid argument

Post#1 by Ed_P » 09 Jan 2017, 06:50

3.2.2 Cinnamon 64-bit

Why does this cp command produce an Invalid argument error on this copy command?

Code: Select all

guest@porteus:~$ mkdir -p /tmp/mod
guest@porteus:~$ 
guest@porteus:~$ # copy modified files
guest@porteus:~$ cp -a --parents    /home/guest/.config/nemo/*                     /tmp/mod/
cp: preserving permissions for ‘/tmp/mod/home/guest/.config/nemo’: Invalid argument
guest@porteus:~$ 
It didn't before 3.2.2. And I have looked at cp --help and don't see anything that raises a flag.

-update-

3.1 lxqt 64-bit

Code: Select all

guest@porteus:~$ mkdir -p /tmp/mod
guest@porteus:~$ cp -a --parents    /home/guest/.config/lxterminal/*                     /tmp/mod/
guest@porteus:~$ 
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Invalid argument

Post#2 by Bogomips » 09 Jan 2017, 14:40

Question is: does it perform the copy as expected?
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#3 by Ed_P » 09 Jan 2017, 15:26

A fair question Bogomips, and the answer is I'm not sure. :oops:

The files appear to all be copied and the /tmp/mod/ is made into a .xzm module but when booting 3.2.2 with the module Cinnamon hangs with a logon prompt which when responded to loops back to request it again. I'm assuming there is a permissions problem in the module and it might be tied to the error msg.

The code and the resulting module was a replacement for my save.dat changes when 3.2rc_ did the logon loop thing in the early days of rc testing and used my changes=EXIT cheatcode.

mkmodchanges.sh

Code: Select all

#!/bin/bash

# Save 3.2 changes as a mod file 

# https://forum.porteus.org/viewtopic.php?f=81&t=5981&start=15#p46643

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redpswd() {
  echo -e "$1" $txtred  
}

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst

if [ "$1" == "x" ]; then
   echo 'find /mnt/live/memory/changes  -iname "*" -mmin -3'
   find /mnt/live/memory/changes  -iname "*" -mmin -3
   echo
   exit
fi

if [ -d /tmp/mod/ ]; then
   rm -rf /tmp/mod
fi
mkdir -p /tmp/mod

# copy modified files
cp -a --parents    /home/guest/.config/nemo/*                     /tmp/mod/
cp -a --parents    /home/guest/.config/gtk-3.0/*                  /tmp/mod/
cp -a --parents    /home/guest/.config/dconf/*                    /tmp/mod/
cp -a --parents    /home/guest/.cache/dconf/*                     /tmp/mod/
cp -a --parents    /home/guest/*                                  /tmp/mod/

cp -a --parents    /home/guest/.mozilla/plugins                                 /tmp/mod/
cp -a --parents    /home/guest/.mozilla/firefox/profiles.ini                    /tmp/mod/
cp -a --parents    /home/guest/.mozilla/firefox/dxsqumip.default/places.sqlite  /tmp/mod/
cp -a --parents    /home/guest/.mozilla/firefox/dxsqumip.default/prefs.js       /tmp/mod/
cp -a --parents    /home/guest/.mozilla/firefox/dxsqumip.default/xulstore.json  /tmp/mod/

cp -a --parents    /home/guest/.cinnamon/configs/panel-launchers@cinnamon.org/* /tmp/mod/
cp -a --parents    /home/guest/.cinnamon/configs/power@cinnamon.org/*           /tmp/mod/

cp -a --parents    /etc/NetworkManager/system-connections/*       /tmp/mod/
cp -a --parents    /var/lib/dhcpcd/*                              /tmp/mod/
cp -a --parents    /var/run/NetworkManager/*                      /tmp/mod/

#cp -a --parents   /etc/*time                                     /tmp/mod/

cp -a --parents    /usr/share/applications/cups*                  /tmp/mod/
cp -a --parents    /usr/share/applications/*print*                /tmp/mod/
cp -a --parents    /usr/share/applications/*browser*              /tmp/mod/

cp -a --parents    /etc/usm/*                                     /tmp/mod/
cp -a --parents    /var/usm/                                      /tmp/mod/

echo
echo Changed files copied. Press Enter to create module, Ctrl+C to exit.
read

du -h   /tmp/mod/
echo 
dir2xzm /tmp/mod /tmp/mychanges.xzm   &&   rm -rf /tmp/mod

echo 
ls -sh  /tmp/*.xzm
#read

DIR () {
ls -lght --time-style long-iso $1 | awk '{print $5,$6,$4,$7}'
}
echo
echo Press Enter to copy /tmp/mychanges.xzm to modsavedat, Ctrl+C to exit.
DIR     /tmp/mychanges.xzm 
DIR     /mnt/sda5/porteus3.2/modsavedat/mychanges*.xzm 
read
mv      /mnt/sda5/porteus3.2/modsavedat/mychanges*.xzm mychanges.xyzm
cp      /tmp/mychanges.xzm  /mnt/sda5/porteus3.2/modsavedat
echo Finished!
read
BTW All the cps have the error msg not just the one I showed.

Once the logon loop was fixed I've been using the script to be a backup to my important save.dat changes and whenever something strange happens with 3.2.2 I boot with the changes module rather than the changes=EXIT save.dat file to see if the problem is tied to my save.dat file or some other module.

(save.dat files can become corrupted if the changes to be saved are larger than the file.)

-update-

The problem is a 3.2.2 problem. Works fine in 3.2.1.

Code: Select all

guest@porteus:~$ ./bootmode.sh
Boot device: /dev/sda5
Device format: "ntfs" 
Boot ISO: /ISOs/Porteus-CINNAMON-v3.2.1-x86_64.iso
 Changes will not be saved.
 To save changes create a save.dat file using Porteus Savefile Manager.
Cmdline:  quiet BOOT_IMAGE=(loop)/boot/syslinux/vmlinuz from=/ISOs/Porteus-CINNAMON-v3.2.1-x86_64.iso volume=33 reboot=cold extramod=/mnt/sda5/porteus3.2/Modules;/mnt/sda5/porteus3.2/modsavedat noload=porteussave.dat.xzm
guest@porteus:~$ 
guest@porteus:~$ ./mkmodchanges.sh
Enter root's password 
Password: 


Changed files copied. Press Enter to create module, Ctrl+C to exit.
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2065
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: Invalid argument

Post#4 by donald » 09 Jan 2017, 18:09

I tried to reproduce it,i copied
( cp -a -p /home/guest/.config/* /tmp/test )
and got the "cp: preserving permissions for...: Invalid argument"
message at copied folders, not files.

Now I copied to a different location
( cp -a -p /home/guest/.config/* /mnt/sda3/test ) -- (ext2 filesystem)
and got no error at all.

Hmmm....

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#5 by Ed_P » 09 Jan 2017, 18:24

Hmmm... indeed. My 3.2.2 Porteus boots fine with the mychanges.xzm module created in 3.2.1 Porteus.

Even with the error I have files in my /tmp/mod folder.

Code: Select all

cp: preserving permissions for ‘/tmp/mod/var/usm/slacky’: Invalid argument
cp: preserving permissions for ‘/tmp/mod/var/usm’: Invalid argument

Changed files copied. Press Enter to create module, Ctrl+C to exit.
^C
guest@porteus:~$ ls /tmp/mod/home/guest/
/bin/ls: cannot access '/tmp/mod/home/guest/': Permission denied
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# ls /tmp/mod/home/guest/
!broadcomrc32.sh*   chromecache.sh*         hungapp.txt*
Backups/            chromepswds.txt*        mkmodchanges.sh*
Desktop/            chromex.sh*             modules.sh*
Documents/          comparemods.sh*         networkchanges.txt*
Downloads/          comparemodules.txt*     notes.txt*
But I can't access them, even the guest ones, unless I use root!!
Ed

jssouza
Legendary
Legendary
Posts: 1165
Joined: 09 Jul 2015, 14:17
Distribution: Porteus x86 arm

Re: Invalid argument

Post#6 by jssouza » 09 Jan 2017, 20:17

Works fine if the 4.9 kernel (vmlinuz + 000-kernel) of porteus 3.2.2 is swapped with 4.8.11 kernel of porteus 3.2.1. So, it looks like a kernel/kernel configuration thing.
The reason I tried this was because the problem did not occur on the arm (raspberry pi - slackware current) variant as well. There the kernel is 4.8.10 but gnu coreutils package (of which cp is part of) is coreutils-8.26 (slackware current). On x86, coreutils is at v8.25 (slackware 14.2). So, just wanted to narrow down the issue.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Invalid argument

Post#7 by Bogomips » 09 Jan 2017, 22:07

donald wrote:I tried to reproduce it,i copied
( cp -a -p /home/guest/.config/* /tmp/test )
and got the "cp: preserving permissions for...: Invalid argument"
message at copied folders, not files.

Now I copied to a different location
( cp -a -p /home/guest/.config/* /mnt/sda3/test ) -- (ext2 filesystem)
and got no error at all.
This is interesting because
-a, --archive
same as -dR --preserve=all
So the the option -p could be regarded as superfluous
-p same as --preserve=mode,ownership,timestamps
However has almost same outcome as -a --parents :unknown:

P.S.
/tmp has some sort of sticky bit, I believe. Creating /tmp directory like so:

Code: Select all

mkdir   /mnt/sdXy/Path/to/tmp
chmod  1777 /mnt/sdXy/Path/to/tmp   # Making a /tmp compatible directory  
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#8 by Ed_P » 09 Jan 2017, 22:51

Bogomips wrote:P.S.
/tmp has some sort of sticky bit, I believe. Creating /tmp directory like so:

Code: Select all

mkdir   /mnt/sdXy/Path/to/tmp
chmod  1777 /mnt/sdXy/Path/to/tmp   # Making a /tmp compatible directory   
I'm not following you Bogomips. :( Are you saying to do that to my /tmp/mod/ folder? :unknown:
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Invalid argument

Post#9 by Bogomips » 09 Jan 2017, 23:13

Ed, I believe the /tmp already has these bits set, which could be why donald got different outcomes for the directories that were tried. It looks like your target directory has always been a subdirectory of /tmp. So the /tmp permissions could be a factor here. :unknown:

Update

In the interests of science, just do a simple cp -a without --parents, and see what message you get, if any.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

donald
Full of knowledge
Full of knowledge
Posts: 2065
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: Invalid argument

Post#10 by donald » 10 Jan 2017, 00:02

Bogomips wrote:So the the option -p could be regarded as superfluous
That's true... :) I've attached it because "It can do no harm"
and yep
drwxrwxrwt 8 root root 4.0K Jan 9 23:49 tmp/

Sticky_bit
Sticky bit

One question remains, why does it work in 3.2.1 -- (Ed said so)

Ed, could you check if the sticky-bit is also set in 3.2.1
guest@porteus:/$ ls -lh

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#11 by Ed_P » 10 Jan 2017, 00:25

donald wrote:Ed, could you check if the sticky-bit is also set in 3.2.1
guest@porteus:/$ ls -lh
3.0.1

Code: Select all

guest@porteus:~$ ls -lh /tmp
total 0
drwxr-xr-x 4 guest guest 60 Jan  9 16:06 google-chrome/
srwxr-xr-x 1 root  root   0 Dec 13 12:25 qtsingleapp-qlippe-2dfb-0=
-rw-r--r-- 1 root  root   0 Dec 13 12:25 qtsingleapp-qlippe-2dfb-0-lockfile
srwxr-xr-x 1 guest guest  0 Jan  9 15:52 qtsingleapp-qlippe-2dfb-3e8=
-rw-r--r-- 1 guest guest  0 Dec 12 13:20 qtsingleapp-qlippe-2dfb-3e8-lockfile
drwxrwxrwt 2 root  root   6 Dec 13 12:25 spacefm.tmp/
guest@porteus:~$ 
I'll reboot to 3.2.1 and be right back.

-update-

3.1

Code: Select all

guest@porteus:~$ ls -lh /tmp
total 0
drwx------ 2 guest guest 120 Jan  9 19:17 keyring-JwnZfr/
srwxr-xr-x 1 guest guest   0 Jan  9 19:17 qtsingleapp-qlippe-2dfb-3e8=
-rw-r--r-- 1 guest guest   0 Jan  9 19:17 qtsingleapp-qlippe-2dfb-3e8-lockfile
guest@porteus:~$
Now to 3.2.1

-update-

3.2.1

Code: Select all

guest@porteus:~$ ls -lh /tmp
total 0
drwx------ 2 guest users 80 Jan  9 19:31 pulse-PKdhtXMmr18n/
guest@porteus:~$ mkdir /tmp/xyz
guest@porteus:~$ ls -lh /tmp
total 0
drwx------ 2 guest users 80 Jan  9 19:31 pulse-PKdhtXMmr18n/
drwxr-xr-x 2 guest users 40 Jan  9 19:33 xyz/
guest@porteus:~$ 
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Invalid argument

Post#12 by Bogomips » 10 Jan 2017, 00:34

@Ed_P

Code: Select all

guest@porteus:~$ mkdir tst
guest@porteus:~$ chmod 1777 tst
guest@porteus:~$ ls -ld tst
drwxrwxrwt 2 guest users 40 Jan 10 01:18 tst/
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#13 by Ed_P » 10 Jan 2017, 00:50

^ Did you want me to do that in 3.2.1 or 3.2.2? :unknown:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2065
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: Invalid argument

Post#14 by donald » 10 Jan 2017, 00:54

sorry Ed, I should have said

Code: Select all

guest@porteus:~$ cd /
guest@porteus:/$ ls -lh | grep tmp
to extract the info about the tmp folder.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Invalid argument

Post#15 by Ed_P » 10 Jan 2017, 01:00

Ok, I'm still in 3.2.1 and this is what I see.

Code: Select all

guest@porteus:~$ cd /
guest@porteus:/$ ls -lh | grep tmp
drwxrwxrwt   9 root root  160 Jan  9 19:33 tmp/
guest@porteus:/$ 
hmmmm

Code: Select all

guest@porteus:~$ cd /
guest@porteus:/$ ls -lh 
total 0
drwxr-xr-x   2 root root 2.5K Nov 28 02:32 bin/
drwxr-xr-x  15 root root 3.1K Jan  9 19:31 dev/
drwxr-xr-x 105 root root  180 Jan  9 19:31 etc/
drwxr-xr-x   8 root root   60 Jan  9 19:30 home/
drwxr-xr-x  15 root root   60 Jan  9 19:31 lib/
drwxr-xr-x   2 root root  338 Nov 28 02:38 lib64/
drwxr-xr-x   2 root root    3 Nov 28 02:32 media/
drwxr-xr-x   8 root root  180 Jan  9 19:30 mnt/
drwxr-xr-x   6 root root   30 Sep 25  2013 opt/
dr-xr-xr-x 155 root root    0 Jan  9 19:30 proc/
drwx------  17 root root  200 Jan  9 19:31 root/
drwxr-xr-x   5 root root  120 Jan  9 19:31 run/
drwxr-xr-x   2 root root  139 Nov 29 22:42 sbin/
drwxr-xr-x   3 root root   26 Feb 27  2013 srv/
dr-xr-xr-x  12 root root    0 Jan  9 19:45 sys/
drwxrwxrwt   9 root root  160 Jan  9 19:33 tmp/
drwxr-xr-x  60 root root   60 Jan  9 19:30 usr/
drwxr-xr-x  43 root root  180 Jan  9 19:31 var/
guest@porteus:/$ 
Interesting. The patterns, not that I understand what they mean. :lol:
Ed

Post Reply