WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: udev rules not being saved to backup  (Read 1978 times)

Offline richarde

  • Newbie
  • *
  • Posts: 10
udev rules not being saved to backup
« on: May 05, 2017, 09:00:02 AM »
I want to add rules to udev.
[I suspect I might need to reload-rules and trigger in bootlocal.sh but that is not the problem...yet.]

I have created my rules file (99-usb-alsa.rules) and copied it to /etc/udev/rules.d. It works as I want (creates a symlink when a device is added). In order that it should be persistent, I added the file pathname to /opt/.filelist.lst and performed a backup. But when I look at the contents of mydata.tgz, I don't see it?

Why would it not be backed up when other files under /etc are? What can I do to add udev rules from boot?

Here are the operations I described above:


tc@HubLink2:~$ ls /etc/udev/rules.d/
42-qemu-usb.rules            56-lsusb.rules               60-persistent-serial.rules   95-udev-late.rules
50-firmware.rules            60-cdrom_id.rules            60-persistent-storage.rules  98-tc.rules
50-udev-default.rules        60-persistent-alsa.rules     75-cd-dvd.rules              99-usb-alsa.rules
55-tc.rules                  60-persistent-input.rules    80-drivers.rules
tc@HubLink2:~$ cat /opt/.filetool.lst
opt
etc/udev/rules.d/99-usb-alsa.rules
home
etc/passwd
etc/shadow
etc/group
etc/gshadow
usr/local/etc/ssh/ssh_host_dsa_key
usr/local/etc/ssh/ssh_host_dsa_key.pub
usr/local/etc/ssh/ssh_host_ecdsa_key
usr/local/etc/ssh/ssh_host_ecdsa_key.pub
usr/local/etc/ssh/ssh_host_ed25519_key
usr/local/etc/ssh/ssh_host_ed25519_key.pub
usr/local/etc/ssh/ssh_host_rsa_key
usr/local/etc/ssh/ssh_host_rsa_key.pub
tc@HubLink2:~$ filetool.sh -b
Backing up files to /mnt/mmcblk0p2/tce/mydata.tgztc@HubLink2:~$
tc@HubLink2:~$ tar -tvf /etc/sysconfig/tcedir/mydata.tgz
drwxrwsr-x root/staff         0 2017-05-05 15:37:39 opt/
-rw-rw-r-- tc/staff       397 2017-05-05 15:37:39 opt/.filetool.lst
drwxr-sr-x tc/staff         0 1970-01-01 00:00:29 opt/MuLink/
-rwxr-xr-x tc/staff       744 2017-05-05 15:06:59 opt/MuLink/alsaname
-rw-rw-r-- root/staff        31 2014-12-31 07:54:50 opt/tcemirror
-rwxrwxr-x root/staff       277 2017-05-03 12:12:48 opt/bootsync.sh
-rwxrwxr-x root/staff       613 2014-12-31 07:54:50 opt/shutdown.sh
-rwxrwxr-x root/staff       395 2017-05-04 09:19:50 opt/bootlocal.sh
-rw-rw-r-- root/staff       145 2014-12-31 07:54:50 opt/.xfiletool.lst
drwxrwxr-x root/staff         0 1970-01-01 00:00:08 home/
drwxr-s--- tc/staff         0 2017-05-05 15:37:18 home/tc/
-rw-r--r-- tc/staff       115 2017-05-05 15:18:16 home/tc/rules.backup
-rwxr-xr-x tc/staff   3701593 2017-05-05 08:27:30 home/tc/hello
lrwxrwxrwx root/staff         0 1970-01-01 00:00:29 home/tc/nv -> /mnt/mmcblk0p2/nv
-rw-r--r-- tc/staff       446 2014-12-31 07:54:49 home/tc/.ashrc
-rw-r--r-- tc/staff       920 2014-12-31 07:54:49 home/tc/.profile
-rw-rw-r-- tc/staff      9786 2017-05-05 15:37:39 home/tc/.ash_history
-rw-r--r-- tc/staff        64 2017-05-04 20:25:51 home/tc/test.c
-rwxr-xr-x tc/staff      5120 2017-05-04 20:26:12 home/tc/a.out
-rw-r--r-- root/staff        21 2017-05-05 15:09:19 home/tc/udevtest.out
drwxr-s--- tc/staff         0 1970-01-01 00:00:06 home/tc/.local/
drwxr-s--- tc/staff         0 1970-01-01 00:00:06 home/tc/.local/bin/
drwxr-s--- tc/staff         0 1970-01-01 00:00:06 home/tc/.X.d/
-rw-rw-r-- root/staff       161 2014-12-31 14:48:50 etc/passwd
-rw-rw---- root/staff       135 2014-12-31 14:48:50 etc/shadow
-rw-rw-r-- root/staff        49 2014-12-31 07:54:49 etc/group
-rw-rw---- root/staff        44 2014-12-31 07:54:49 etc/gshadow
-rw------- root/root       668 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_dsa_key
-rw-r--r-- root/root       598 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_dsa_key.pub
-rw------- root/root       227 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_ecdsa_key
-rw-r--r-- root/root       170 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_ecdsa_key.pub
-rw------- root/root       399 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_ed25519_key
-rw-r--r-- root/root        90 1970-01-01 00:00:35 usr/local/etc/ssh/ssh_host_ed25519_key.pub
-rw------- root/root      1675 1970-01-01 00:00:30 usr/local/etc/ssh/ssh_host_rsa_key
-rw-r--r-- root/root       390 1970-01-01 00:00:30 usr/local/etc/ssh/ssh_host_rsa_key.pub
tc@HubLink2:~$


Can anyone suggest what I am doing wrong? If there is a fundamental constraint preventing this, is there a workaround?

Thanks,
Richard

Offline richarde

  • Newbie
  • *
  • Posts: 10
[SOLVED] Re: udev rules not being saved to backup
« Reply #1 on: May 05, 2017, 09:12:37 AM »
There was a trailing space on the relevant line in .filetool.lst.

I only found it by doing a hexdump of .filetool.lst. Remove that space and the rules file gets backed up.
Others beware.

Sorry to have bothered you...
Richard

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: udev rules not being saved to backup
« Reply #2 on: May 05, 2017, 09:28:56 AM »
Still interesting to know that a trailing space renders the entry invalid.
Have you added it manually or did you use the File Tool GUI?
Download a copy and keep it handy: Core book ;)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10960
Re: udev rules not being saved to backup
« Reply #3 on: May 05, 2017, 09:30:35 AM »
Those are easy to see in nano for example, when using shell highlighting.

nano -Y sh /opt/filetool.lst
The only barriers that can stop you are the ones you create yourself.

Offline richarde

  • Newbie
  • *
  • Posts: 10
Re: udev rules not being saved to backup
« Reply #4 on: May 05, 2017, 09:41:46 AM »
Yes I would have used nano, but without any flags. If there is a tool then I should have used that.

To be honest, I was using hexdump to look for CRLF-type issues and invisible characters. I hadn't expected the filetool to be so sensitive to whitespace.

I feel daft for posting the solution barely minutes after the question. I'd been banging my head against it for ages and spent over an hour googling and trawling the forums before registering for the forum and posting the question.

But on the plus side, I've shared the information and it might save others time.

Richard

Offline richarde

  • Newbie
  • *
  • Posts: 10
Re: udev rules not being saved to backup
« Reply #5 on: May 05, 2017, 09:45:30 AM »
Oh and I should add (for the benefit of anyone arriving here due to the subject line) that the udev rules worked fine on boot without any need to explicitly reload-rules or trigger. If the USB device is plugged in at boot, the symlink is there and it comes and goes as the device is connected and disconnected.

A good place to end on a Friday. Cheers.