Friday, May 18, 2012

eject(1), sulogin(1), wdctl(1)

The commands eject(1) and sulogin(1) have been merged into util-linux upstream.

eject(1)

The original eject(1) upstream is inactive for more than 4 years, but the command is actively used by many users and it's also used by system components like udisks. The command has been completely rewritten (by Michal Luscon and me). Changes:
  • linked with libmount
  • device may be addressed by UUID or LABEL
  • partition name is always converted to whole-disk device name to avoid eject SCSI ioctls on partition devices
  • uses /sys to get list of all partitions (all partitions are unmounted before eject)
  • patches from distributions (mostly Fedora) have been merged
  • code is about 1/3 shorter
Note that users who depend on the command volname(1) from the original eject package have to use
  blkid -p -o value -s LABEL device. 
sulogin(1)
 
util-linux and systemd upstreams ambition is to move initd independent commands to the generic util-linux package and minimize number of packages required for basic system.

We merged mountpoint(1) from sysvinit-tools into util-linux two releases ago, and sulogin(1) now. The command sulogin(1) is like login(1) but it's used in single user mode to supply the root password before a shell is started. The nice advantage is that we maintain login(1) and agetty(1) in the same source tree so we can share code and coordinate development.

wdctl(1)
 
wdctl(1) is a new small util that will be available in util-linux-2.22. The 'wd' means watchdog (unfortunately 'watchdog' is name already used for watchdog daemon, so we cannot use this name for command line util...).

wdctl(1) prints the current watchdog setting (flags), watchdog identity information and timeouts.

Default output:
  # wdctl                
  Identity:      iTCO_wdt [version 0]
  Timeout:       30 seconds
  Timeleft:       2 seconds
 
  FLAG           DESCRIPTION               STATUS BOOT-STATUS
  KEEPALIVEPING  Keep alive ping reply          0           0
  MAGICCLOSE     Supports magic close char      0           0
  SETTIMEOUT     Set timeout (in seconds)       0           0

or in script:
  KEEPALIVEPING=$(wdctl -ITnr -f KEEPALIVEPING -o STATUS)

Thanks to Lennart Poettering who provided the first prototype.

2 comments:

  1. Makes lots of sense. Nice work.

    About wdctl, I notice you can only specify 1 watchdog device.
    The kernel recently got support for multiple watchdog devices which is quite common.
    Might be nice to auto scan /dev/watchdog* or support specifying more than one device?

    Any plans to support patting the watchdog from this util? One thing I noticed from short lived utils manipulating the watchdog is that the kernel prints a warning about not having stopped the watchdog before close. That's a kernel issue though, so should be removed
    there IMHO.

    ReplyDelete
  2. > Might be nice to auto scan /dev/watchdog* or support specifying more...

    Good point, I'll implement it.

    > Any plans to support patting the watchdog from this util?

    Hmm.. send patch :-)

    ReplyDelete