iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored
@ 2024-03-09 21:11 Martin Petzold
  2024-03-11 15:25 ` Martin Petzold
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Petzold @ 2024-03-09 21:11 UTC (permalink / raw)
  To: iwd

I want to use bind mounts for /var/lib/iwd. However, I realized that 
sometimes (quit often and reproducible) a connection is not stored (I am 
working on an embedded device and we are talking about a single 
connection). I also realized that the directory has size zero (0) has no 
links and this is different to my other bind mounts.

Just now I cannot test, how the situation is on first boot (early). As I 
said, the situation comes up at some time.

This is a fundamental issue for me. What is going wrong?

#####

$ sudo ls -l /var/lib/
insgesamt 76
drwxr-xr-x  5 root root 4096 24. Feb 17:05 apt
drwxr-xr-x  3 root root 4096  8. Feb 2023  bluetooth <- also bind mount 
with same configuration (files are written)
drwxr-xr-x  2 root root 4096  3. Jul 2023  dbus
drwxr-xr-x  7 root root 4096  9. Mär 20:44 dpkg
drwxr-xr-x  2 root root 4096 22. Feb 2023  git
drwx------  0 root root    0  9. Mär 20:47 iwd <- bind mount with same 
configuration (files are NOT written)
drwxr-xr-x  2 root root 4096  9. Mär 00:00 logrotate
drwxr-xr-x  2 root root 4096  2. Apr 2023  misc
drwxr-xr-x  2 root root 4096  3. Jul 2023  pam
drwx------  3 root root 4096  3. Jul 2023  polkit-1
drwx------  2 root root 4096  3. Jul 2023  private
drwxr-xr-x  2 root root 4096  3. Jul 2023  python
drwxr-xr-x  2 root root 4096  3. Jul 2023  rauc <- also bind mount with 
same configuration (files are written)
drwxr-xr-x  3 root root 4096  3. Jul 2023  sudo
drwxr-xr-x 11 root root 4096  3. Jul 2023  systemd
drwxr-xr-x  2 tss  tss  4096 30. Nov 2020  tpm
drwxr-xr-x  3 root root 4096  3. Jul 2023  ucf
drwxr-xr-x  2 root root 4096 28. Jul 2023  xkb

#####

UUID=09ad77a3-80ed-4e27-8014-aa7bde4da14c       /       ext4 
defaults        0       1
LABEL=system  /system   ext4    defaults        0       2
LABEL=user    /home     ext4    defaults        0       2
LABEL=boot    /boot/script      ext4    defaults        0       2
/system/var/lib/bluetooth /var/lib/bluetooth none defaults,bind 0 0
/system/var/lib/iwd /var/lib/iwd none defaults,bind 0 0
/system/var/lib/rauc /var/lib/rauc none defaults,bind 0 0

#####

$ sudo iwctl --passphrase "<password>" station "wlan0" connect "<network>"

-> Connection to network is up, but NO connection is saved - no file 
exist (however, sometimes it is saved. Maybe only at the beginning and 
then not any more)

#####

Thanks,

Martin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored
  2024-03-09 21:11 Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored Martin Petzold
@ 2024-03-11 15:25 ` Martin Petzold
  2024-03-11 18:19   ` Bryce Johnson
  2024-03-12  3:02   ` Denis Kenzior
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Petzold @ 2024-03-11 15:25 UTC (permalink / raw)
  To: iwd

Maybe it is a bad idea to delete connection files while iwd is running? 
Or should I do an iwd restart after deleting connection files?

Is there an iwctl command to drop / forget ALL existing connections?

#####

Anyway, it also seems to be a bad idea to delete the underlying bind 
mount directory (/system/var/lib/iwd). I switched to only deleting the 
content of /var/lib/iwd with /bin/rm --recursive --force 
/var/lib/iwd/{*,.*}. However, this only works as root and not with sudo 
because of limited permissions on the iwd directory.

Some more system information: Debian 11, Kernel 5.10

Thanks,

Martin

Am 09.03.24 um 22:11 schrieb Martin Petzold:
> I want to use bind mounts for /var/lib/iwd. However, I realized that 
> sometimes (quit often and reproducible) a connection is not stored (I 
> am working on an embedded device and we are talking about a single 
> connection). I also realized that the directory has size zero (0) has 
> no links and this is different to my other bind mounts.
>
> Just now I cannot test, how the situation is on first boot (early). As 
> I said, the situation comes up at some time.
>
> This is a fundamental issue for me. What is going wrong?
>
> #####
>
> $ sudo ls -l /var/lib/
> insgesamt 76
> drwxr-xr-x  5 root root 4096 24. Feb 17:05 apt
> drwxr-xr-x  3 root root 4096  8. Feb 2023  bluetooth <- also bind 
> mount with same configuration (files are written)
> drwxr-xr-x  2 root root 4096  3. Jul 2023  dbus
> drwxr-xr-x  7 root root 4096  9. Mär 20:44 dpkg
> drwxr-xr-x  2 root root 4096 22. Feb 2023  git
> drwx------  0 root root    0  9. Mär 20:47 iwd <- bind mount with same 
> configuration (files are NOT written)
> drwxr-xr-x  2 root root 4096  9. Mär 00:00 logrotate
> drwxr-xr-x  2 root root 4096  2. Apr 2023  misc
> drwxr-xr-x  2 root root 4096  3. Jul 2023  pam
> drwx------  3 root root 4096  3. Jul 2023  polkit-1
> drwx------  2 root root 4096  3. Jul 2023  private
> drwxr-xr-x  2 root root 4096  3. Jul 2023  python
> drwxr-xr-x  2 root root 4096  3. Jul 2023  rauc <- also bind mount 
> with same configuration (files are written)
> drwxr-xr-x  3 root root 4096  3. Jul 2023  sudo
> drwxr-xr-x 11 root root 4096  3. Jul 2023  systemd
> drwxr-xr-x  2 tss  tss  4096 30. Nov 2020  tpm
> drwxr-xr-x  3 root root 4096  3. Jul 2023  ucf
> drwxr-xr-x  2 root root 4096 28. Jul 2023  xkb
>
> #####
>
> UUID=09ad77a3-80ed-4e27-8014-aa7bde4da14c       /       ext4 
> defaults        0       1
> LABEL=system  /system   ext4    defaults        0       2
> LABEL=user    /home     ext4    defaults        0       2
> LABEL=boot    /boot/script      ext4    defaults        0       2
> /system/var/lib/bluetooth /var/lib/bluetooth none defaults,bind 0 0
> /system/var/lib/iwd /var/lib/iwd none defaults,bind 0 0
> /system/var/lib/rauc /var/lib/rauc none defaults,bind 0 0
>
> #####
>
> $ sudo iwctl --passphrase "<password>" station "wlan0" connect 
> "<network>"
>
> -> Connection to network is up, but NO connection is saved - no file 
> exist (however, sometimes it is saved. Maybe only at the beginning and 
> then not any more)
>
> #####
>
> Thanks,
>
> Martin
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored
  2024-03-11 15:25 ` Martin Petzold
@ 2024-03-11 18:19   ` Bryce Johnson
  2024-03-11 18:40     ` Martin Petzold
  2024-03-12  3:02   ` Denis Kenzior
  1 sibling, 1 reply; 5+ messages in thread
From: Bryce Johnson @ 2024-03-11 18:19 UTC (permalink / raw)
  To: Martin Petzold; +Cc: iwd

Hi Martin,

> Is there an iwctl command to drop / forget ALL existing connections?
>
> #####

I would be interested if there was a way to do it with iwctl, but I
have a python script I use to forget all wifi networks, Here is the
important part:

#!/usr/bin/python3

import dbus

bus = dbus.SystemBus()

try:
    # IWD forgot section: based on
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/list-known-networks
    manager = dbus.Interface(bus.get_object('net.connman.iwd', '/'),
                            'org.freedesktop.DBus.ObjectManager')

    for path, interfaces in manager.GetManagedObjects().items():
        if 'net.connman.iwd.KnownNetwork' not in interfaces:
            continue

        network = interfaces['net.connman.iwd.KnownNetwork']

        obj = dbus.Interface(bus.get_object('net.connman.iwd', path),
                            'net.connman.iwd.KnownNetwork')
        obj.Forget()

        print("%s network forgotten in IWD" % network['Name'])


except:
    print("Skipping IWD forget network")
    pass

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored
  2024-03-11 18:19   ` Bryce Johnson
@ 2024-03-11 18:40     ` Martin Petzold
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Petzold @ 2024-03-11 18:40 UTC (permalink / raw)
  To: Bryce Johnson; +Cc: iwd

My solution in a systemd service is now:

ExecStart=-/usr/bin/bash -c '/usr/bin/rm --recursive --force 
/var/lib/iwd/{*,.*}'
ExecStart=-/usr/bin/systemctl restart iwd

# bash is required for '{*,.*}'

Am 11.03.24 um 19:19 schrieb Bryce Johnson:
> Hi Martin,
>
>> Is there an iwctl command to drop / forget ALL existing connections?
>>
>> #####
> I would be interested if there was a way to do it with iwctl, but I
> have a python script I use to forget all wifi networks, Here is the
> important part:
>
> #!/usr/bin/python3
>
> import dbus
>
> bus = dbus.SystemBus()
>
> try:
>      # IWD forgot section: based on
> https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/list-known-networks
>      manager = dbus.Interface(bus.get_object('net.connman.iwd', '/'),
>                              'org.freedesktop.DBus.ObjectManager')
>
>      for path, interfaces in manager.GetManagedObjects().items():
>          if 'net.connman.iwd.KnownNetwork' not in interfaces:
>              continue
>
>          network = interfaces['net.connman.iwd.KnownNetwork']
>
>          obj = dbus.Interface(bus.get_object('net.connman.iwd', path),
>                              'net.connman.iwd.KnownNetwork')
>          obj.Forget()
>
>          print("%s network forgotten in IWD" % network['Name'])
>
>
> except:
>      print("Skipping IWD forget network")
>      pass
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored
  2024-03-11 15:25 ` Martin Petzold
  2024-03-11 18:19   ` Bryce Johnson
@ 2024-03-12  3:02   ` Denis Kenzior
  1 sibling, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2024-03-12  3:02 UTC (permalink / raw)
  To: Martin Petzold, iwd

Hi Martin,

Please, no top posting.

On 3/11/24 10:25, Martin Petzold wrote:
> Maybe it is a bad idea to delete connection files while iwd is running? Or 
> should I do an iwd restart after deleting connection files?

iwd uses inotify to keep track of everything within the provisioning directory 
(/var/lib/iwd) and react to removal / modification / addition of profiles.  No 
restart should be needed, assuming your bind mounts support inotify properly.

> 
> Is there an iwctl command to drop / forget ALL existing connections?

Not today. You have to iterate over all known networks or rm *.* in 
/var/lib/iwd.  Patches are always welcome though.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-12  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09 21:11 Using bind mount for /var/lib/iwd results in zero directory (and no links) and no connections stored Martin Petzold
2024-03-11 15:25 ` Martin Petzold
2024-03-11 18:19   ` Bryce Johnson
2024-03-11 18:40     ` Martin Petzold
2024-03-12  3:02   ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).