Re: [systemd-devel] udev device mapper rules for early boot?
'Twas brillig, and Nikolaus Rath at 10/12/12 19:03 did gyre and gimble: > Hello, > > I have created a udev rule to set the owner of a specific block device: > > SUBSYSTEM=="block", > ENV{DM_UUID}=="LVM-yYuoI8k05GWxZnz9BeEIwPUGGeojzF3dZZmXTYRqC051Tllj76OHdDlzYhKZUu7u", > OWNER="1000" > > If I disable and re-enable this logical volume with lvchange, it gets > created with the correct owner. > > However, when I boot the computer, the device is always owned by > root:disk instead. > > I checked my initrd, and the rule is present in lib/udev/rules.d as > 99-udev-custom.rules. > > Does anyone have a suggestion of how I could debug this further? Why is > my rule ignored when the volume comes up the first time? Random guess: does that user exist in the context of the initrd? I'd imagine any getent() calls would fail in the context of an initrd unless you copy all the passwd+group etc. files too (which is arguably not a good idea, but perhaps you can hack it in some small way)? Like I say, just a guess. -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] udev device mapper rules for early boot?
On 12/11/2012 03:00 AM, Colin Guthrie wrote: > 'Twas brillig, and Nikolaus Rath at 10/12/12 19:03 did gyre and gimble: >> Hello, >> >> I have created a udev rule to set the owner of a specific block device: >> >> SUBSYSTEM=="block", >> ENV{DM_UUID}=="LVM-yYuoI8k05GWxZnz9BeEIwPUGGeojzF3dZZmXTYRqC051Tllj76OHdDlzYhKZUu7u", >> OWNER="1000" >> >> If I disable and re-enable this logical volume with lvchange, it gets >> created with the correct owner. >> >> However, when I boot the computer, the device is always owned by >> root:disk instead. >> >> I checked my initrd, and the rule is present in lib/udev/rules.d as >> 99-udev-custom.rules. >> >> Does anyone have a suggestion of how I could debug this further? Why is >> my rule ignored when the volume comes up the first time? > Random guess: does that user exist in the context of the initrd? No. But that shouldn't be a problem. The other rules in the initrd also refer to non-existing users (e.g. disk). I guess udev just waits until passwd becomes available. Also, I tried specifying the UID instead of the name, but that didn't help either. Best, Niko ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] udev device mapper rules for early boot?
'Twas brillig, and Nikolaus Rath at 11/12/12 16:31 did gyre and gimble: > On 12/11/2012 03:00 AM, Colin Guthrie wrote: >> 'Twas brillig, and Nikolaus Rath at 10/12/12 19:03 did gyre and gimble: >>> Hello, >>> >>> I have created a udev rule to set the owner of a specific block device: >>> >>> SUBSYSTEM=="block", >>> ENV{DM_UUID}=="LVM-yYuoI8k05GWxZnz9BeEIwPUGGeojzF3dZZmXTYRqC051Tllj76OHdDlzYhKZUu7u", >>> OWNER="1000" >>> >>> If I disable and re-enable this logical volume with lvchange, it gets >>> created with the correct owner. >>> >>> However, when I boot the computer, the device is always owned by >>> root:disk instead. >>> >>> I checked my initrd, and the rule is present in lib/udev/rules.d as >>> 99-udev-custom.rules. >>> >>> Does anyone have a suggestion of how I could debug this further? Why is >>> my rule ignored when the volume comes up the first time? >> Random guess: does that user exist in the context of the initrd? > No. But that shouldn't be a problem. The other rules in the initrd also > refer to non-existing users (e.g. disk). Are you sure that "disk" is the user here and not the group? Keep in mind that dracut copies /etc/group to the initrd but only includes a cut down /etc/passwd with just root and nobody defined... > I guess udev just waits until > passwd becomes available. Also, I tried specifying the UID instead of > the name, but that didn't help either. I don't think udev "waits until passwd becomes available". It's just a hit and hope effort AFAIUI. You'll need to teach your initrd about your user if you want it to be owned by your user (i.e. somehow modify the dracut module modules.d/99base/module-setup.sh or better add a new module "99myuser" or whatever, that is just a basic stub that just adds your user - that way your change survives distro updates). If you don't really care about the owner and the group is actually enough for your needs then that should work fine (due to dracut copying /etc/group from your system) - assuming of course that's where your group is defined and it's not on some LDAP or YP/NIS system somewhere. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] udev device mapper rules for early boot?
On 12/11/2012 09:47 AM, Colin Guthrie wrote: > 'Twas brillig, and Nikolaus Rath at 11/12/12 16:31 did gyre and gimble: >> On 12/11/2012 03:00 AM, Colin Guthrie wrote: >>> 'Twas brillig, and Nikolaus Rath at 10/12/12 19:03 did gyre and gimble: Hello, I have created a udev rule to set the owner of a specific block device: SUBSYSTEM=="block", ENV{DM_UUID}=="LVM-yYuoI8k05GWxZnz9BeEIwPUGGeojzF3dZZmXTYRqC051Tllj76OHdDlzYhKZUu7u", OWNER="1000" If I disable and re-enable this logical volume with lvchange, it gets created with the correct owner. However, when I boot the computer, the device is always owned by root:disk instead. I checked my initrd, and the rule is present in lib/udev/rules.d as 99-udev-custom.rules. Does anyone have a suggestion of how I could debug this further? Why is my rule ignored when the volume comes up the first time? >>> Random guess: does that user exist in the context of the initrd? >> No. But that shouldn't be a problem. The other rules in the initrd also >> refer to non-existing users (e.g. disk). > Are you sure that "disk" is the user here and not the group? Keep in > mind that dracut copies /etc/group to the initrd but only includes a cut > down /etc/passwd with just root and nobody defined... Yes, it's the group rather than the user. But no, that doesn't make a difference. My initrd has neither /etc/group nor /etc/passwd. I'm using Debian, so it's created with initramfs-tools rather than Dracut. > >> I guess udev just waits until >> passwd becomes available. Also, I tried specifying the UID instead of >> the name, but that didn't help either. > I don't think udev "waits until passwd becomes available". It's just a > hit and hope effort AFAIUI. > > You'll need to teach your initrd about your user if you want it to be > owned by your user (i.e. somehow modify the dracut module > modules.d/99base/module-setup.sh or better add a new module "99myuser" > or whatever, that is just a basic stub that just adds your user - that > way your change survives distro updates). If that's the problem, why doesn't it help to specify the uid? Thanks, Niko ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] iscsi unit files and helper script
On Tue, Dec 11, 2012 at 03:47:03PM -0600, Mike Christie wrote: > Thanks for working on this. Just one question. Is this patch for some > other package? How does it relate to the unit files in Tomasz's > patchset? He unit files with the same name. I just diffed against an empty directory to show what I was testing with, it might have made more sense for this to not be a patch but I was on a roll. There's a difference between running as forking or simple here, but that's not a big deal. And I've been making changes to my iscsi.service for automatic starting and stoping of sessions today, getting the ordering right to not run into problems with automatic mount points. I haven't run into any problems with the patches I posted, but I'm not happy with the unit files just yet. - Chris > On 12/10/2012 04:08 PM, Chris Leech wrote: > > iSCSI service and socket files, and the iscsi_mark_root_nodes helper script > > to > > preserve sessions started in the initramfs. > > > > diff -Naur a/iscsid.service b/iscsid.service > > --- a/iscsid.service1969-12-31 16:00:00.0 -0800 > > +++ b/iscsid.service2012-12-10 13:38:38.643307001 -0800 > > @@ -0,0 +1,9 @@ > > +[Unit] > > +Description=Open-iSCSI > > +Documentation=man:iscsid(8) man:iscsiadm(8) > > +After=network.target NetworkManager-wait-online.service iscsiuio.service > > tgtd.service targetcli.service > > + > > +[Service] > > +Type=simple > > +ExecStart=/usr/sbin/iscsid -f -n > > +ExecStop=/sbin/iscsiadm -k 0 2 > > diff -Naur a/iscsid.socket b/iscsid.socket > > --- a/iscsid.socket 1969-12-31 16:00:00.0 -0800 > > +++ b/iscsid.socket 2012-12-10 13:38:38.643307001 -0800 > > @@ -0,0 +1,9 @@ > > +[Unit] > > +Description=Open-iSCSI iscsid Socket > > +Documentation=man:iscsid(8) man:iscsiadm(8) > > + > > +[Socket] > > +ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE > > + > > +[Install] > > +WantedBy=sockets.target > > diff -Naur a/iscsi.service b/iscsi.service > > --- a/iscsi.service 1969-12-31 16:00:00.0 -0800 > > +++ b/iscsi.service 2012-12-10 13:38:38.643307001 -0800 > > @@ -0,0 +1,18 @@ > > +[Unit] > > +Description=Login and scanning of iSCSI devices > > +Documentation=man:iscsiadm(8) man:iscsid(8) > > +#Requires=iscsid.service > > +#BindTo=iscsid.service > > +After=network.target NetworkManager-wait-online.service iscsid.service > > +ConditionPathExists=/etc/iscsi/initiatorname.iscsi > > + > > +[Service] > > +Type=oneshot > > +ExecStart=/usr/libexec/iscsi_mark_root_nodes > > +ExecStart=/sbin/iscsiadm -m node --loginall=automatic > > +ExecStop=/bin/sync > > +ExecStop=/sbin/iscsiadm -m node --logoutall=automatic > > +RemainAfterExit=true > > + > > +[Install] > > +WantedBy=remote-fs.target > > diff -Naur a/iscsiuio.service b/iscsiuio.service > > --- a/iscsiuio.service 1969-12-31 16:00:00.0 -0800 > > +++ b/iscsiuio.service 2012-12-10 13:38:38.643307001 -0800 > > @@ -0,0 +1,11 @@ > > +[Unit] > > +Description=iSCSI UserSpace I/O driver > > +Documentation=man:iscsiuio(8) > > +Requires=iscsid.service > > +BindTo=iscsid.service > > +Before=iscsid.service > > +After=network.target NetworkManager-wait-online.service > > + > > +[Service] > > +Type=simple > > +ExecStart=/usr/sbin/iscsiuio -f > > diff -Naur a/iscsiuio.socket b/iscsiuio.socket > > --- a/iscsiuio.socket 1969-12-31 16:00:00.0 -0800 > > +++ b/iscsiuio.socket 2012-12-10 13:38:38.643307001 -0800 > > @@ -0,0 +1,9 @@ > > +[Unit] > > +Description=Open-iSCSI iscsiuio > > +Documentation=man:iscsiuio(8) > > + > > +[Socket] > > +ListenStream=@ISCSID_UIP_ABSTRACT_NAMESPACE > > + > > +[Install] > > +WantedBy=sockets.target > > diff -Naur a/usr/libexec/iscsi_mark_root_nodes > > b/usr/libexec/iscsi_mark_root_nodes > > --- a/usr/libexec/iscsi_mark_root_nodes 1969-12-31 16:00:00.0 > > -0800 > > +++ b/usr/libexec/iscsi_mark_root_nodes 2012-12-10 13:38:47.322082141 > > -0800 > > @@ -0,0 +1,14 @@ > > +#!/bin/bash > > + > > +ISCSIADM=/sbin/iscsiadm > > +SESSION_FILE=/run/initramfs/iscsi.sessions > > + > > +if [ ! -f $SESSION_FILE ] ; then > > + exit 0 > > +fi > > + > > +while read t num i target; do > > + ip=${i%:*} > > + $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot > > +done < $SESSION_FILE > > + > > > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] iscsid / systemd / dracut integration effort
On Mon, Dec 10, 2012 at 11:56:07PM +, "Jóhann B. Guðmundsson" wrote: > On 12/10/2012 10:08 PM, Chris Leech wrote: > > > >2) Proper ordering of the iscsi.service for non-root filesystems. > > > >Any and all feedback and/or help welcome. > > > > Looking the unit file for iscsid I do believe I missed this ( > basically the same as multipath unit ) since you know it's early > boot special, root and all that ;) > > [Unit] > > # Before or After lvm2-activation-early.service > DefaultDependencies=no > Conflicts=shutdown.target > > [Install] > WantedBy=sysinit.target Thanks, this got me going in the right direction. These unit files seems to be working much better for me, with the startup and shutdown ordering between iscsi, iscsid, and remote-fs mounts sorted out. I'm not sure about the tgtd/targetcli stuff, not sure what the original need there was. My non-root test install with /home on iSCSI also has a swap partition on it, and that's still causing me all sorts of trouble if I don't comment it out in fstab. Trying to order all this before swap.target blew up in my face pretty good. - Chris --- iscsi.service --- [Unit] Description=Login and scanning of iSCSI devices Documentation=man:iscsiadm(8) man:iscsid(8) DefaultDependencies=no Conflicts=shutdown.target After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service Before=remote-fs.target ConditionPathExists=/etc/iscsi/initiatorname.iscsi [Service] Type=oneshot ExecStart=/usr/libexec/iscsi_mark_root_nodes ExecStart=/sbin/iscsiadm -m node --loginall=automatic ExecStop=/bin/sync ExecStop=/sbin/iscsiadm -m node --logoutall=automatic RemainAfterExit=true [Install] WantedBy=sysinit.target --- iscsid.service --- [Unit] Description=Open-iSCSI Documentation=man:iscsid(8) man:iscsiadm(8) DefaultDependencies=no Conflicts=shutdown.target After=network.target tgtd.service targetcli.service Before=remote-fs-pre.target [Service] Type=simple ExecStart=/usr/sbin/iscsid -f -n ExecStop=/sbin/iscsiadm -k 0 2 --- iscsid.socket --- [Unit] Description=Open-iSCSI iscsid Socket Documentation=man:iscsid(8) man:iscsiadm(8) [Socket] ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE [Install] WantedBy=sockets.target ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] iscsid / systemd / dracut integration effort
On 12/11/2012 11:26 PM, Chris Leech wrote: On Mon, Dec 10, 2012 at 11:56:07PM +, "Jóhann B. Guðmundsson" wrote: On 12/10/2012 10:08 PM, Chris Leech wrote: 2) Proper ordering of the iscsi.service for non-root filesystems. Any and all feedback and/or help welcome. Looking the unit file for iscsid I do believe I missed this ( basically the same as multipath unit ) since you know it's early boot special, root and all that ;) [Unit] # Before or After lvm2-activation-early.service DefaultDependencies=no Conflicts=shutdown.target [Install] WantedBy=sysinit.target Thanks, this got me going in the right direction. These unit files seems to be working much better for me, with the startup and shutdown ordering between iscsi, iscsid, and remote-fs mounts sorted out. I'm not sure about the tgtd/targetcli stuff, not sure what the original need there was. You should remove if it's not necessary for iscsi to function and the ordering for iscsi be put in those units instead My non-root test install with /home on iSCSI also has a swap partition on it, and that's still causing me all sorts of trouble if I don't comment it out in fstab. Hmm even if you add noauto after the relevant swap entry in /etc/fstab actually it might be necessary for you to create a .swap unit for it. ( man systemd.swap for details ) Trying to order all this before swap.target blew up in my face pretty good. You should not order it after the swap.target however you can order .swap unit before the swap.target - Chris --- iscsi.service --- [Unit] Description=Login and scanning of iSCSI devices Documentation=man:iscsiadm(8) man:iscsid(8) DefaultDependencies=no Conflicts=shutdown.target After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service Before=remote-fs.target ConditionPathExists=/etc/iscsi/initiatorname.iscsi [Service] Type=oneshot ExecStart=/usr/libexec/iscsi_mark_root_nodes ExecStart=/sbin/iscsiadm -m node --loginall=automatic ExecStop=/bin/sync ExecStop=/sbin/iscsiadm -m node --logoutall=automatic RemainAfterExit=true [Install] WantedBy=sysinit.target --- iscsid.service --- [Unit] Description=Open-iSCSI Documentation=man:iscsid(8) man:iscsiadm(8) DefaultDependencies=no Conflicts=shutdown.target After=network.target tgtd.service targetcli.service Before=remote-fs-pre.target [Service] Type=simple ExecStart=/usr/sbin/iscsid -f -n ExecStop=/sbin/iscsiadm -k 0 2 --- iscsid.socket --- [Unit] Description=Open-iSCSI iscsid Socket Documentation=man:iscsid(8) man:iscsiadm(8) [Socket] ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE [Install] WantedBy=sockets.target So it seems to be in ready enough to be pushed to rawhide and the next step is to boot with "systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M enforcing=0" in the kernel command line to actually see why that's blowing up in your face. One question the iscsid is calling fork() right so why are you so incline to use type simple for it? There is an ordering gotcha when using type simple units which boils to systemd has no way of knowing if what it just fired up is finished running/setup etc. ( unless notified ) so you might find yourself in a race condition. JBG ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] iscsi unit files and helper script
Thanks for working on this. Just one question. Is this patch for some other package? How does it relate to the unit files in Tomasz's patchset? He unit files with the same name. On 12/10/2012 04:08 PM, Chris Leech wrote: > iSCSI service and socket files, and the iscsi_mark_root_nodes helper script to > preserve sessions started in the initramfs. > > diff -Naur a/iscsid.service b/iscsid.service > --- a/iscsid.service 1969-12-31 16:00:00.0 -0800 > +++ b/iscsid.service 2012-12-10 13:38:38.643307001 -0800 > @@ -0,0 +1,9 @@ > +[Unit] > +Description=Open-iSCSI > +Documentation=man:iscsid(8) man:iscsiadm(8) > +After=network.target NetworkManager-wait-online.service iscsiuio.service > tgtd.service targetcli.service > + > +[Service] > +Type=simple > +ExecStart=/usr/sbin/iscsid -f -n > +ExecStop=/sbin/iscsiadm -k 0 2 > diff -Naur a/iscsid.socket b/iscsid.socket > --- a/iscsid.socket 1969-12-31 16:00:00.0 -0800 > +++ b/iscsid.socket 2012-12-10 13:38:38.643307001 -0800 > @@ -0,0 +1,9 @@ > +[Unit] > +Description=Open-iSCSI iscsid Socket > +Documentation=man:iscsid(8) man:iscsiadm(8) > + > +[Socket] > +ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE > + > +[Install] > +WantedBy=sockets.target > diff -Naur a/iscsi.service b/iscsi.service > --- a/iscsi.service 1969-12-31 16:00:00.0 -0800 > +++ b/iscsi.service 2012-12-10 13:38:38.643307001 -0800 > @@ -0,0 +1,18 @@ > +[Unit] > +Description=Login and scanning of iSCSI devices > +Documentation=man:iscsiadm(8) man:iscsid(8) > +#Requires=iscsid.service > +#BindTo=iscsid.service > +After=network.target NetworkManager-wait-online.service iscsid.service > +ConditionPathExists=/etc/iscsi/initiatorname.iscsi > + > +[Service] > +Type=oneshot > +ExecStart=/usr/libexec/iscsi_mark_root_nodes > +ExecStart=/sbin/iscsiadm -m node --loginall=automatic > +ExecStop=/bin/sync > +ExecStop=/sbin/iscsiadm -m node --logoutall=automatic > +RemainAfterExit=true > + > +[Install] > +WantedBy=remote-fs.target > diff -Naur a/iscsiuio.service b/iscsiuio.service > --- a/iscsiuio.service1969-12-31 16:00:00.0 -0800 > +++ b/iscsiuio.service2012-12-10 13:38:38.643307001 -0800 > @@ -0,0 +1,11 @@ > +[Unit] > +Description=iSCSI UserSpace I/O driver > +Documentation=man:iscsiuio(8) > +Requires=iscsid.service > +BindTo=iscsid.service > +Before=iscsid.service > +After=network.target NetworkManager-wait-online.service > + > +[Service] > +Type=simple > +ExecStart=/usr/sbin/iscsiuio -f > diff -Naur a/iscsiuio.socket b/iscsiuio.socket > --- a/iscsiuio.socket 1969-12-31 16:00:00.0 -0800 > +++ b/iscsiuio.socket 2012-12-10 13:38:38.643307001 -0800 > @@ -0,0 +1,9 @@ > +[Unit] > +Description=Open-iSCSI iscsiuio > +Documentation=man:iscsiuio(8) > + > +[Socket] > +ListenStream=@ISCSID_UIP_ABSTRACT_NAMESPACE > + > +[Install] > +WantedBy=sockets.target > diff -Naur a/usr/libexec/iscsi_mark_root_nodes > b/usr/libexec/iscsi_mark_root_nodes > --- a/usr/libexec/iscsi_mark_root_nodes 1969-12-31 16:00:00.0 > -0800 > +++ b/usr/libexec/iscsi_mark_root_nodes 2012-12-10 13:38:47.322082141 > -0800 > @@ -0,0 +1,14 @@ > +#!/bin/bash > + > +ISCSIADM=/sbin/iscsiadm > +SESSION_FILE=/run/initramfs/iscsi.sessions > + > +if [ ! -f $SESSION_FILE ] ; then > + exit 0 > +fi > + > +while read t num i target; do > + ip=${i%:*} > + $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot > +done < $SESSION_FILE > + > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel