Bug 519237 - -bash: cannot set terminal process group (-1): Inappropriate ioctl for device
Summary: -bash: cannot set terminal process group (-1): Inappropriate ioctl for device
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux-ng
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 527312 (view as bug list)
Depends On:
Blocks: F12VirtBlocker F12Beta, F12BetaBlocker
TreeView+ depends on / blocked
 
Reported: 2009-08-25 19:38 UTC by James Laska
Modified: 2013-09-02 06:39 UTC (History)
21 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-05 19:49:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
`ps -AZ` when booting with dracut ramdisk (5.77 KB, text/plain)
2009-10-01 14:54 UTC, James Laska
no flags Details
`ps -AZ` when booting with mkinitrd ramdisk (6.36 KB, text/plain)
2009-10-01 14:55 UTC, James Laska
no flags Details

Description James Laska 2009-08-25 19:38:13 UTC
Description of problem:

Not sure if this is the correct component, but logins on a KVM serial console install of F-12-Alpha do not have bash job control enabled.  

Version-Release number of selected component (if applicable):
 * mingetty-1.08-4.fc12.i686
 
How reproducible:

 * every time so far

Steps to Reproduce:
1. Install F-12-Alpha (or rawhide-2009-08-25) using KVM with console=ttyS0
2. Select partition and package defaults
3. Boot installed system and attempt to login (via virsh console $guestname)
  
Actual results:

Fedora release 11.91 (Rawhide)
Kernel 2.6.31-0.174.rc7.git2.fc12.i686.PAE on an i686 (/dev/ttyS0)

test1222.test.redhat.com login: root
Password: 
Last login: Tue Aug 25 15:13:09 on ttyS0
-bash: cannot set terminal process group (-1): Inappropriate ioctl for device
-bash: no job control in this shell



Expected results:


Additional info:

Comment 1 James Laska 2009-09-03 18:29:56 UTC
Still a problem on rawhide-20090903 installs.

The common factor I believe is systems without a local console ... that are accessed only by a serial console (e.g. virt and server-class systems).

Comment 2 John Poelstra 2009-09-11 15:44:16 UTC
This bug was reviewed at the Fedora 12 Beta Blocker bug meeting on 2009-09-11. Not sure if we have the correct component identified, but taking a stab by changing to 'upstart'.  Need feedback from upstart maintainer.

Comment 3 John Poelstra 2009-09-18 15:47:17 UTC
This bug was reviewed at the Fedora 12 Beta Blocker bug meeting on 2009-09-18.  Nobody is still clear what component this bug belongs to.  Trying "kernel" next.

Per cdahlin "if the serial console is the primary console upstart might mess with it a bit, but other than that the only place upstart touches serial console is indirectly via agetty."

Possibly related to https://bugzilla.redhat.com/show_bug.cgi?id=514022

Comment 4 Mark McLoughlin 2009-09-21 09:14:39 UTC
(In reply to comment #3)
 
> Possibly related to bug #514022

That's a dracut issue which harald has closed wontfix - can anyone confirm this only happens with a dracut initramfs?

Also, it seems now that Ctrl-C in a serial console causes the machine to shutdown; I think that's probably relatwd

Comment 5 Justin M. Forbes 2009-09-24 19:09:01 UTC
I can confirm that this only happens with a dracut initramfs.  It does not happen with mkinitrd created images.

Comment 6 Adam Williamson 2009-09-25 15:17:36 UTC
dracut guys, please note that this bug is blocking the Beta release, and if possibly expedite accordingly - thanks!

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 7 Harald Hoyer 2009-09-25 15:30:10 UTC
This is what helped me:

        /* get session leader */
        setsid();

        /* set controlling terminal */
        if (ioctl (0, TIOCSCTTY, 1))
                warn("failed to TIOCSCTTY");


and maybe reset the terminal... nevertheless dracut can't do that, because it is a shell script. Though switch_root should have already done this for /sbin/init.

Comment 8 Harald Hoyer 2009-09-30 15:05:02 UTC
are you sure this is only with dracut?
what does:

# rpm -q util-linux-ng
# rpm -q dracut
# dmesg | grep dracut

output?

Comment 9 Zing 2009-09-30 17:37:37 UTC
I just tried with mkinitrd... it doesn't happen.
hth:
# rpm -q util-linux-ng dracut
util-linux-ng-2.16-10.fc12.x86_64
dracut-002-8.git845dd502.fc12.noarch
# dmesg|grep dracut
dracut: dracut-002-8.git845dd502.fc12
dracut: Starting plymouth daemon
dracut: Scanning devices vda2  for LVM volume groups
dracut: Reading all physical volumes. This may take a while...
dracut: Found volume group "VolGroup" using metadata type lvm2
dracut: 2 logical volume(s) in volume group "VolGroup" now active
dracut: Mounted root filesystem /dev/mapper/VolGroup-lv_root
dracut: Loading SELinux policy
dracut: Switching root
# rpm -q mkinitrd
mkinitrd-6.0.93-1.fc12.x86_64

Comment 10 Zing 2009-09-30 17:50:21 UTC
hmmm, this is something to do with selinux.  I just disabled selinux (selinux=0) and no error... maybe sometype of policy restriction on ttyS's?

Comment 11 Zing 2009-09-30 19:07:00 UTC
Here is the avc:

time->Wed Sep 30 14:54:14 2009
type=SYSCALL msg=audit(1254336854.428:24): arch=c000003e syscall=16 success=yes exit=0 a0=0 a1=540e a2=1 a3=676f6c2f7665642f items=0 ppid=1461 pid=1520 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=2 comm="login" exe="/bin/login" subj=system_u:system_r:local_login_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1254336854.428:24): avc:  denied  { sys_admin } for  pid=1520 comm="login" capability=21 scontext=system_u:system_r:local_login_t:s0-s0:c0.c1023 tcontext=system_u:system_r:local_login_t:s0-s0:c0.c1023 tclass=capability
# ausearch -a 24 -ts recent | audit2allow -w
type=AVC msg=audit(1254336854.428:24): avc:  denied  { sys_admin } for  pid=1520 comm="login" capability=21 scontext=system_u:system_r:local_login_t:s0-s0:c0.c1023 tcontext=system_u:system_r:local_login_t:s0-s0:c0.c1023 tclass=capability

        Was caused by:
        The boolean allow_polyinstantiation was set incorrectly.
        Description:
        Enable polyinstantiated directory support.

        Allow access by executing:
        # setsebool -P allow_polyinstantiation 1

Suffice to say, setting that bool allows bash job control now.

Comment 12 Daniel Walsh 2009-09-30 20:16:34 UTC
The question I have is whether this is just the console being configured
incorrectly since we have never needed this access in the past.  sys_admin is a
powerful capability.  I can turn it on easily enough and will in tonight's
rawhide.  But I would really like to know if it is really necessary.

Comment 13 James Laska 2009-10-01 13:01:42 UTC
Daniel, I'm not sure I can answer the question you ask ... but I'm able to easily reproduce this by doing a 'serial console=ttyS0' KVM virt install of rawhide.  I can give remote access to the system if that would help diagnose any changes which may have introduced this issue.

Comment 14 James Laska 2009-10-01 13:08:48 UTC
(In reply to comment #9)
> I just tried with mkinitrd... it doesn't happen.

Interesting finding ... same issue here.  mkinitrd booting doesn't exhibit the problem, while dracut ramdisk boot does.

Comment 15 Mark McLoughlin 2009-10-01 13:21:05 UTC
(In reply to comment #13)
> Daniel, I'm not sure I can answer the question you ask 

The question is for Harald, I think

Comment 16 Daniel Walsh 2009-10-01 13:23:19 UTC
Yes I guess Harald is the one who might be able to answer it.

Comment 17 Casey Dahlin 2009-10-01 13:51:55 UTC
Could someone give the output of ps -AZ on a system that does not display the issue, then on one that does?

Comment 18 Casey Dahlin 2009-10-01 13:53:01 UTC
That made a lot more sense in my head. What I meant to say is give the output of ps -AZ after booting with a mkinitrd initrd, then one with a dracut initrd.

Comment 19 James Laska 2009-10-01 14:54:59 UTC
Created attachment 363347 [details]
`ps -AZ` when booting with dracut ramdisk

Comment 20 James Laska 2009-10-01 14:55:48 UTC
Created attachment 363348 [details]
`ps -AZ` when booting with mkinitrd ramdisk

Comment 21 Mark McLoughlin 2009-10-01 15:16:25 UTC
interesting, init's TTY field is ttyS0 with dracut, but ? with mkinitrd

Comment 22 Harald Hoyer 2009-10-01 15:16:43 UTC
ok, kzak, remove the ioctl() and setsid() from switch_root then

Comment 23 Karel Zak 2009-10-02 09:31:54 UTC
(In reply to comment #22)
> ok, kzak, remove the ioctl() and setsid() from switch_root then  

Fixed in the devel (F-13, rawhide), download the package from:
http://koji.fedoraproject.org/koji/buildinfo?buildID=134822

Please, confirm the bugfix, then I'll update the package in F-12.

Comment 24 James Laska 2009-10-02 13:58:55 UTC
Tested (In reply to comment #23)
> (In reply to comment #22)
> > ok, kzak, remove the ioctl() and setsid() from switch_root then  
> 
> Fixed in the devel (F-13, rawhide), download the package from:
> http://koji.fedoraproject.org/koji/buildinfo?buildID=134822
> 
> Please, confirm the bugfix, then I'll update the package in F-12.  

Tested updated packages in a i386 kvm guest that was exhibiting this problem.  The problem remains.

Fedora release 11.91 (Rawhide)
Kernel 2.6.31.1-56.fc12.i686.PAE on an i686 (/dev/ttyS0)

test120.test.redhat.com login: root
Password: 
Last login: Fri Oct  2 09:53:27 on ttyS0
-bash: cannot set terminal process group (-1): Inappropriate ioctl for device
-bash: no job control in this shell

[root@test120 ~]# rpm -qa util-linux-ng libblkid* uuid*
util-linux-ng-2.16-12.fc13
libblkid-2.16-12.fc13
libuuid-2.16-12.fc13

Comment 25 Karel Zak 2009-10-02 18:02:10 UTC
(In reply to comment #24)
> Tested updated packages in a i386 kvm guest that was exhibiting this problem. 
> The problem remains.

 I guess you need to rebuild your initrd by dracut. The bugfix is in the switch_root command witch we use in dracut initrd images.

Comment 26 Adam Williamson 2009-10-02 18:11:33 UTC
oh good, my guess was right - I suggested the same thing to jlaska during the blocker review meeting. He should provide updated test results soon.

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 27 James Laska 2009-10-02 19:08:29 UTC
I rebuilt the initrd using ...

# rpm -q util-linux-ng libuuid libblkid
util-linux-ng-2.16-12.fc13.x86_64
libuuid-2.16-12.fc13.x86_64
libblkid-2.16-12.fc13.x86_64

# dracut --force /boot/initramfs-$(uname -r).img $(uname -r)

# uname -r
2.6.31.1-56.fc12.x86_64

# grep initramfs /etc/grub.conf 
	initrd /initramfs-2.6.31.1-56.fc12.x86_64.img

# reboot

...

Fedora release 11.91 (Rawhide)
Kernel 2.6.31.1-56.fc12.x86_64 on an x86_64 (/dev/ttyS0)

test1221.test.redhat.com login: root
Password: 
Last login: Fri Oct  2 14:54:11 on ttyS0
-bash: cannot set terminal process group (-1): Inappropriate ioctl for device
-bash: no job control in this shell


Could I still be doing something wrong?

Comment 28 Zing 2009-10-03 05:43:11 UTC
the patch isn't being applied... it's there, but it's missing the corresponding %patch13 to actually apply it in the spec :)

Comment 29 Karel Zak 2009-10-05 07:36:03 UTC
(In reply to comment #28)
> the patch isn't being applied... it's there, but it's missing the corresponding
> %patch13 to actually apply it in the spec :)  

 Grr... I'm sorry sorry sorry about it. James, test it with util-linux-ng-2.16-13.fc13, please.

Comment 30 James Laska 2009-10-05 12:18:39 UTC
Updated testing with util-linux-ng-2.16-13.fc13 (http://koji.fedoraproject.org/koji/buildinfo?buildID=135078).

That seems to have fixed the problem, thanks!

Fedora release 11.91 (Rawhide)
Kernel 2.6.31.1-56.fc12.i686.PAE on an i686 (/dev/ttyS0)

test119.test.redhat.com login: root
Password: 
Last login: Mon Oct  5 08:12:00 on ttyS0

[root@test119 ~]# rpm -q util-linux-ng libuuid libblkid
util-linux-ng-2.16-13.fc13.i686
libuuid-2.16-13.fc13.i686
libblkid-2.16-13.fc13.i686

Comment 31 Adam Williamson 2009-10-05 15:16:12 UTC
karel, can you send through an f12 build with this fix, and file a tag request to get it into the beta?

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 32 Karel Zak 2009-10-05 15:37:16 UTC
F-12 rebuild: util-linux-ng-2.16-10.2.fc12
Rel-eng Trac tag request: #2330

Comment 33 Jesse Keating 2009-10-05 19:49:39 UTC
And tagged.

Comment 34 Roman Rakus 2009-10-08 10:07:43 UTC
*** Bug 527312 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.