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
AMIXER(1)						      General Commands Manual							 AMIXER(1)

NAME
amixer - command-line mixer for ALSA soundcard driver SYNOPSIS
amixer [-option] [cmd] DESCRIPTION
amixer allows command-line control of the mixer for the ALSA soundcard driver. amixer supports multiple soundcards. amixer with no arguments will display the current mixer settings for the default soundcard and device. This is a good way to see a list of the simple mixer controls you can use. COMMANDS
help Shows syntax. info Shows the information about a mixer device. scontrols Shows a complete list of simple mixer controls. scontents Shows a complete list of simple mixer controls with their contents. set or sset <SCONTROL> <PARAMETER> ... Sets the simple mixer control contents. The parameter can be the volume either as a percentage from 0% to 100% with % suffix, a dB gain with dB suffix (like -12.5dB), or an exact hardware value. The dB gain can be used only for the mixer elements with available dB information. When plus(+) or minus(-) letter is appended after volume value, the volume is incremented or decremented from the current value, respectively. The parameters cap, nocap, mute, unmute, toggle are used to change capture (recording) and muting for the group specified. The optional modifiers can be put as extra parameters to specify the stream direction or channels to apply. The modifiers playback and capture specify the stream, and the modifiers front, rear, center, woofer are used to specify channels to be changed. A simple mixer control must be specified. Only one device can be controlled at a time. get or sget <SCONTROL> Shows the simple mixer control contents. A simple mixer control must be specified. Only one device can be controlled at a time. controls Shows a complete list of card controls. contents Shows a complete list of card controls with their contents. cset <CONTROL> <PARAMETER> ... Sets the card control contents. The identifier has these components: iface, name, index, device, subdevice, numid. The next argument specifies the value of control. cget <CONTROL> Shows the card control contents. The identifier has same syntax as for the cset command. OPTIONS
-c card Select the card number to control. The device name created from this parameter has syntax 'hw:N' where N is specified card number. -D device Select the device name to control. The default control name is 'default'. -s | --stdin Read from stdin and execute the command on each line sequentially. When this option is given, the command in command-line arguments is ignored. Only sset and cset are accepted. Other commands are ignored. The commands to unmatched ids are ignored without errors too. -h Help: show syntax. -q Quiet mode. Do not show results of changes. -R Use the raw value for evaluating the percentage representation. This is the default mode. -M Use the mapped volume for evaluating the percentage representation like alsamixer, to be more natural for human ear. EXAMPLES
amixer -c 1 sset Line,0 80%,40% unmute cap will set the second soundcard's left line input volume to 80% and right line input to 40%, unmute it, and select it as a source for capture (recording). amixer -c 1 -- sset Master playback -20dB will set the master volume of the second card to -20dB. If the master has multiple channels, all channels are set to the same value. amixer -c 1 set PCM 2dB+ will increase the PCM volume of the second card with 2dB. When both playback and capture volumes exist, this is applied to both volumes. amixer -c 2 cset iface=MIXER,name='Line Playback Volume",index=1 40% will set the third soundcard's second line playback volume(s) to 40% amixer -c 2 cset numid=34 40% will set the 34th soundcard element to 40% SEE ALSO
alsamixer(1) BUGS
None known. AUTHOR
amixer is by Jaroslav Kysela <perex@perex.cz>. This document is by Paul Winkler <zarmzarm@erols.com> and Jaroslav Kysela <perex@perex.cz>. 11 Aug 2000 AMIXER(1)
All times are GMT -4. The time now is 04:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy