[systemd-devel] systemd-devel Digest, Vol 71, Issue 19

Marcos DeSousa contact.mdesousa at gmail.com
Sat Mar 19 12:29:58 UTC 2016


How to i unsubscribe from this list?

Sent from my iPhone

> On Mar 19, 2016, at 8:00 AM, systemd-devel-request at lists.freedesktop.org wrote:
> 
> Send systemd-devel mailing list submissions to
>    systemd-devel at lists.freedesktop.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>    https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> or, via email, send a message with subject or body 'help' to
>    systemd-devel-request at lists.freedesktop.org
> 
> You can reach the person managing the list at
>    systemd-devel-owner at lists.freedesktop.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of systemd-devel digest..."
> 
> 
> Today's Topics:
> 
>   1.  Suspend does not work from a service (Cecil Westerhof)
>   2.  udev removing and re-adding partition /dev entries after
>      read-write open close of whole disk device (Mike Fleetwood)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 18 Mar 2016 17:16:58 +0100
> From: Cecil Westerhof <cldwesterhof at gmail.com>
> To: systemd-devel at lists.freedesktop.org
> Subject: [systemd-devel] Suspend does not work from a service
> Message-ID:
>    <CAG-LmmAsX0naY4dt7Z_t+93usNeTL7bv7oDMHj0LGYqWrh6fHQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> I wrote as script to put my netbook into suspend when it is locked for five
> minutes and not connected to the AC adapter:
>    https://github.com/CecilWesterhof/BashLibrary/blob/master/bin/suspend.sh
> 
> This works perfect when I start it from the command-line, but not when I
> use it as a systemd service. Then I get:
>    Failed to start suspend.target: Access denied
> when the
>    systemctl suspend || true
> is executed.
> 
> ​What could be happening here? And how do I solve it?
> 
> My service file:
> [Unit]
> Description=Suspend machine when locked and no AC adaptor
> 
> [Service]
> Type=simple
> ExecStart=/usr/local/bash/bin/suspend.sh
> Restart=always
> User=cecil
> 
> [Install]
> WantedBy=multi-user.target
>> 
> ​On a related note​: why does:
>    systemctl suspend
> give an exit status of 1?
> And why does it returns immediately? I had to add a sleep 5 to my script to
> make it work.
> 
> -- 
> Cecil Westerhof
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160318/7df33988/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 18 Mar 2016 17:43:58 +0000
> From: Mike Fleetwood <mike.fleetwood at googlemail.com>
> To: systemd-devel at lists.freedesktop.org
> Subject: [systemd-devel] udev removing and re-adding partition /dev
>    entries after read-write open close of whole disk device
> Message-ID:
>    <CAMU1PDgYUBDv8srAQrs965Qw5bRhDn2hXzznQhb6cuEveWf75Q at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> Hi,
> 
> I've noticed that since approximately udev version 219, opening a whole
> disk device entry read-write, then closing it triggers udev to remove
> and re-create all the partition /dev entries.
> 
> Because of this GParted (graphical disk partitioning and file system
> manipulation tool) is sometimes failing.  Before each change GParted is
> using libparted to re-read the partition table, which ends up triggering
> udev to re-create the partition /dev entries.  Then GParted may go on to
> run a file system specific command such as an fsck, resize or similar on
> /dev/PTN.  However this command sometimes fails reporting the /dev/PTN
> does not exist because udev is still in the middle of removing and
> re-adding the required /dev entry.
> 
> Below is [1] a very simple test program and [2] an example failure.
> 
> So that I can correctly make GParted handle this behaviour on existing
> distributions can you tell me what version introduced this behaviour
> (commit(s) would be great) and why?  Also I assume that GParted should
> run "udevadm settle" to wait for the /dev partition entries to be
> re-created.
> 
> Thanks,
> Mike
> 
> [1] test program
> /* gcc -o c-test-0005 c-test-0005.c */
> 
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> int main(void)
> {
>    int fd = open("/dev/sdc", O_RDWR);
>    close(fd);
> 
>    char * const cmd[] = {"e2fsck", "-f", "-y", "-v", "-C", "0",
> "/dev/sdc3", NULL};
>    execvp("e2fsck", cmd);
>    return EXIT_SUCCESS;
> }
> 
> [2] example failure
> # udevadm monitor &
> ...
> # c-test-0005
> KERNEL[8995.600483] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc1
> (block)
> e2fsck 1.42.9 (28-Dec-2013)
> KERNEL[8995.606149] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc2
> (block)
> KERNEL[8995.606498] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc3
> (block)
> e2fsck: No such file or directory while trying to open /dev/sdc3
> Possibly non-existent device?
> KERNEL[8995.609880] change
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc
> (block)
> KERNEL[8995.610850] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc1
> (block)
> KERNEL[8995.611091] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc2
> (block)
> KERNEL[8995.614083] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc3
> (block)
> UDEV  [8995.631253] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc2
> (block)
> UDEV  [8995.638997] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc1
> (block)
> UDEV  [8995.642246] remove
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc3
> (block)
> UDEV  [8995.687918] change
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc
> (block)
> UDEV  [8995.726753] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc3
> (block)
> UDEV  [8995.749604] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc2
> (block)
> UDEV  [8995.773355] add
> /devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/sdc1
> (block)
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 
> 
> ------------------------------
> 
> End of systemd-devel Digest, Vol 71, Issue 19
> *********************************************


More information about the systemd-devel mailing list