Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Error attempting to run alsamixer Post 303029392 by Corona688 on Friday 25th of January 2019 04:23:29 PM
Old 01-25-2019
So, no init system or anything? Your terminal probably hasn't been set up. This is a surprisingly tricky bit of "magic" done with a special syscall which we're for the most part happy to let some linux distribution do for us.

One workaround for it, funny enough, could be ssh-ing into your device. A virtual terminal should be close enough.

I was sure that busybox had a utility for it, and their faq turns out to have that and a better explanation what it does:

Quote:
"Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell?"

Job control will be turned off since your shell can not obtain a controlling terminal. This typically happens when you run your shell on /dev/console. The kernel will not provide a controlling terminal on the /dev/console device. You should run your shell on a normal tty such as tty1 or ttyS0 and everything will work.

Example: you booted into your machine with init=/bin/sh and got "sh: can't access tty" error because sh has its stdio opened to /dev/console. You want to reopen stdio to, say, /dev/tty1 and thus acquire a controlling tty.

Code:
    # Let's try this:
    exec </dev/tty1 >/dev/tty1 2>&1
    # No, doesn't work: even if opening /dev/tty1 gave sh the ctty,
    # sh wouldn't know it - it checks for ctty just once at startup.

    # Let's try re-execing sh:
    exec </dev/tty1 >/dev/tty1 2>&1
    exec sh
    # Got "sh: can't access tty" again. Why?
    # The reason is somewhat obscure: kernel starts process with PID=1
    # (in this case, shell) with SID=0 and PGID=0, not with SID=1 and PGID=1
    # as you'd expect. IOW: our sh is not a session leader, and therefore
    # cannot acquire ctty by opening /dev/tty1 (or any other tty).

    # Let's try making us a session leader:
    exec setsid sh
    exec </dev/tty1 >/dev/tty1 2>&1
    exec sh
    # Yes, this worked!

    # This can be combined into one command,
    # but need to be careful and perform these operations
    # in the correct order:
    # 1. make ourself session leader,
    # 2. open /dev/tty1 and thus acquire a ctty,
    # 3. re-execute the shell, allowing it to notice that it has a ctty:
    exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'

These 2 Users Gave Thanks to Corona688 For This Post:
 

8 More Discussions You Might Find Interesting

1. IP Networking

Error with ifconfig when attempting to switch to 10baseT

In Darwin, when typing "ifconfig en0 media 10baseT/UTP mediaopt half-duplex" I recieve the error message "ifconfig: SIOCSIFMEDIA: Operation not permitted". The same thing occurs when I sudo the command. Any suggestions? Thanks... (1 Reply)
Discussion started by: tkarrde
1 Replies

2. UNIX for Dummies Questions & Answers

attempting to break within function

Attempting to break from a case/esac paragraph while inside of a function. When executing the code below, entering the letter 'a', will prove that the directory exists, but the break command works for the if/fi, but not for the case/esac. So, in my example below, if an A is entered, the function... (8 Replies)
Discussion started by: tumblez
8 Replies

3. Red Hat

attempting to install chkconfig 1.3.5

Hi there everyone, I'm using redhat 7.3 at the moment and am currently trying to install chkconfig-1.3.5-3.i386.rpm , but when I type this command: rpm -Uvh chkconfig-1.3.5-3.i386.rpm I get the following error: error: failed dependencies: chkconfig = 1.2.24 is needed by... (3 Replies)
Discussion started by: redhat_newb101
3 Replies

4. Shell Programming and Scripting

"directory checksum error" when attempting to install tcl

OS: HP-UX Programs I want to install: expect and tcl I'm lost. I bought the book. I began reading the book. I want to install expect. I've been able to download the .z, and extract it successfully. But, of course, it apparently needs tcl and possibly tk also, and ... I... (0 Replies)
Discussion started by: instant000
0 Replies

5. Debian

attempting to boot from cd rom

i just installed Debian Lenny on HP DL380. After the server rebooted, it still asks for me to insert a cd rom. where can I exactly check the settings for the boot menu? Should it use the hard disk since I didnt insert any cd? pls advise (1 Reply)
Discussion started by: lhareigh890
1 Replies

6. SuSE

Attempting to use AutoYaST with SLES11SP2

We currently have a setup with SLES11SP1 where we have an AutoYaST ISO set up for automated network installs. I'm attempting to port this to SP2 to make new installs current, but I'm running into a few problems. The process seems the same, and after running mkisofs to build a new SP2 ISO the... (0 Replies)
Discussion started by: Magus Zeal
0 Replies

7. Linux

Problem with ALSAMIXER

Hi Team, Am trying to open alsamixer via command line but am getting the following error. $ alsamixer Home directory /home/root not ours. ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused cannot open mixer: Connection refused Even am opening as... (2 Replies)
Discussion started by: Adhi
2 Replies

8. UNIX for Beginners Questions & Answers

When I run the code yesterday I am getting output,when I run same code today I am getting error?

If run the below code today its creating all directory and getting output files,I f run same code tomorrow I am getting error. can any one give suggestion to sortout this error. OSError: no such file or directory : '062518'My code looks like this import paramiko import sys import os ... (8 Replies)
Discussion started by: haribabu2229
8 Replies
PIVOT_ROOT(8)						       Maintenance Commands						     PIVOT_ROOT(8)

NAME
pivot_root - change the root file system SYNOPSIS
pivot_root new_root put_old DESCRIPTION
pivot_root moves the root file system of the current process to the directory put_old and makes new_root the new root file system. Since pivot_root(8) simply calls pivot_root(2), we refer to the man page of the latter for further details. Note that, depending on the implementation of pivot_root, root and cwd of the caller may or may not change. The following is a sequence for invoking pivot_root that works in either case, assuming that pivot_root and chroot are in the current PATH: cd new_root pivot_root . put_old exec chroot . command Note that chroot must be available under the old root and under the new root, because pivot_root may or may not have implicitly changed the root directory of the shell. Note that exec chroot changes the running executable, which is necessary if the old root directory should be unmounted afterwards. Also note that standard input, output, and error may still point to a device on the old root file system, keeping it busy. They can easily be changed when invoking chroot (see below; note the absence of leading slashes to make it work whether pivot_root has changed the shell's root or not). EXAMPLES
Change the root file system to /dev/hda1 from an interactive shell: mount /dev/hda1 /new-root cd /new-root pivot_root . old-root exec chroot . sh <dev/console >dev/console 2>&1 umount /old-root Mount the new root file system over NFS from 10.0.0.1:/my_root and run init: ifconfig lo 127.0.0.1 up # for portmap # configure Ethernet or such portmap # for lockd (implicitly started by mount) mount -o ro 10.0.0.1:/my_root /mnt killall portmap # portmap keeps old root busy cd /mnt pivot_root . old_root exec chroot . sh -c 'umount /old_root; exec /sbin/init' <dev/console >dev/console 2>&1 SEE ALSO
chroot(1), mount(8), pivot_root(2), umount(8) Linux Feb 23, 2000 PIVOT_ROOT(8)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy