output
stringlengths 9
26.3k
| input
stringlengths 26
29.8k
| instruction
stringlengths 14
159
|
---|---|---|
You can use the command pppstats -z to display compression statistics. If it displays all zeros then compression is not enabled.
excerpt from man page
-z Instead of the standard display, show statistics indicating the
performance of the packet compression algorithm in use. When the -z option is specified, instead displays the following fields,
relating to the packet compression algorithm currently in use. If
packet compression is not in use, these fields will all display zeroes.
The fields displayed on the input side are: COMPRESSED BYTE
The number of bytes of compressed packets received. COMPRESSED PACK
The number of compressed packets received. INCOMPRESSIBLE BYTE
The number of bytes of incompressible packets (that is, those
which were transmitted in uncompressed form) received. INCOMPRESSIBLE PACK
The number of incompressible packets received. COMP RATIO
The recent compression ratio for incoming packets, defined as
the uncompressed size divided by the compressed size (including
both compressible and incompressible packets). The fields displayed on the output side are: COMPRESSED BYTE
The number of bytes of compressed packets transmitted. COMPRESSED PACK
The number of compressed packets transmitted. INCOMPRESSIBLE BYTE
The number of bytes of incompressible packets transmitted (that
is, those which were transmitted in uncompressed form). INCOMPRESSIBLE PACK
The number of incompressible packets transmitted. COMP RATIO
The recent compression ratio for outgoing packets. |
I'm using Debian Linux on an embedded system, we use ppp to connect to the WAN via a CDMA modem. I want to find out if compression is being used by ppp.
In my /var/log/messages I see the line:
kernel: [ 54.740000] PPP Deflate Compression module registeredbut in /var/log/debug I see this:
pppd[2433]: Protocol-Reject for 'Compression Control Protocol' (0x80fd) receivedThe output of pppstats -z is:
IN: COMPRESSED INCOMPRESSIBLE COMP | OUT: COMPRESSED INCOMPRESSIBLE COMP
BYTE PACK BYTE PACK RATIO | BYTE PACK BYTE PACK RATIO
0 0 0 0 0.00 | 0 0 0 0 0.00So does the above mean compression is enabled, or not?
| How can I tell if PPP compression is enabled for modem? |
You would first disable getty running on your serial port device /dev/ttyS0 (or whatever it is named for your hardware) to free it (for example, by editing /etc/inittab and running telinit q - if you managed to steer away from systemd) and then you would run pppd(8) on it (either manually with appropriate parameters or via additional tools like wvdial)
|
I am about to start working on an embedded system which runs kernel v2.6.x.
It is configured to use its serial line as a TTY (accessible via e.g. minicom, stty), but I want to run IP over the serial line so that I can run multiple multiplexed sessions over the link (e.g. via UDP/TCP or SSH).
I don't have much more information about the boards yet (will post more when the documentation arrives), but assuming that the kernel provides reasonable abstraction over the hardware - what would be the process to configure it to run PPP or (C)SLIP over the serial link in place of TTY?
| How to configure embedded kernel to use serial line for PPP instead of TTY |
First, PMTUd does require ICMP to be forwarded to the machine that sent the traffic. But if you allow RELATED,ESTABLISHED the required ICMP will be let through. And NAT with connection tracking will get it back to the right machine.
You're likely looking for this magic iptables line, though:
iptables -t mangle -I FORWARD -p tcp -o ppp0 -j TCPMSS --set-mss 1452 # MTU-40 for IPv4
# use the correct outbound interface in place of ppp0Likely, your router does that automatically.
|
I'm having an issue with pppd doing PPPoE on CentOS 6.3.
The CentOS system is a dedicated router/gateway which performs NAT (both directions) and various packet filtering. It has separate NICs for the LAN and Internet side, eth0 and eth1, respectively.
On the Internet side is a DSL modem. The modem likes doing everything itself, including NAT. In order to prevent it from doing so I have to give it invalid account info and then implement PPPoE on the CentOS system.
I had a problem when doing PPPoE on the CentOS system with Internet connectivity being very flaky. Clients could access some sites and not others, some web pages would half-load and then always stop at the same position, and TCP connections would often reset.
I've isolated this down to an MTU issue. I can get any given client system (all Windows) on the LAN side working fine by reducing its MTU down to 1492 from the standard 1500.
On the other hand, if I allow the modem to do PPPoE and NAT, enable IP and the DHCP client on eth1, and set my IP filtering script to route to eth1 instead of ppp0, clients work fine with their MTU set to 1500. (The problem with this config is that double NAT can impact performance and makes inbound connection routing trickier.)
Ping testing (with DF) reveals that the Internet-bound MTU is actually still limited to 1492, even though the clients don't need to be set as such.
It therefore seems that clients are normally doing path MTU discovery but that pppd (or perhaps NetFilter) is somehow getting in the way of it.
I normally have NetFilter (iptables) on the CentOS system set to drop all INPUT and OUTPUT traffic (since the system's only job is forwarding). I tried temporarily changing these policies to ACCEPT, in case path MTU discovery was depending on ICMP errors from it, but the problem remained.
I'm not at all experienced in PPPoE and am hoping someone might be able to point me in the right direction. Thanks!
| Problem with path MTU discovery over pppd |
Note: I will consider that your router's LAN is 192.0.2.0/24 and its LAN IP on eth0 is 192.0.2.1/24, to be able to give concrete explanations and a solution.
Your ISP, to spare some public IP addresses, assigned you a private IPs for internal routing purpose. That's fine because this IP is never meant to be seen outside (and would be quickly dropped by Strict Reverse Path Forwarding along the path if ever put on the wire beyond your ISP router, or if not, since non-routable, will never get a reply). But this makes your configuration more complex to avoid having this IP to be used in all cases but connectivity to ISP, from your router.
You probably have something similar to this (it might be slightly different, doesn't matter):
# ip route
default via 10.0.0.9 dev ppp0
10.0.0.9 dev ppp0 proto kernel scope link src 10.0.0.10
192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.1 It's possible for example that you have instead default via 10.0.0.9 dev ppp0 src 10.0.0.10 , or that via 10.0.0.9 doesn't even appear, since it's a layer 3 link rather than a layer 2 link, making via not needed (but still accepted). Just adapt the settings below accordingly.
Currently, the kernel chooses the apparently best suited IP, the one set on the same side to reach Internet, since nothing tells it otherwise (or it explicitly tells to use the IP you don't want):
# ip route get 8.8.8.8
8.8.8.8 via 10.0.0.9 dev ppp0 src 10.0.0.10 uid 0
cache You just need to replace the routing behaviour when the kernel checks how to reach internet and state a specific preferred source IP address. Be aware that you might lose connectivity in case of errors and unforeseen problems. Have alternate (console) access if possible:
# ip route replace default via 10.0.0.9 dev ppp0 src 192.0.2.1
# ip route get 8.8.8.8
8.8.8.8 via 10.0.0.9 dev ppp0 src 192.0.2.1 uid 0
cache That's it, your router will route as usual, but when needing to choose a locally originated outgoing IP, will select 192.0.2.1 unless explicitly told otherwise (eg: process binding explicitly the source IP on its socket).
This route must be set again each time the link is brought down then up. It's up to you to integrate this in some pppoe script, after the link is fully established.
Note also that the interface name ppp0 might change to ppp1 or any other name. That's up to you to deal with this in your setup scripts.Alternate methods to set this same route setting:add a lower metric, when a metric is initially set
If the original metric was set (ie it wasn't 0, let's say it was 100), you can instead add an alternate default route with a lower metric rather than replacing the previous:
# ip route add default via 10.0.0.9 dev ppp0 src 192.0.2.1 metric 50dedicated routing rule
If you fear interaction from various tools involved in pppoe that might remove the route above, you can install this setting in an alternate routing table and give it precedence in routing rules, with a partial copy of the main table to prevent disruption. This will still have to be redone after each disconnection/reconnection, because the route will still disappear. Here iif lo is special and really means "locally originated outgoing packet" rather than incoming, and 109 is an arbitrary chosen table value:
# ip rule add iif lo lookup 109 # needed only once
# ip route add table 109 10.0.0.9 dev ppp0 proto kernel scope link src 10.0.0.10 # to keep using 10.0.0.10 for local link, just in case
# ip route add table 109 192.0.2.0/24 dev eth0 src 192.0.2.1 # will disappear if eth0 is brought down
# ip route add table 109 default via 10.0.0.9 dev ppp0 src 192.0.2.1 # will disappear if ppp0 is brought downIf you added other routing entries in the main table, chances are you'd also have to copy them above.
# ip route get 8.8.8.8
8.8.8.8 via 10.0.0.9 dev ppp0 table 109 src 192.0.2.1 uid 0
cache routing rules with simplified route
One can keep the routes in the main table and override only the default route with a prefix-based suppressor in the rule: This avoid having to copy all routes: one can just copy and change the default route.
Replace 2. with (stating the preference values, still putting them in descending order as would happen without stating them):
# ip rule add pref 32765 iif lo lookup 109 # needed only once
# ip rule add pref 32764 iif lo lookup main suppress_prefixlength 0 # needed only once# ip rule
0: from all lookup local
32764: from all iif lo lookup main suppress_prefixlength 0
32765: from all iif lo lookup 109
32766: from all lookup main
32767: from all lookup default# ip route add table 109 default via 10.0.0.9 dev ppp0 src 192.0.2.1 # will disappear if ppp0 is brought downThe main routing table will be used first for anything that won't be the default route, then for locally originated outgoing traffic the default route is provided in routing table 109. Anything else will continue and lookup the main table again for the default route as usual.
The advantage over 2. is that there's no need to duplicate (non-default) routes from table main into table 109 anymore. Below, table main provides the result for a non-default route, contrary to the 2. method:
# ip route get 8.8.8.8
8.8.8.8 via 10.0.0.9 dev ppp0 table 109 src 192.0.2.1 uid 0
cache
# ip route get 192.0.2.2
192.0.2.2 dev eth0 src 192.0.2.1 uid 0
cache |
Background InformationI'm using a Linux system to route traffic for a small block of public IPv4 addresses (by enabling IP forwarding in sysctrl.conf).The router is connecting to the ISP over eth1 using PPPoE.The local peer address used for ppp is a manually-configured IP address that was specified by the ISP. The local peer address is 10.0.0.10.The remote peer address used for ppp is also a manually-configured IP address that was specified by the ISP. The remote peer address is 10.0.0.9.The router's default route is 10.0.0.9 via 10.0.0.10.The router is connected to an Ethernet switch via eth0. eth0 is configured to use one of the public addresses.The switch connects all other public hosts. Each connected host uses a public IP address. 10.0.0.9
ISP ----------+
| 10.0.0.10 X.X.X.X
+------------- (eth1) ROUTER (eth0) --------------- SWTICH
|
+-- X.X.X.Y
+-- X.X.X.Z
...My Problem
Everything works as expected except for programs running on the router. Any application that I run on the router uses 10.0.0.10 as the source IP address when initiating connections to the internet. This is understandable since eth1 is where the internet is available. However, because the address is not publicly routable, apt, ping, and other programs don't work. If I explicitly set the source address on applications that support it (i.e. ping), applications do work.
My Question
How can I configure the router to route unknown packets via eth1/10.0.0.9 while also using the public IP address on eth0 as the default source when initiating new connections?
| How to change the default source IP address to be something other than the address facing the default route? |
As my comment implied, you can't bond such connections.
Bonding is a layer 2 concept, ideally invisible to the higher layers. This means that packets addressed to your IP may appear at both interfaces, scheduled by the device sending the frames to you.
However, with your connection to the ISP you have two different L3 devices, which have different IP's and may even be in different subnets.
To do bonding, the other end has to support it as well. Your ISP needs to explicitly configure it.
What you can do is load balancing at the L3 level. This basically means configuring two equal routes, but it may produce strange results as IP's may change suddenly. It's better to send different types of traffic via different routes, or route based on source.
|
Actually I did connect both ppp0 and ppp1 using nm-connection-editor(network connection setting). But now I wish to make a balance-rr(mode 0), and thought that bonding would do that for me. I need to know if its possible, because when I'm searching, I only see people bonding Ethernet interfaces.
When I tried to use bond using nm-connection-editor. When i click Add buttonThere is no option to add mobile broadband interfaces inside.
Is bonding capable of dealing with ppp0 and ppp1 mobile broadband 4g dongles? How?
| How to make bonding using mobile broadband 4g dongles |
First you need to see if your hardware is listed:
lsusbThen you can install and configure usb_modeswitch, because Linux recognizes your hardware as a USB drive not as a modem (I assume that you are using Arch Linux):
pacman -S usb_modeswitchFinally, you just got to check if your APN settings are correct:
wvdialconfvim /etc/wvdial.confA simple script to make it automatic:
usb_modeswitch
sleep 2
modprobe usbserial vendor=0xVVVV product=0xMMMM maxSize=4096
sleep 2
wvdial 'your profile |
I have a Huawei cell modem EM680 with which I can establish a connection on my Ubuntu 13.10 box just fine. I plug it in and I can establish a connection using the Connections Manager.
I have a box without X server and I want to establish a connection with that same modem on that box. I can get a serial link at /dev/ttyUSB1 and if I connect to it using screen /dev/ttyUSB1 460800 and send AT, it responds with OK just fine — so the modem works! After that I tried to establish a connection using wvdial with my /etc/wvdial.conf configured like this:
[Dialer Defaults]
Init1 = ATZ
Init2 = AT+CFUN=1
Init3 = AT+CGDCONT=1,"IP","m2mstatic.apn"
Modem = /dev/ttyUSB1
Phone = *99***1#
Modem Type = USB Modem
Username = "blank"
Password = "blank"
Stupid Mode = yes
New PPPD = yes
Baud = 460800
ISDN = 0I tried to launch wvdial without any options or with
wvdial eap-interval 1 require-chapbecause in my Connection Manager window, under the tab PPP the following checkboxes are checked:EAP
MSCHAP
PAP
MSCHAPv2
CHAP
Use BSD data compression
Use Deflate data compression
Use TCP header compressionBut upon launch I just get
# wvdial eap-interval 1 require-chap
--> WvDial: Internet dialer version 1.61
--> Warning: section [Dialer eap-interval] does not exist in wvdial.conf.
--> Warning: section [Dialer 1] does not exist in wvdial.conf.
--> Warning: section [Dialer require-chap] does not exist in wvdial.conf.
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CFUN=1
AT+CFUN=1
OK--> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"
AT+CGDCONT=1,"IP","m2mstatic.apn"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT 14000000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Mon Jan 22 03:26:56 2007
--> Pid of pppd: 4295Here it waits for about a minute and then:
--> pppd: H�[02]
--> pppd: H�[02]
--> Disconnecting at Mon Jan 22 03:27:57 2007
--> The PPP daemon has died: Connect script failed (exit code = 8)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 5 seconds
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
--> Re-Sending: ATZ
--> Modem not responding.
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
--> Re-Sending: ATZ
--> Modem not responding.
--> Disconnecting at Mon Jan 22 03:28:19 2007
#But I can never actually reach the Internet. Exit code 8 in the pppd man page says:
The serial port could not be opened.Which is ridiculous as I just opened (and closed(!) it with screen). Any ideas where I'm going wrong or what I'm missing?
Edit
I just found the connection manager's config file and it looks like this:
[connection]
id=Rogers
uuid=5c4ed6f8-9ece-4888-a129-65ed5c741502
type=gsm
permissions=user:ron:;[gsm]
number=*99#
password-flags=1
apn=m2mstatic.apn
pin-flags=1[ipv4]
method=auto | Troubles establishing connection with wvdial |
Drop the "defaultroute" line and it should work.
You can set the route manually if you have to, but you probably don't have to. It looks like you have a script hooked already that sets he routes when a new interface comes up and it's clobbering pppd.
|
I want to establish a ppp link to a GSM provider with my cell phone modem. The modem gets recognized and I can send AT commands just fine, but I can not get the connection established.
My chat script looks like:
#######################################
SAY 'Setting the abort string\n'
SAY '\n'
# Abort String ------------------------------
ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT DELAYED#######################################
SAY 'Initializing modem\n'
# Modem Initialization
'' AT
OK ATZ#######################################
SAY '\n'
SAY 'Setting APN\n'
# Access Point Name (APN)
# Incorrect APN or CGDCONT can often cause errors in connection.
# Below are a bunch of different popular APNs#REG:\s1 AT+cgdcont=1,"IP","proxy"
#OK 'AT+CGDCONT=0,"IP","proxy"'
#OK 'AT+CGDCONT=1,"IP","proxy"'
#OK 'AT+CGDCONT=2,"IP","proxy"'
OK 'AT+CGDCONT=1,"IP","m2mstatic.apn"'
#OK 'AT+CGDCONT=1,"IP","ISP.TELUS.COM"'
#OK 'AT+CGDCONT=1,"IP","INTERNET.COM"'
#OK 'AT+CGDCONT=1,"IP","ISP.CINGULAR"'
#OK 'AT+CGDCONT=2,"IP","ISP.CINGULAR"'
""And in /var/log/messages I get the following messages:
Jan 11 04:08:49 ariag25 pppd[2518]: pppd 2.4.5 started by root, uid 0
Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO DIAL TONE)
Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO ANSWER)
Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO CARRIER)
Jan 11 04:08:50 ariag25 chat[2520]: abort on (DELAYED)
Jan 11 04:08:50 ariag25 chat[2520]: send (AT^M)
Jan 11 04:08:50 ariag25 chat[2520]: expect (OK)
Jan 11 04:08:50 ariag25 chat[2520]: AT^M^M
Jan 11 04:08:50 ariag25 chat[2520]: OK
Jan 11 04:08:50 ariag25 chat[2520]: -- got it
Jan 11 04:08:50 ariag25 chat[2520]: send (ATZ^M)
Jan 11 04:08:51 ariag25 chat[2520]: expect (OK)
Jan 11 04:08:51 ariag25 chat[2520]: ^M
Jan 11 04:08:51 ariag25 chat[2520]: ATZ^M^M
Jan 11 04:08:51 ariag25 chat[2520]: OK
Jan 11 04:08:51 ariag25 chat[2520]: -- got it
Jan 11 04:08:51 ariag25 chat[2520]: send (AT+CGDCONT=1,"IP","m2mstatic.apn"^M)
Jan 11 04:08:51 ariag25 chat[2520]: expect (OK)
Jan 11 04:08:51 ariag25 chat[2520]: ^M
Jan 11 04:08:51 ariag25 chat[2520]: AT+CGDCONT=1,"IP","m2mstatic.apn"^M^M
Jan 11 04:08:51 ariag25 chat[2520]: OK
Jan 11 04:08:51 ariag25 chat[2520]: -- got it
Jan 11 04:08:51 ariag25 chat[2520]: send (ATDT*99#^M)
Jan 11 04:08:51 ariag25 chat[2520]: expect (CONNECT)
Jan 11 04:08:51 ariag25 chat[2520]: ^M
Jan 11 04:08:51 ariag25 chat[2520]: ATDT*99#^M^M
Jan 11 04:08:51 ariag25 chat[2520]: CONNECT
Jan 11 04:08:51 ariag25 chat[2520]: -- got it
Jan 11 04:08:51 ariag25 chat[2520]: send (^M)
Jan 11 04:08:51 ariag25 pppd[2518]: Serial connection established.Edit
I don't think things are wrong with my chat script but my modem instead. Notice that on the bottom of the messages, the context switched from chat to pppd - why is that? May my power supply be too weak? That's what I suspect now. Any ideas?
Also, if I do a killall pppd after this and try to connect with screen
screen /dev/modem 9600the modem doesn't reply anymore until I power cycle it.
However, I'm surprised! I hooked it up to a 2.1A USB power supply.
Edit2
My /etc/ppp/options looks like:
debug
/dev/ttyUSB1
9600
modem
crtscts
lock
connect /etc/ppp/net-connect
asyncmap 0
defaultrouteand /etc/ppp/peers/provider like this:
connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99***1#"# Serial device to which the modem is connected.
/dev/modem# Speed of the serial line.
9600# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute# Makes pppd "dial again" when the connection is lost.
persist# Do not ask the remote to authenticate.
noauth | Difficulties to establish a ppp connection to a GSM provider |
If what you really want is just to connect the notebook to your network, check if it has a PC Card or PCMCIA slot. Most notebooks, even very old ones, should have that. Then you can find a second hand PCMCIA Ethernet card for almost nothing.
|
I've got a really old laptop running Windows 95, and I'd like to be able to connect it to my home network. It doesn't have an ethernet jack, nor a usb port. It does have an internal dial up modem though, and I'd like to try connecting to another modern machine running slackware. This other machine also has an internal dial up modem, so it seems like it should be possible.
I'd appreciate any advice or pointers to relevant information.
| Can I set up linux to accept a dial up connection from my old windows95 laptop? |
If I'm not mistake, I don't use RNDIS right now.RNDIS is a Windows-specific network interface driver API. Um, that as nothing to do with what you're doing, right?What might be the reason, that ppp0 does not have a MAC address? How it's even possible?a MAC address is an Ethernet concept; and PPP is not ethernet :)
PPP's frame do contain an Address – but it's just a single byte long, and always set to 0xFF, PPP being a point-to-point protocol, where you don't need more addresses (you know who you're talking to – the other end).I don't think the reason is blockage by the ISP, because my other devices are ping-able on the network.Good debugging. Note, however, that mobile network operators (MNOs) routinely employ carrier-grade NAT to hide a lot of users behind one public IPv4 address – there's even theoretically, ignoring anything else but humans with phones – only 2³² possible IP addresses (ignoring any "special" addresses), and roughly as many phones as there are humans, so there's only IPv4 addresses for around half of the phones. The message here is that if you want your mobile device to be world-reachable, there's going to be some extra infrastructure involved (like a VPN server), or you need to use IPv6. I'd recommend going for IPv6 – due to market forces, for most MNOs it's cheaper to have IPv6 traffic to and from the internet, so they might prioritize that.
Anyway, your question is why it doesn't work for you – here's the thing: This is carrier-grade NAT (your IPv4 address on that interface is a private one!), there's neither a guarantee nor too much sense in guaranteeing that different subscribers can contact each other directly. It's cool that it works for you on your other devices, though.
What's a bit worrying is that you're only assigned a single IPv4 address, and not an IPv6 address (or a whole IPv6 subnet). That might mean that your Linux machine's pppd isn't configured to accept IPv6, or some other misconfiguration.
But more realistically: PPP is an … old protocol that's got nothing to do with how mobile network infrastructure operates, at all. 2.5G/GPRS/EDGE, 3G/UMTS, 4G/LTE, 5G… etc are packet networks – you get an interface that transports IP packets, directly; you don't get a serial line over which you need to talk PPP to establish a packet tunnel.
So, what must be happening is that your USB modem connects to the mobile network, gets an IP address, and puts the IP packets it gets through a PPP tunnel, which it seems to then put over an emulated serial link to your computer? That's an interesting way to do it, to say the least – could as well just have been a USB network card, and worked out of the box. In fact, that's how USB tethering on my phone works, and I had built-in modem cards for my laptops in the past, which did the same.
Maybe your USB modem has different modes of operating, and one that looks like a 1990's dial-up modem that emulates connecting to an Internet Service Provider that offers PPP, and a different mode where it's just an IP router? If that's the case, use the latter mode, and set it to forward packets to your computer.
So, either way, your modem is involved in mangling IP packets; so quite likely that's where your incoming packets get lost. But, maybe your other devices are also using the same APN nominally, but if they're using a different way of connecting to the mobile network, their packets go a different route in the core network, and don't end up in the same private network as your modem; there's much that could differ here, that you have zero visibility of. Generally, your MNO doesn't operate an internal network for you (unless you pay them to – for example using a special M2M subscription), but an internet access; communicate through the internet, if you can't communicate locally. For that you need a global IP address that you can connect to.
If you asked me, if you need to be mutually communicating:Use IPv6. That's your best chance to actually get a global address. Fall back to IPv4 only if you positively must.
Get some server that has a static public address. Your user equipment gets assigned a new IP address at will of your MNO.
Establish a VPN connection to that public address from each of your devices – wireguard is an excellent, relatively low-power method for that. This might already solve all your problems.
if you want to be Smart (with a capital S) about latencies, you can add additional direct network paths between different devices as soon as they detect they can mutually directly communicate – which requires some software running at the endpoints, delivering address information about the different network interfaces offered by your devices, and a daemon to make sense of these. |
I'm connecting a linux machine using a nowadays popular Huawei Brovi E3372-325 LTE USB Stick to the internet. The special requirement is that incoming ssh/ping/NTP/... connections must reach my linux OS.
The state is, that using usb_modeswitch -X and the option driver I can bring up the 3 ttyUSB interfaces, and connect successfully using wvdial. But for some reason, ifconfig does not list a HW/MAC address for ppp0 interface, and devices on the same APN network can't ping the my IP address. I don't think the reason is blockage by the ISP, because my other devices are ping-able on the network.
Output of ip addr
19: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 3
link/ppp
inet 10.250.0.112 peer 10.64.64.64/24 scope global ppp0
valid_lft forever preferred_lft foreverIf I'm not mistake, I don't use RNDIS right now. Am I right, that in general the popular RNDIS protocol does not suit my use case, because that creates an additional local network, making it trickier to forward incoming connections to the OS? Pinging might work from outside because that's answered by the USB modem itself, but incoming ssh would fail.
What might be the reason, that ppp0 does not have a MAC address? How it's even possible? Should I assign one? Is it probably the reason that other devices can't ping it's IP? How to solve this situation? | USB LTE modem without MAC address? |
Somewhere in your ppp setup (probably either in /etc/ppp/options or at the command line), you have an option called connect followed by a command used to setup the modem for a connection. It's usually a chat script. You need to find out why that command is failing. If it is a chat script, you can make it verbose by changing it from chat blah blah... to chat -v blah blah.
Also for convenience, I like to add either the updetach or nodetach option to ppp so I don't have to keep checking the log.
|
I got an embedded system trying to create a ppp connection using a GSM modem. However the connection is never established and all I get is this error message in syslog:
Oct 12 08:38:48 pppd[451]: pppd 2.4.4 started by root, uid 0
Oct 12 08:38:59 pppd[451]: Connect script failed
Oct 12 08:39:00 pppd[451]: Exit.I now need some hints how to proceed finding the cause of this problem. Where should I start looking?
| How to proceed solving ppp connection problems? |
As long as the device is used for ppp traffic, it is not possible to run AT commands at the same time1.
For this reason all modern modems will provide more than one serial interfaces, e.g. /dev/ttyUSB0 and /dev/ttyUSB1 (or /dev/ttyACM0 and /dev/ttyACM1 for USB CDC modems on linux).
Back in the days when phones had RS-232 compatible connectors (perhaps with additional IrDA), 3GPP standardized a multiplexing protocol as 07.10 to overcome the physical limitation, although that required special drivers on the PC so it never took off. Today with USB's inherent multiplexing capabilities, there are no excuses for not providing multiple serial interfaces (usually there are only two though).
So as already mentioned in a comment, you should use the other serial device, e.g. /dev/ttyUSB1.1 In theory it might be possible for the modem to support +++ escaping which would then allow you to run AT commands while the connection was ongoing, although then you would have to in some way modify the dialer program to inject those and extract the response...
|
I have a zte 3g modem. I use carrier provided dialer for connection establishment. Once the ppp connection is active, i would like to send some AT commands(for ex. Query signal strength, AT+CSQ). But the dialer i use locks the /dev/ttyUSB0 port, which is the command port to send AT commands for my modem. So is there any way, to send the commands, once the connection is active?Edit: I also tried the additional port /dev/ttyUSB1. But the port is flowing with random data from the modem. A sample is given below.
T^PREFMODE??
^PREFMODE:8 OK
TC
^DSDORMANT:1 +CSQ:19, 99 OK
T^SYSINFO
^SYSINFO:2,3,0,4,255 OK
TT^SYSINFO?
^SYSINFO:2,3,0,4,255 I tried adding my commands, i even got output. But the response is very poor. Most of the times, my AT commands went unnoticed.
| How to send AT commands to modem once the connection is established? |
If that truly is just a cable adapter, with no electronics hidden underneath that black overmolding, you're not going to be able to use it to connect to the analog telephone network.
USB uses its four wires for power, ground, and a differential signaling pair, all operating at 5V DC.
POTS uses its four wires as two separate phone lines, with voltages up to 48VDC. There's phantom power riding on those lines, and the audio signal is modulated on top of that voltage.
This vast difference between computer data signaling and analog phone signaling is the very reason we have analog telephone modems: they convert the signaling scheme from one format to the other, and vice versa.
If you use one of those adapters to plug a live analog telephone line into your computer, you're likely going to blow up the USB port.
The only reason those adapters exist is so you can transport USB over cheap wiring, especially existing wiring. They won't be any good for high-speed USB with most phone cable, and won't be good for much distance besides.
There are commercially-available USB analog telephone modems, compatible with Linux and OS X at least. You just plug them into the USB port and they appear as /dev/ttyUSB0 or /dev/ttyACM0 on Linux, meaning the OS sees them as USB-to-serial adapters. You configure them for PPP the same as you would any old-school RS-232 serial port, like /dev/ttyS0 on Linux.
|
I have an adapter which on 1 side offers an RJ11 male plug, and on the other side and USB Type A female port, I also have another adapter which is similar but it offers and USB Type A male plug.
I would like to connect this to my computer and connect to the internet from there, removing the need for an external modem, anyone knows about how the drivers or the routing should be configured in this case ?EDIT 1
here is a picture of what I havehere are the other sidesof course this is the variant with the female USB, I have one with a Type A male plug as well.
| PPP over USB from RJ11 |
Checkout man 5 interfaces. The /etc/network/interfaces file tells bunch of scripts (debian package ifupdown) how to bring up various network interfaces. You'd find stanzas like the following in them:
auto eth0
iface eth0 inet dhcpThe 'auto eth0' line tells the ifupdown bunch of scripts to 'UP' the eth0 interface when asked to UP everything. The system startup script normally requests that without having to add any lines in it/them.
So, I suggest you have a look at your /etc/network/interfaces file to see if you have an iface line for eth0. If you do check for presence of auto eth0.
If you dont have a DHCP server on the network, you could static IP and set an auto-IP value (for e.g. 169.254.1.1) for the static address. If you chose to use 'manual' method you could add a simple script like the following to /etc/network/if-up.d/ :
#!/bin/bash
test "${IFACE}" = "eth0" && ifconfig ${IFACE} up
exit 0You'd need auto eth0 if you want it to be automagically brought up during bootup. You can test this (and your script) by using ifup -a and ifdown -a which acts on all the interfaces marked as auto.
|
When I try to connect to the Internet using pon provider, I get this error:
error sending pppoe packet: Network is down
error receiving pppoe packet: Network is downIf I configure the Internet with pppoeconf, then run pon provider, the connection works. I should not have to run pppoeconf every time I turn on my computer. How can I connect to the Internet, with pon without having to run pppoeconf every time?
Update:
When I installed Debian, the installer could not establish a DHCP connection, so I skipped the "Configure network" option. I have found, running this command allows me to start the Internet, without having to configure pppoeconf again.
ifconfig eth0 up
pon dsl-providerIs there some place I should add ifconfig eth0 up so that it begins during startup and shutdown or when I run pon or poff?
| PPPoE reports network is down |
Explanationthe rule set through iptables-nft is using xtables kernel modules (here: xt_tcpmss and xt_TCPMSS) through the nftables kernel API along a compatibility layer API, even if xtables was initially intended for (legacy kernel API) iptables.
Native nftables cannot use xtables kernel modules by design: whenever xtables is in use, it's not native anymore, and the userland nft command (or its API) deals only with native nftables. Use of xtables is reserved for the compatibility layer. So when displayed through nft any such unknown module is displayed commented out (but see later).the current version of iptables-nft wasn't yet able to translate automatically the iptables rule into native nftables rule (for this case) or there is no equivalent native nftables rule to translate to (eg: ponder the LED target).
Here nft sees there are xtables modules that aren't translatable by the common translation engine so considers this part as off limits and adds a comment on the untranslatable part, but still translates what it knowns about. The call to xtables modules can be seen with --debug=netlink:
# nft -a --debug=netlink list ruleset
ip mangle FORWARD 2
[ meta load oifname => reg 1 ]
[ cmp eq reg 1 0x30707070 0x00000000 ]
[ meta load l4proto => reg 1 ]
[ cmp eq reg 1 0x00000006 ]
[ match name tcp rev 0 ]
[ match name tcpmss rev 0 ]
[ counter pkts 0 bytes 0 ]
[ target name TCPMSS rev 0 ]table ip mangle { # handle 167
chain FORWARD { # handle 1
type filter hook forward priority mangle; policy accept;
oifname "ppp0" meta l4proto tcp tcp flags & (syn|rst) == syn # tcpmss match 1400:65495 counter packets 0 bytes 0 tcp option maxseg size set rt mtu # handle 2
}
}above: match and target mean xtables modules. Since nftables uses about the same engine as iptables-translate in this regard, one could guess -m tcpmss --mss 1400:65495 got an issue because that's the one which starts with a comment and isn't translated in the output, while the last part was translated. Whatever nft displays back here is only for the display and mustn't be taken as the actual rules.
The actual rules are the bytecodes shown with --debug=netlink (plus non-visible parts for xtables specific data), so this bytecode is the proof that this rule is doing something. It's just not useful to native nftables.Native nftables version
For example most of OP's iptables rule can be natively translated:
# iptables-translate -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
nft add rule ip mangle FORWARD tcp flags & (syn|rst) == syn counter tcp option maxseg size set rt mtuWhile there's no automatic translation available currently for -m tcpmss --mss , the feature is available: tcp option maxseg size which can be used either as an expression (the equivalent of the match -m tcpmss --mss) or with set as a statement (the equivalent of the target -j TCPMSS). Below would be the result of such translation (and might be in the future once the translation engine is improved):
nft add rule ip mangle FORWARD 'oifname ppp0 tcp flags & (syn|rst) == syn tcp option maxseg size 1400-65495 counter tcp option maxseg size set rt mtu'The second value 65495 is probably useless (one could just use tcp option maxseg size >= 1400 instead).Note
nft and iptables-nft can be misleading when trying to abuse translations. For example using iptables v1.8.7 (nf_tables) and nft v1.0.0, one can get this:
# iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# nft list ruleset | tee /tmp/mss.nft
table ip mangle {
chain FORWARD {
type filter hook forward priority mangle; policy accept;
meta l4proto tcp tcp flags & (syn|rst) == syn counter packets 0 bytes 0 tcp option maxseg size set rt mtu
}
}
# nft flush ruleset
# nft -f /tmp/mss.nft
# iptables-save
# Table `mangle' is incompatible, use 'nft' tool.That's because while nft was able to translate the whole ruleset when displaying it, the initial compat ruleset was still including an xtables target in the bytecode (the same as seen above: [ target name TCPMSS rev 0 ]): iptables-nft didn't behave as iptables-translate and nft's output hid the difference. Once run again through the nft command, the result is full native nftables with tcp option maxseg size set rt mtu instead of -j TCMPSS --clamp-mss-to-pmtu . But the iptables-save command doesn't recognize the result anymore as iptables-translated code and can't translate it back into iptables format.
Don't dump blindly iptables rules using nftables to reload them with nftables, this can bite later if iptables is still needed.
|
My pppoe client automatically adds an iptables rule iptables -t mangle -o "$PPP_IFACE" --insert FORWARD 1 -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -j TCPMSS --clamp-mss-to-pmtu from /etc/ppp/ip-up.d. However, this rule in nftables looks like
table ip mangle {
chain FORWARD {
type filter hook forward priority mangle; policy accept;
oifname "ppp0" meta l4proto tcp tcp flags & (syn|rst) == syn # tcpmss match 1400:65495 counter packets 714 bytes 42388 tcp option maxseg size set rt mtu
}
}Why contents after tcpmss is commented and this rule seems to do nothing?
| Why MSS clamping in iptables(-nft) seems to take no effect in nftables? |
I found the problem. First of all, during ppp session I especially set up the ppp peer without default route provisioning. Because of this the outgoing packet from pppX interface had no idea how to be routed. The situation was resolved with so called policy based routing.
First of all you need to pre-define all your additional routing tables in /etc/iproute2/rt_tables. My files looks like this:
# Ansible managed
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
103 kyivstar0
101 lifecell0
102 vodafone0These 101..103 are the routing tables for PPP interfaces. After that you need to set up the policy. It looks like this:
ip rule add from 100.83.31.204 table vodafone0
ip route add 0.0.0.0/0 via 10.64.64.64 dev ppp-vodafone0 table vodafone0Where:100.83.31.204 - Local PPP IP address
10.64.64.64 - Remote PPP IP address
ppp-vodafone0 - the name of PPP interface
vodafone0 - the route table name predefined in /etc/iproute2/rt_tablesAfter tuning up policy based routing everything works as expected.
|
I have a couple of 3G modems installed into my RaspberryPI via USB hub with external power adapter. The goal is to create several ppp connection via these modems and share the internet via socks5 proxy (1 carrier -> 1 dedicated port).
root@raspberrypi:/etc# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.88.81 netmask 255.255.255.0 broadcast 192.168.88.255
inet6 fe80::be35:5f3a:e942:e39a prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:92:b1:0b txqueuelen 1000 (Ethernet)
RX packets 8747 bytes 702623 (686.1 KiB)
RX errors 0 dropped 2448 overruns 0 frame 0
TX packets 1452 bytes 183993 (179.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 156 (156.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 156 (156.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ppp-kyivstar0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.203.1.38 netmask 255.255.255.255 destination 10.64.64.64
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 16 bytes 382 (382.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16 bytes 514 (514.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ppp-vodafone0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1440
inet 100.87.250.240 netmask 255.255.255.255 destination 10.64.64.65
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 7 bytes 58 (58.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7 bytes 82 (82.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0The config file of dante-server looks like this:
root@raspberrypi:/etc# grep -v "^#" /etc/danted-vodafone0.conf | grep -v "^$"
debug: 0
logoutput: stderr stdout
internal: 192.168.88.81 port = 50002
internal: 127.0.0.1 port = 50002
external: ppp-vodafone0
socksmethod: none
clientmethod: none
user.privileged: proxy
user.unprivileged: nobody
user.libwrap: nobody
client pass {
from: 192.168.88.0/24 port 1-65535 to: 0.0.0.0/0
}
client pass {
from: 127.0.0.0/8 port 1-65535 to: 0.0.0.0/0
}
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
socks block {
from: 0.0.0.0/0 to: lo
log: connect error
}
socks pass {
from: 192.168.88.0/24 to: 0.0.0.0/0
protocol: tcp udp
}
socks pass {
from: 127.0.0.0/8 to: 0.0.0.0/0
protocol: tcp udp
}
socks block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}When I try to test that with curl - nothing happens:
# curl -v --socks5 192.168.88.81:50002 http://ifconfig.co
* Rebuilt URL to: http://ifconfig.co/
* Trying 192.168.88.81...
* TCP_NODELAY set
* SOCKS5 communication to ifconfig.co:80
* SOCKS5 connect to IPv4 104.27.140.78 (locally resolved)
* Can't complete SOCKS5 connection to 0.0.0.0:0. (6)
* Closing connection 0
curl: (7) Can't complete SOCKS5 connection to 0.0.0.0:0. (6)From other side curl is able to make a connection through that interface when I soecify that as a parameter:
# curl -v --interface ppp-vodafone0 http://ifconfig.co
* Rebuilt URL to: http://ifconfig.co/
* Trying 104.27.140.78...
* TCP_NODELAY set
* Local Interface ppp-vodafone0 is ip 100.120.201.176 using address family 2
* Local port: 0
* Connected to ifconfig.co (104.27.140.78) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.co
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sat, 08 Sep 2018 00:20:50 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 14
< Connection: keep-alive
< Set-Cookie: __cfduid=df1da9ab56a621c1a8e3a1e75faac555c1536366050; expires=Sun, 08-Sep-19 00:20:50 GMT; path=/; domain=.ifconfig.co; HttpOnly
< Via: 1.1 vegur
< Server: cloudflare
< CF-RAY: 456d4066058483ee-KBP
<
46.133.227.38
* Curl_http_done: called premature == 0
* Connection #0 to host ifconfig.co left intact What can be wrong here?
| Dante SOCKS5 server does not send traffic through ppp interface |
chat & pppd
chat is a program that the pppd program can use to dial a modem connection. It is provided with a script of that describes the conversation required to establish the connection. (A conversation in this context is a series of commands issued by chat, and responses received from the modem.)
pon & poff
pon and poff are commands used to start and stop ppp connections. Starting the connection may use the chat program.
wvdial
wvdial is an intelligent program which automatically establishes a ppp connection. It is used instead of pon, chat, and poff to manage the connection. wvdial also performs the conversation required to establish the connection. wvdial can be configured to automatically disconnect idle connections.
|
I've checked their man pages, but I'm still confused. I just know they are all related to ppp connections.
I'm surprised that when I googled "pon wvdial relationship", I get no useful results, so I ask this question here.
Who can tell me the role of these three tools? I still feel they do the same thing... and... I find that a new tool - pon.wvdial has come out, and what is it?
I'm really confused with these tools...
| What is the relationship between wvdial, pon and chat? |
If I understand correctly you have this arrangement:
(Client)---LAN?---(VPN)---ppp0---(Raspberry Pi)---wlan0---(the internet)You mentioned that when you change your default route to use wlan0, you lose SSH access. You also indicated that you can't access the internet through ppp0 (through your VPN).If you just want your r-pi to have internet access...
You can't SSH into your PI when you change the default route because the default route is the only one that can get to your SSH client. So what you can do is add a new route to talk back to your SSH client then change your default route.
A really simple / dirty way to fix this temporarily is:
# Find your current SSH client IP address as seen by the raspberry pi
env | grep SSH_CLIENTThen assuming this gives you the IP 10.20.30.40 add a route to just that IP:
ip route add 10.20.30.40 dev ppp0 proto kernel scope link
# Now you can change your default route
ip route change default via 192.168.1.1 dev wlan0A better way to do this is to discover which subnet(s) can be accessed through ppp0 and then create routes for those instead of just your one SSH client. I can't tell how to find these subnets. But once you have this, the technique is the same. (eg subnet 10.20.0.0/16):
ip route add 10.20.0.0/16 dev ppp0 proto kernel scope link
# Now you can change your default route
ip route change default via 192.168.1.1 dev wlan0 |
I need to install remotely Omxplayer on a Raspberry Pi.
RPi is connected by a LTE modem through PPP0 interface.
My RPI is placed another country and I connect to Raspberry through my VPN using SSH.
My VPN does not have access to Internet and the default gateway is 10.1.64.1 (PPP0).
RPI has also WiFi Connection: WLAN0 interface.
I want to use WLAN0 to launch:"sudo apt-get install omxplayer" without lost my SSH communication through PPP0
ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 184 bytes 11776 (11.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 184 bytes 11776 (11.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.1.64.45 netmask 255.255.255.255 destination 10.64.64.64
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 202 bytes 25021 (24.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 808 bytes 65151 (63.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.93 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::2db7:3540:5e17:a470 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:da:d6:37 txqueuelen 1000 (Ethernet)
RX packets 1806 bytes 369775 (361.1 KiB)
RX errors 0 dropped 620 overruns 0 frame 0
TX packets 184 bytes 25229 (24.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0If I change the default gateway, I lost connectivity with the device.
I have tried the following command but it has not worked: I have lost the ssh connection.
sudo ip route change default via 192.168.1.1 dev wlan0sudo route add default gw 192.168.1.1My route table:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
0.0.0.0 192.168.1.1 0.0.0.0 UG 302 0 0 wlan0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
169.254.0.0 0.0.0.0 255.255.0.0 U 203 0 0 wwan0
192.168.1.0 0.0.0.0 255.255.255.0 U 302 0 0 wlan0$ ip route show
default dev ppp0 scope link
default via 192.168.1.1 dev wlan0 src 192.168.1.205 metric 302
10.64.64.64 dev ppp0 proto kernel scope link src 10.1.64.54
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.104.103 metric 203
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.205 metric 302How can I select the network interface?
Thanks in advance
| How can I select the network interface for installing a program in linux? |
The answer turned out to be that there was a bug in version 2.4.7 of pppd for Linux.
The solution was simply to upgrade to version 2.4.9 and I have successfully the 'client' to accept the interface identifier from the 'server'.
Here is the debug output on the client:
$ sudo pppd file ./ppp-options ipv6cp-accept-local /dev/ttyAMA0 115200
using channel 368
Using interface ppp0
Connect: ppp0 <--> /dev/ttyAMA0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x7f793cbe>]
rcvd [LCP ConfReq id=0xb <asyncmap 0x0> <magic 0xecde7250>]
sent [LCP ConfAck id=0xb <asyncmap 0x0> <magic 0xecde7250>]
rcvd [LCP ConfReq id=0xb <asyncmap 0x0> <magic 0xecde7250>]
sent [LCP ConfAck id=0xb <asyncmap 0x0> <magic 0xecde7250>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x7f793cbe>]
sent [LCP EchoReq id=0x0 magic=0x7f793cbe]
sent [IPV6CP ConfReq id=0x1 <addr fe80::0dfd:3c3b:e130:91ce>]
rcvd [LCP EchoReq id=0x0 magic=0xecde7250]
sent [LCP EchoRep id=0x0 magic=0x7f793cbe]
rcvd [LCP EchoRep id=0x0 magic=0xecde7250]
rcvd [IPV6CP ConfReq id=0xb <addr fe80::0000:0000:0000:0001>]
sent [IPV6CP ConfAck id=0xb <addr fe80::0000:0000:0000:0001>]
rcvd [IPV6CP ConfNak id=0x1 <addr fe80::0000:0000:0000:0002>]
sent [IPV6CP ConfReq id=0x2 <addr fe80::0000:0000:0000:0002>]
rcvd [IPV6CP ConfAck id=0x2 <addr fe80::0000:0000:0000:0002>]
local LL address fe80::0000:0000:0000:0002
remote LL address fe80::0000:0000:0000:0001
Script /etc/ppp/ipv6-up started (pid 7049)
Script /etc/ppp/ipv6-up finished (pid 7049), status = 0x0 |
I have two Raspberry Pis with their serial ports connected to each other. I have established a PPP link between the two of them and successfully ICMPV6 pinged and opened TCP sockets between them. But I can't work out how to get the 'client' pppd to accept the link-local IPv6 address provided by the 'server' pppd. I am trying to use static addresses so I know the link-local IP address of the remote peer.
On the 'server' I am running:
pppd file ./ppp-options ipv6 ::1,::2 /dev/ttyAMA0 115200And on the 'client', I am running:
pppd file ./ppp-options ipv6cp-accept-local /dev/ttyAMA0 115200However the ipv6cp-accept-local option doesn't seem to work as the man page describes:With this option, pppd will accept the peer's idea of our local IPv6 interface
identifier, even if the local IPv6 interface identifier was specified in an option.The 'client' machine is instead using a randomly assigned link local address:
Using interface ppp0
Connect: ppp0 <--> /dev/ttyAMA0
Deflate (15) compression enabled
local LL address fe80::fd28:565e:1186:02ff
remote LL address fe80::0000:0000:0000:0001The full output with debug turned on the client is here:
https://gist.github.com/njh/ab3282f43c72dcf6932b3693eb7dfca4
And this is my configuration file (used by both):
nodetach
noauth
persist
local
noip
+ipv6I am running Raspberry Pi OS, which has pppd version 2.4.7 installed on both devices.
| Configuring pppd to accept link-local IPv6 address from remote peer |
I finally figured out a way: I dropped wvdial and used nmcli (from the network-manager package) instead. I established the connection 10 hours ago and it is still active with the same IP. Here's how I did it:
Step 1: Get usb-modeswitch to run so your 3G USB stick is recognized as a modem, not a storage device. I am not going to cover the details here as there are many tutorials out there (example).
Step 2: Install NetworkManager on the RPi: sudo apt-get install network-manager network-manager-gnome -y. Check whether NetworkManager recognizes your modem by running nmcli dev. If yes, you should see a table like this:
DEVICE TYPE STATE
ttyUSB2 gsm disconnected(If no, your usb-modeswitch may have failed and your system cannot find a modem.)
Step 3: Start the X server: startx, open the NetworkManager from the menu and create a new "Mobile Broadband" connection ("Mobile Broadband" tab > "Add"). The wizard will guide you through the process even letting you select your provider so you don't have to bother with APN settings. The tool will create a connection file in /etc/NetworkManager/system-connections/ and you should take note of the name of that file as it will be used as the connection name in the next step.
Step 4: As I said in my question, I need to be able to run this from the command line without the X server and the way to do that is by running sudo nmcli con up id "Connection ID", the connection ID being the name of the connection you created in step 2. That should be all. To disconnect, execute sudo nmcli con down id "Connection ID".
|
I am trying to establish a 3G connection with Raspbian, a 3G USB dongle, usb_modeswitch and wvdial. I followed this tutorial which has worked well before with a different 3G dongle.
My 3G dongle is a ZTE D6601, the SIM has no PIN and the connection works flawlessly with the ISPs tool under Windows and under Ubuntu 15 with the built-in mobile broadband tool. But I need to do this on a Raspberry Pi and from the command line.
This is what I have tried so far: When I boot Raspbian, lsusb returns
Bus 001 Device 004: ID 19d2:0154 ZTE WCDMA Technologies MSM I then run
sudo usb_modeswitch -I -v 19d2 -p 0154 -c /etc/usb_modeswitch.conf Which changes the ProductID to
Bus 001 Device 009: ID 19d2:0108 ZTE WCDMA Technologies MSM There is more than one 3G dongle with 0154 as DefaultProduct ID so the standard switching rules of usb_modeswitch don't work. 0108 is what Ubuntu switches the device to or what happens when I sudo eject the virtual CD drive, so I used that.
My /etc/network/interfaces was only changed to use a WiFi connection:
auto loiface lo inet loopback
iface eth0 inet dhcpallow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcpSo far, so good. When I run sudo wvdialconf, a modem is detected at /dev/ttyUSB1. I then run sudo wvdial dcom with dcom being defined like this (APN "e-connect" is correct, no user / pass required):
[Dialer dcom]
Modem = /dev/ttyUSB1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","e-connect"
Stupid Mode = 1
Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Username = { }
Auto Reconnect = 1
Password = { }
Baud = 460800The shell returns this:
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 21600000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sat Apr 25 18:09:08 2015
--> Pid of pppd: 5530
--> Using interface ppp0
--> pppd: [08]FX[01]�FX[01]8GX[01]p<X[01]�PX[01]�QX[01] (+4 more times)After running this, ifconfig shows that ppp0 was created but no IP address is assigned. Then, about 10 seconds later this happens:
--> Disconnecting at Sat Apr 25 18:09:39 2015
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 5 seconds
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
ERROR
--> Invalid dial command.
--> Disconnecting at Sat Apr 25 18:09:45 2015If I run wvdial dcom again, it will repeat the output of the second connection attempt above (Invalid dial command) and not even configure ppp0. Weirdly, after a quick sudo wvdialconf (during which /etv/wvdial.conf remains unchanged), I can connect again, but it will again assign no IP and break after 10 seconds. I have replicated this several times.
Maybe this is also interesting: wlan0 loses its IP the moment ppp0 is created and I can only get it back running sudo ifdown wlan0 and sudo ifup wlan0 even though it is set to automatically reconnect.
| 3G connection with wvdial gets no IP, exits with code 16 |
Facing a similar issue,
sudo route add default ppp0worked for me.
If you need the process automated, you can create a script in /etc/ppp/ip-up.d, it will be executed when the connection is set.
|
my project needs mobile internet. I am trying to achieve this by using a LTE stick modem with a M2M sim (public IP, no NAT)
This works well on ubuntu (5.3.0-29-generic), but I cannot get it working on Raspbian Buster (4.19.97+)
Feb 11 22:31:48 raspberrypi systemd[1]: Reloading.
Feb 11 22:31:51 raspberrypi systemd[1]: [emailprotected]: Current command vanished from the unit file, execution of the command list won't be resumed.
Feb 11 22:31:51 raspberrypi systemd[1]: [emailprotected]: Current command vanished from the unit file, execution of the command list won't be resumed.
Feb 11 22:32:00 raspberrypi systemd[1]: Reloading.
Feb 11 22:32:41 raspberrypi pppd[699]: pppd 2.4.7 started by root, uid 0
Feb 11 22:32:41 raspberrypi pppd[699]: Using interface ppp0
Feb 11 22:32:41 raspberrypi pppd[699]: Connect: ppp0 <--> /dev/ttyUSB1
Feb 11 22:32:41 raspberrypi NetworkManager[288]: <info> [1581460361.7138] manager: (ppp0): new Ppp device (/org/freedesktop/NetworkManager/Devices/5)
Feb 11 22:32:42 raspberrypi pppd[699]: CHAP authentication succeeded: Welcome!!
Feb 11 22:32:42 raspberrypi pppd[699]: CHAP authentication succeeded
Feb 11 22:32:42 raspberrypi pppd[699]: Could not determine remote IP address: defaulting to 10.64.64.64
Feb 11 22:32:42 raspberrypi pppd[699]: not replacing default route to eth0 [192.168.0.1]
Feb 11 22:32:42 raspberrypi pppd[699]: local IP address 10.217.44.214
Feb 11 22:32:42 raspberrypi pppd[699]: remote IP address 10.64.64.64
Feb 11 22:32:42 raspberrypi pppd[699]: primary DNS address 109.249.185.224
Feb 11 22:32:42 raspberrypi pppd[699]: secondary DNS address 109.249.186.32
Feb 11 22:32:42 raspberrypi NetworkManager[288]: <info> [1581460362.2378] device (ppp0): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'external')
Feb 11 22:32:42 raspberrypi NetworkManager[288]: <info> [1581460362.3090] device (ppp0): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'external')
Feb 11 22:35:30 raspberrypi pppd[699]: Terminating on signal 15
Feb 11 22:35:30 raspberrypi pppd[699]: Connect time 2.8 minutes.
Feb 11 22:35:30 raspberrypi pppd[699]: Sent 0 bytes, received 0 bytes.
Feb 11 22:35:30 raspberrypi NetworkManager[288]: <info> [1581460530.4393] device (ppp0): state change: disconnected -> unmanaged (reason 'connection-assumed', sys-iface-state: 'external')
Feb 11 22:35:30 raspberrypi pppd[699]: Connection terminated.For this, I tried using wvdial with these settings
[Dialer Defaults]
Auto DNS = yes
Init1 = ATZ+CFUN=1
Init2 = ATH
Init3 = ATE1
Init3 = AT+CGDCONT=1,"IP","EEM2M"
Stupid mode = 1
Baud = 9600
Dial Command = ATD
Modem = /dev/ttyUSB1
ISDN = 0
Phone = *99#
Password = bt
Username = btNetworkManager.conf has this content
[main]
plugins=ifupdown,keyfile[ifupdown]
managed=falseppp/resolv.conf has this content
nameserver 109.249.185.224
nameserver 109.249.186.32I think this was set by the setup (see log above)
Last but not least, this shows when I do ifconfig -a after wvdial is running.
Note that the 6 packets in ppp0 are internal pings to 10.217.44.214
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.12 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::b435:fc5d:b267:a226 prefixlen 64 scopeid 0x20<link>
ether 00:e0:92:00:15:f3 txqueuelen 1000 (Ethernet)
RX packets 299 bytes 30739 (30.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 269 bytes 36598 (35.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 156 (156.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 156 (156.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.217.44.214 netmask 255.255.255.255 destination 10.64.64.64
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 6 bytes 66 (66.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7 bytes 129 (129.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0wwan0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:1e:10:1f:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Edit 1:
When running wvdial as root, I get this:
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ+CFUN=1
OK
--> Sending: ATH
OK
--> Sending: AT+CGDCONT=1,"IP","EEM2M"
OK
--> Modem initialized.
--> Sending: ATD*99#
--> Waiting for carrier.
CONNECT 150000000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Tue Feb 11 23:01:49 2020
--> Pid of pppd: 1281
--> Using interface ppp0
--> pppd: X?C[01]X?C[01]
--> pppd: X?C[01]X?C[01]
--> pppd: X?C[01]X?C[01]
--> pppd: X?C[01]X?C[01]
--> pppd: X?C[01]X?C[01]
--> pppd: X?C[01]X?C[01]
--> local IP address 10.217.44.214
--> pppd: X?C[01]X?C[01]
--> remote IP address 10.64.64.64
--> pppd: X?C[01]X?C[01]
--> primary DNS address 109.249.185.224
--> pppd: X?C[01]X?C[01]
--> secondary DNS address 109.249.186.32
--> pppd: X?C[01]X?C[01]I also noticed that when wvdial is running, the NetworkManager will load the correct DNS in /etc/resolv.conf, changing
# Generated by NetworkManager
nameserver 194.168.4.100
nameserver 194.168.8.100to
nameserver 109.249.185.224
nameserver 109.249.186.32
# Generated by NetworkManager | Linux ppp0 and default route and how to reach public internet |
Take out the .sh from the script name.
You can test with:
run-parts --test /etc/ppp/ip-up.dIf it does not shows up, it is because of permission/file naming.
|
My PPTP client is Ubuntu Desktop 14.04.2LTS.
My PPTP Server is a Buffalo DD-WRT Firmware.
If I establish my PPTP VPN connection (named Themiscyra):
luis@PortatilHP:~$ sudo pon Themiscyra
luis@PortatilHP:~$ sudo ifconfig
eth0 Link encap:Ethernet direcciónHW 98:4b:e1:c7:b8:4c
Direc. inet:192.168.11.2 Difus.:192.168.11.255 Másc:255.255.255.0
Dirección inet6: fe80::9a4b:e1ff:fec7:b84c/64 Alcance:Enlace
ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1
Paquetes RX:6091 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:4648 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:1000
Bytes RX:512969 (512.9 KB) TX bytes:449801 (449.8 KB)lo Link encap:Bucle local
Direc. inet:127.0.0.1 Másc:255.0.0.0
Dirección inet6: ::1/128 Alcance:Anfitrión
ACTIVO BUCLE FUNCIONANDO MTU:65536 Métrica:1
Paquetes RX:139 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:139 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:0
Bytes RX:10137 (10.1 KB) TX bytes:10137 (10.1 KB)ppp0 Link encap:Protocolo punto a punto
Direc. inet:192.168.210.154 P-t-P:192.168.210.1 Másc:255.255.255.255
ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1446 Métrica:1
Paquetes RX:6 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:6 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:3
Bytes RX:72 (72.0 B) TX bytes:78 (78.0 B)wlan0 Link encap:Ethernet direcciónHW ec:55:f9:35:8a:98
ACTIVO DIFUSIÓN MULTICAST MTU:1500 Métrica:1
Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:1000
Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)... the PPTP connection gets stablished as ppp0. There are no more PPTP connections defined:
luis@PortatilHP:~$ sudo ls /etc/ppp/peers/ -la
total 16
drwxr-s--- 2 root dip 4096 jun 8 21:59 .
drwxr-xr-x 8 root root 4096 mar 12 22:37 ..
-rw-r----- 1 root dip 1093 jul 23 2014 provider
-rw-r--r-- 1 root dip 153 jun 8 21:59 ThemiscyraBut I have prepared a simple script to change the netmask for ppp0 to 255.255.255.0 :
luis@PortatilHP:~$ ls -la /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh
-rwxr-xr-x 1 root root 96 jun 8 23:04 /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh
luis@PortatilHP:~$ more /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh
#!/bin/sh
ifconfig ppp0 netmask 255.255.255.0As can be seen, this script is not autoexecuted. So I need to start it manually:
luis@PortatilHP:~$ sudo /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh
luis@PortatilHP:~$ sudo ifconfig
eth0 Link encap:Ethernet direcciónHW 98:4b:e1:c7:b8:4c
Direc. inet:192.168.11.2 Difus.:192.168.11.255 Másc:255.255.255.0
Dirección inet6: fe80::9a4b:e1ff:fec7:b84c/64 Alcance:Enlace
ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1
Paquetes RX:6398 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:4885 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:1000
Bytes RX:538500 (538.5 KB) TX bytes:475909 (475.9 KB)lo Link encap:Bucle local
Direc. inet:127.0.0.1 Másc:255.0.0.0
Dirección inet6: ::1/128 Alcance:Anfitrión
ACTIVO BUCLE FUNCIONANDO MTU:65536 Métrica:1
Paquetes RX:139 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:139 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:0
Bytes RX:10137 (10.1 KB) TX bytes:10137 (10.1 KB)ppp0 Link encap:Protocolo punto a punto
Direc. inet:192.168.210.154 P-t-P:192.168.210.1 Másc:255.255.255.0
ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1446 Métrica:1
Paquetes RX:6 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:6 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:3
Bytes RX:72 (72.0 B) TX bytes:78 (78.0 B)wlan0 Link encap:Ethernet direcciónHW ec:55:f9:35:8a:98
ACTIVO DIFUSIÓN MULTICAST MTU:1500 Métrica:1
Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:1000
Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)What is going on here?
The plog command seems not to show any relevant info:
luis@PortatilHP:~$ sudo plog
Jun 8 23:12:05 PortatilHP pppd[3675]: CHAP authentication succeeded
Jun 8 23:12:05 PortatilHP pppd[3675]: MPPE 128-bit stateless compression enabled
Jun 8 23:12:05 PortatilHP pppd[3675]: local IP address 192.168.210.154
Jun 8 23:12:05 PortatilHP pppd[3675]: remote IP address 192.168.210.1... so, knowing about some log reporting about /etc/ppp/ip-up.d/ scripts info could be very useful for me in the future. Does such thing exists? It seems there is nothing at /var/log.
| VPN: Script at /etc/ppp/ip-up.d/ not autoexecuting on PPTP connection established |
No.
provider is the file where the ppp configuration is stored, probably at /etc/ppp/peers/provider. It´s somehow a "profile" of your ppp connection. What defines the interface name is the last part of the second line, inet ppp.
To redial automatically your ppp conection, you should add the persist parameter to this provider file.
Aditional documentation:Debian PPPoE Wiki
PPPoE configuration
Good detailed explanation of /etc/network/interfaces syntax? |
I always used static ip or dhcp configurations in past, and this is what normally happens:when I pull out the cable my interface goes down
when I plug back the cable the interface goes back up and in case of dhcp it gets a new ipThis time I moved to pppoe with the autoconfiguration did by debian installer (running the command line modules=ppp-udeb pressing TAB key before running the installer).
What i found is that pppoe interface starts up automatically when the system boot but if i unplug the cable and plug it back the interface is stuck.
The interface is keept up until some kind of timeout happens and there's no way to have the pppoe reconnect and getting a new ip once plugged in back.
How can i fix this? My auto generated /etc/network/interfaces file is the following:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).# The loopback network interface
auto lo
iface lo inet loopback# PPPoE connection
auto provider
iface provider inet ppp
pre-up /sbin/ifconfig eth0 up
provider provider# The primary network interface
allow-hotplug eth0
iface eth0 inet manual# The secondary network interface used for
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0I would also ask why the interface name is called provider ?
shouldn't be ppp0 ?
When the system boot and I go in ifconfig the interface is named ppp0 not provider!
| PPPoE not working as Hotplug in particular conditions (Realtek 8169 NIC and Kernel 3.x) |
It is not generally possible to send AT commands to a modem while a call is in progress. This applies to all AT-compatible modems, "regular" dial-up modems and mobile phone modems alike, and it has nothing to do with PPP.
By the way, a point of terminology: PPP sessions are not mounted. Mouting and umounting are terms that apply to filesystems.
There are two ways that commands can be sent to a modem while a call is in progress:Using the +++ escape sequence. You must sent the three characters +++ surrounded by one second of idle (no transmission) before and after. The modem will return to command mode. The call is suspended following execution of the escape sequence (which means that your PPP session will probably time out and break if you are not fast). Use ATO to return to the call. Note that the +++ escape sequence is often disabled (unavailable), and sometimes even if it is enabled it will drop the call unstead of suspending it. The +++ escape sequence is a very old standard is is not commonly used today.
If the modem has more than one serial port connecting it to the computer, then you can send commands on one serial port while a call is in progress on the other one. Traditional dial-up or ISDN modems never have this feature, but I believe modern mobile phone modems might. |
I'm working on a IMX6 based board, and I need some advice to handle my modem.
I've successfully configure the modem, and mounted the ppp. The modem is working fine and everything's great, but now I want to send him some AT command while running.
Here is the content of my option file :
/dev/ttyACM0
115200
persist
maxfail 0
defaultroute
noipdefault
noauth
updetach
noccp
debug
usepeerdns
novj
connect "/usr/sbin/chat -v -f /etc/ppp/connect"The modem is on /dev/ttyACM0, and of course, when ppp is mounted, the file is locked. I have not put 'lock' in the /etc/ppp/option file. I have tried to put nolock in it too, but the file is still locked :(
Is there a way to send command to the modem without unmount the ppp ? How ?
Thanks.
| Sending command to an already mounted modem |
So, I came up with this solution.
enable lqr
set lqrperiod 5 |
I run FreeBsd box with pppd over Ethernet. Everything works just fine with only one exception. Sometimes, not too often, the connection becomes stale. Everything looks like if it is ok: ifconfig shows it is up, ppp says that the link is ok, but traffic does not come through. What I do is run killall pppd and then restart ppp manually. It reconnects and things are great again.
My question is: is there a setting in pppd (or mpd5, or anywhere else) that if set, makes ppp detect that the link is stale and reconnect automatically?
If there isn't such a setting, maybe there is another solution?
| Reconnect if the link is stale |
What I would do is to redirect the output of wvdial to a file, and separately print out “interesting” lines from the file as they appear.
wvdial >wvdial.log 2>&1Here's one way to filter the file. tail -n +1 -f means to follow the file as it grows (-f), starting with the first line (-n +1). The filter grep -v means to display all but the matching line; -E chooses the “modern” syntax for regular expressions.
tail -n +1 -f wvdial.log |
grep -vE '^--> (pppd: >\[7f\]|Warning)$'There are several programs that combine the file watch feature of tail -f (which is often called tailing a file) with filtering and coloring capabilities; browse the tail tag on this site and see in particular grep and tail -f? and How to have tail -f show colored output.
|
I use wvdial to connect to the net with with my USB modem. It works correctly, and I am quite happy with it. When I start it in XFCE I have it set to output to a borderless, transparent terminal so the status displays on my desktop, life is good. Everything is great, I just want to tweak it.
I'm hoping to filter the output with a 'grep -v' to remove unsightly non-information. Here is the output from a sample run. The output is consistantly the same, except for IP addresses..
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!}!} }9}"}&} } } } }#}%B#}%}%}&3za[02]}'}"}(}"J};~
--> PPP negotiation detected.
--> Starting pppd at Mon Nov 14 11:00:06 2011
--> Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
--> --> PAP (Password Authentication Protocol) may be flaky.
--> Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
--> --> CHAP (Challenge Handshake) may be flaky.
--> Pid of pppd: 17776
--> Using interface ppp0
--> pppd: >[7f]
--> pppd: >[7f]
--> pppd: >[7f]
--> pppd: >[7f]
--> local IP address 10.81.25.50
--> pppd: >[7f]
--> remote IP address 10.133.28.10
--> pppd: >[7f]
--> primary DNS address 10.133.20.11
--> pppd: >[7f]
--> secondary DNS address 10.132.20.11
--> pppd: >[7f]
^CCaught signal 2: Attempting to exit gracefully...
--> Terminating on signal 15
--> pppd: >[7f]
--> Connect time 0.2 minutes.
--> pppd: >[7f]
--> pppd: >[7f]
--> Disconnecting at Mon Nov 14 11:00:16 2011Can someone please help me with a command line or script that would filter that output and remove the --> pppd: >[7f] lines, and possibly the pap/chap warnings(they're bogus).
I've tried several things, with pipes and redirection to grep but haven't hit on anything that seems to effect the output. As a note: in the pppd:/[7f] lines it appears the second '>' character could be just about anything(still don't know what pppd is trying to tell me. :)
Thanks!
EDIT:
I got it. Simple stuff really, if you're not a knob. I'm a knob..
wvdial 2>&1 | grep -v -i -E "7f]|pap|chap"
the output is on stderr and pipes are for stdout. the 2>&1 redirects so it will pipe properly.
If you've read this far, thanks.
| How to filter wvdial/pppd terminal output |
The package r8168-dkms_8.048.03-1~bpo10+1_all.deb includes the file /etc/modprobe.d/r8168-dkms.conf, which will tell the kernel to load the r8168 module instead of the default r8169 for specific card models.
The package includes the r8168 module in source code form only: in order to make it usable, the dkms utility will be used by this package to automatically build the module for every kernel version you're using.
(here's the list of contents for that package)
But DKMS can only do its job if you have the compiler and the linux-headers package that matches your exact kernel version installed. Either you don't have the appropriate linux-headers package for your current kernel installed, or something has gone wrong when DKMS was trying to auto-build the r8168 module for you.
You should begin troubleshooting by verifying DKMS is in the proper state, by running sudo dkms status.
If the kernel module is properly built, the output of the dkms status command should include a line like this:
r8168, 8.048.03, <your current kernel version>, amd64: installedThe <your current kernel version> field should exactly match the output of uname -r.
The word installed at the end means the actual binary module has been successfully built and inserted into the current kernel's /lib/modules/$(uname -r)/... directory tree. Other possible status words are built which means the binary module has been successfully built but has not yet been made available to the kernel, and added which means the source code for the module has been installed but the binary module is not built yet.
You should verify that you have the appropriate linux-headers package installed, and then retry building the module by running:
sudo dkms install r8168/8.048.03If it reports a problem, a more detailed log of the build process and any error messages encountered during it can be found at /var/lib/dkms/r8168/8.048.03/$(uname -r)/x86_64/log/make.log.
If you wish to try the default r8169 driver instead, you will need to uninstall the r8168-dkms_8.048.03-1~bpo10+1_all.deb package, or rename the /etc/modprobe.d/r8168-dkms.conf to e.g. /etc/modprobe.d/r8168-dkms.conf.disabled and run sudo update-initramfs -u to propagate the change into your current initramfs file too.
|
Two os installed on my pc,today a strange thing happens:my ethernet device lost in debian!
Enter into win10 from grub, i can connect internet with pppoe.
Enter into debian10 from grub :
ifconfiglo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 20 bytes 1120 (1.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 1120 (1.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0sudo lshw -C network
*-network UNCLAIMED
description: Ethernet controller
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
version: 15
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list
configuration: latency=0
resources: ioport:f000(size=256) memory:fcd04000-fcd04fff memory:fcd00000-fcd03fffI get the mac address info--xx:xx:70:c2:2c:4a from ipconfig /all in win10.
sudo pppoeconf xx:xx:70:c2:2c:4a
Cannot find device "xx:xx:70:c2:2c:4a"
ioctl(SIOCGIFHWADDR): No such device
Cannot find device "xx:xx:70:c2:2c:4a"
Plugin rp-pppoe.so loaded.
/usr/sbin/pppd: unknown host: nic-00Download r8168-dkms_8.048.03-1~bpo10+1_all.deb with win10 into usb,and enter into debian10.
sudo mount /dev/sdc /mnt
sudo dpkg -i /mnt/r8168-dkms_8.048.03-1~bpo10+1_all.debAfter re-install it:
sudo pppoeconf xx:xx:70:c2:2c:4a
#input account name and password
sudo pon dsl-provier
plugin rp-pppoe.so load
/usr/sbin/pppd:unknown host nic-00Just yesterday i can connect to internet with pppoe in debian10,how to fix then?
If Windows was hibernated it could have turn the card into the state when it is unusable in Debian. The solution could be to assure Windows was shut down, not hibernated.
@Nikita Kipriyanov ,i am sure that it is un-related with windows.
I installed a new debian10 with same version after the old debian10 can't recognize ethernet device ,now there are three oses in my pc instead of dual.Enter into the new installed debian , i can connect internet with pppoeconf!That is to say, both win10 and new installed debian10 can connect with internet!Why my old debian10 can't recognize ethernet device!
I downloaded firmware-realtek_20190114-2_all.deb into usb in win10 and dpkg it in the old debian10,nothing changed!
All drivers show:
modinfo r8169
filename: /lib/modules/5.10.0-0.bpo.7-amd64/kernel/drivers/net/ethernet/realtek/r8169.ko
firmware: rtl_nic/rtl8125b-2.fw
firmware: rtl_nic/rtl8125a-3.fw
firmware: rtl_nic/rtl8107e-2.fw
firmware: rtl_nic/rtl8107e-1.fw
firmware: rtl_nic/rtl8168fp-3.fw
firmware: rtl_nic/rtl8168h-2.fw
firmware: rtl_nic/rtl8168h-1.fw
firmware: rtl_nic/rtl8168g-3.fw
firmware: rtl_nic/rtl8168g-2.fw
firmware: rtl_nic/rtl8106e-2.fw
firmware: rtl_nic/rtl8106e-1.fw
firmware: rtl_nic/rtl8411-2.fw
firmware: rtl_nic/rtl8411-1.fw
firmware: rtl_nic/rtl8402-1.fw
firmware: rtl_nic/rtl8168f-2.fw
firmware: rtl_nic/rtl8168f-1.fw
firmware: rtl_nic/rtl8105e-1.fw
firmware: rtl_nic/rtl8168e-3.fw
firmware: rtl_nic/rtl8168e-2.fw
firmware: rtl_nic/rtl8168e-1.fw
firmware: rtl_nic/rtl8168d-2.fw
firmware: rtl_nic/rtl8168d-1.fw
license: GPL
softdep: pre: realtek
description: RealTek RTL-8169 Gigabit Ethernet driverls /lib/firmware/rtl_nic
rtl8105e-1.fw rtl8107e-1.fw rtl8125b-2.fw rtl8168d-2.fw rtl8168e-3.fw rtl8168fp-3.fw rtl8168g-3.fw rtl8402-1.fw
rtl8106e-1.fw rtl8107e-2.fw rtl8153a-3.fw rtl8168e-1.fw rtl8168f-1.fw rtl8168g-1.fw rtl8168h-1.fw rtl8411-1.fw
rtl8106e-2.fw rtl8125a-3.fw rtl8168d-1.fw rtl8168e-2.fw rtl8168f-2.fw rtl8168g-2.fw rtl8168h-2.fw rtl8411-2.fwNo ethernet device such as enp*s*.
ifconfig -a
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 20 bytes 1120 (1.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 1120 (1.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0uname -a
Linux debian 5.10.0-0.bpo.7-amd64 #1 SMP Debian 5.10.40-1~bpo10+1 (2021-06-04) x86_64 GNU/Linux | My ethernet device lost in debian |
libcurl respect environnement variables http_proxy https_proxy
So this is very simple :
export http_proxy=http://yourproxy.example.com:3128/
export https_proxy=http://yourproxy.example.com:3128/
./my-application-exesource:
https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html
|
There are are lot of excellent answers to this question which involve setting iptables routes on the router. However I need to set up the iptables routes on the client.
I'm working on an embedded system. This is connected to the internet using ppp and a GPRS modem. The system runs an application that makes https requests via libcurl.
I now need to route those https requests through a transparent https proxy server hosted somewhere on the internet. I've set up an https proxy with squid and ssl_bump, and I've verified that it's all working as expected.
There are various ways of routing the https requests through the proxy e.g. I can rebuild the application and configure libcurl to use the proxy server via CURLOPT_PROXY. But I'm wondering if it might be simpler and more flexible to set up a route to forward everything sent to the HTTPS port to the proxy.
The closest question I've seen is How do I configure a transparent proxy where the proxy server is remote? but this requires the route to contain the IP address of the client. As this is a GPRS connection which will come and go, the IP address will be unknown and will change from time to time.
| How to set up routing of https to proxy server on client |
Your Issue
I would recommend a separate routing table for this, since I assume the traffic arriving at 192.168.0.2 has a source address of 35.100.100.35. The issue you're having is that 35.100.100.35 isn't listed in your routing table, so the default is being used.
You might be able to get away with something as simple as:
ip route add 35.0.0.0/8 via 192.168.0.1 dev ppp0So that when your machine tries to respond to a 35 address, it does so on the ppp0 interface.
The more robust/elaborate version follows.
NOTE: You should reboot your machine to clear out any temporary changes you've made to your routing table.Routing Rules
A simple enough routing rule is to have any traffic that is destined to or from a specific IP or subnet to use a different routing table:
ip rule add from [interface ip]/[netmask] tab [table number] priority [priority]
ip rule add to [interface ip]/[netmask] tab [table number] priority [priority]In this case you're concerned about traffic arriving at 192.168.0.2 (your ppp0 device IP). You'll need to create a new routing table by adding to the file: /etc/iproute2/rt_tables. The syntax is [table number] [table name]. I normally use the interface name as the table name, keep things simple.
echo "168 ppp0" >> /etc/iproute2/rt_tables ip rule add from 192.168.0.2/32 tab 168 priority 101
ip rule add to 192.168.0.2/32 tab 168 priority 101This should cause all traffic addressed to 192.168.0.2 to match routing table 168, as well as any traffic that is in response to traffic in that table.Using New Routing Tables
Now we've directed traffic to that routing table 168, but it would be empty, only need to add a default route to it now.
ip route add default via 192.168.0.1 dev ppp0 table 168This adds a default route to table 168, which is simply to say use interface ppp0.What It Looks Like
Your routing tables in the end should probably look like this:
# ip route show
default dev eth0 proto static metric 1024
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20
192.168.0.0/24 dev ppp0 proto kernel scope link src 192.168.0.2This is your standard routing table, the table normally used for traffic. As for the routes here: the default as you've probably originally defined, and the second two are inferred based on the IP address of your interfaces.
# ip rule show
0: from all lookup local
101: from 192.168.0.2 lookup ppp0
101: from all to 192.168.0.2 lookup ppp0This lists your routing rules, format is "[priority]: [rule] lookup [table]". This example states that normally, use the local routing table. If the traffic is to or from 192.168.0.2 use the routing table named ppp0.
# ip route show table ppp0
default via 192.168.0.1 dev ppp0This shows the routing table named ppp0, which should just send all traffic out ppp0.End Result
The end result of this is that when traffic is heading to or from the IP of your ppp0 interface, it will use the routing table called ppp0. The routing table ppp0 just send all traffic out device ppp0.
|
I used this guide to connect to my VPN server (pptp) which is the only one guide that worked from many tutorials.
After connecting to the VPN server the route table looks like below and sometimes it's only the last 2 lines (very random I'm sure there's a reason).
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 255.255.255.255 UGH 0 0 0 ppp0
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0My set up: (IPs changed in example to make it simple)Local computer (centos) running on 192.168.1.20
This connects to external VPN (ubuntu) on 35.100.100.35 (internet) with internal VPN local IP 192.168.0.1
When centos is connected, interface ppp0 gets added with the IP 192.168.0.2However, I need all traffic from 192.168.0.2 to be routed via 192.168.0.1 (vpn server). Currently it uses local internet.
I've tried so many variations and cannot get it right.
route add default ppp0 used to work but with the route tables destroyed it's not working anymore.
What should the route table look like?
| route table with eth0 and ppp0 broken |
As it turns out, PPP is affecting it's own serial port, and since that's the one that's used to configure the GPS, that's what's causing the problem.
By comparing the results of stty -F /dev/ttyUSB3 before and after running PPP, it became apparent that PPP was configuring the serial port in raw mode, which meant I couldn't use it to configure the GPS port. What's interesting is that these settings persisted even after the ttyUSBx device nodes were removed and recreated due to the modem being reset.
Simply running stty sane -F /dev/ttyUSB3 to revert back to default settings allowed me to configure the GPS port without issue.
|
I've got a Buildroot-based embedded system that uses a 3G modem (Cinterion PH8-P) and PPP to connect to the internet. The 3G modem is a USB device that provides 4 ttyUSB ports. One of these is used for PPP, whereas another is used for GPS.
Occasionally, the 3G modem will stop working and will need to be restarted. I do this by first stopping the PPP and GPSd daemons, then restarting the modem, and then restarting the daemons again. Unfortunately, it seems that if PPP is run beforehand, it seems to affect the serial ports in some way so that other programs can no longer use them.
For example, if I run the following on a freshly booted system where PPP has not been run yet:
cat /dev/ttyUSB3&
echo "AT" > /dev/ttyUSB3I get the expected OK AT response back. If I then run PPP for a bit (by calling pon), then stop it (by calling poff), restart the modem and try to send the same AT command again, the terminal just seems to echo back exactly what I sent to the modem and I don't get the OK response. As a result, the GPS won't work, since I stop receiving NMEA messsages from the GPS tty port. It's almost like PPP is configuring all the serial ports to redirect their outputs somewhere else. Despite this, PPP has no problem at all starting up again after the modem has rebooted - according to the logs, the chat scripts happily send their AT commands and get the expected responses back.
What could be causing this issue?
| ppp affecting serial ports so that they cannot be used if modem is reset |
I figured out the answer. The problem was that Verizon will cut a connection if it receives 10 invalid packets in a span of 2 minutes. The problem was that I wasn't NATing packets properly since I was also using this as a router. The packets being sent out from the bridged lan were being sent to verizon with a source IP of 192.168.123.XXX. Verizon (rightly so) decided that these packets were invalid and would shut off the connection. The solution was to simply add this Iptables rule:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE |
I am trying to establish a cellular connection to Verizon through my Multitech Multiconnect Dragonfly (MTQ-LVW3-B02). I am able to connect to Verizons network and get an IP address. The problem is that after a few seconds the modem hangs up the connection.
Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-
ppp-plugin: (nm_ip6_up): sending IPv6 config to NetworkManager...
Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-up
started (pid 10367)
Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-up
finished (pid 10367), status = 0x0
Mar 26 19:26:57 localhost pppd[10353]: sent [IPCP ConfReq id=0x3 <addr
100.113.208.106> <ms-dns1 198.224.160.135> <ms-dns2 198.224.164.135>]
Mar 26 19:26:57 localhost pppd[10353]: rcvd [IPV6CP ConfAck id=0x2 <addr
fe80::0000:0052:19b4:d801>]
Mar 26 19:26:57 localhost pppd[10353]: local LL address fe80::0000:0052:19b4:d801
Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_ip_up): ip-up event
Mar 26 19:26:57 localhost pppd[10353]: remote LL address fe80::6dac:d335:a09b:525b
Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_ip_up): sending IPv4 config to NetworkManager...
Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ip-up started (pid 10369)
Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ipv6-up started (pid 10367)
Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ipv6-up finished (pid 10367), status = 0x0
Mar 26 19:26:57 localhost pppd[10353]: rcvd [IPCP ConfAck id=0x3 <addr 100.113.208.106> <ms-dns1 198.224.160.135> <ms-dns2 198.224.164.135>]
Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.0839] ppp-manager: (IPv4 Config Get) reply received.
Mar 26 19:26:57 localhost pppd[10353]: local IP address 100.113.208.106
Mar 26 19:26:57 localhost pppd[10353]: remote IP address 100.113.208.106
Mar 26 19:26:57 localhost pppd[10353]: primary DNS address 198.224.160.135
Mar 26 19:26:57 localhost pppd[10353]: secondary DNS address 198.224.164.135
Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ip-up started (pid 10369)
Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ip-up finished (pid 10369), status = 0x0
Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ip-up finished (pid 10369), status = 0x0
Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.1068] policy: set 'vzw' (ppp0) as default for IPv4 routing and DNS
Mar 26 19:26:57 localhost dnsmasq[2407]: using nameserver 198.224.160.135#53(via ppp0)
Mar 26 19:26:57 localhost dnsmasq[2407]: using nameserver 198.224.164.135#53(via ppp0)
Mar 26 19:26:57 localhost nm-dispatcher: req:4 'up' [ppp0]: new request (1 scripts)
Mar 26 19:26:57 localhost nm-dispatcher: req:4 'up' [ppp0]: start running ordered scripts...
Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.1530] policy: set 'vzw' (ppp0) as default for IPv6 routing and DNS
Mar 26 19:27:03 localhost pppd[10353]: Modem hangup
Mar 26 19:27:03 localhost pppd[10353]: Connect time 0.1 minutes.
Mar 26 19:27:03 localhost pppd[10353]: Sent 1302 bytes, received 1196 bytes.
Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ip-down started (pid 10523)
Mar 26 19:27:03 localhost pppd[10353]: cif6addr: ioctl(SIOCDIFADDR): No such address
Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ip-down started (pid 10523)
Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ipv6-down started (pid 10527)
Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-down started (pid 10527)
Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect'
Mar 26 19:27:03 localhost pppd[10353]: Connection terminated.
Mar 26 19:27:03 localhost pppd[10353]: Connect time 0.1 minutes.
Mar 26 19:27:03 localhost pppd[10353]: Sent 1302 bytes, received 1196 bytes.
Mar 26 19:27:03 localhost nm-dispatcher: req:5 'down' [ppp0]: new request (1 scripts)
Mar 26 19:27:03 localhost nm-dispatcher: req:5 'down' [ppp0]: start running ordered scripts...
Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ip-down finished (pid 10523), status = 0x0
Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-down finished (pid 10527), status = 0x0
Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ip-down finished (pid 10523), status = 0x0
Mar 26 19:27:03 localhost NetworkManager[2071]: <info> [1522092423.7625] devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ipv6-down finished (pid 10527), status = 0x0
Mar 26 19:27:03 localhost pppd[10353]: Exit.
Mar 26 19:27:17 localhost NetworkManager[2071]: <info> [1522092437.1293] ppp-manager: starting PPP connection
Mar 26 19:27:17 localhost NetworkManager[2071]: <info> [1522092437.1344] ppp-manager: pppd started with pid 10576
Mar 26 19:27:17 localhost pppd[10576]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:17 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing
Mar 26 19:27:17 localhost pppd[10576]: pppd 2.4.7 started by root, uid 0
Mar 26 19:27:17 localhost pppd[10576]: Device ttyACM0 is locked by pid 10520
Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
Mar 26 19:27:17 localhost pppd[10576]: Exit.
Mar 26 19:27:17 localhost NetworkManager[2071]: <warn> [1522092437.1605] ppp-manager: pppd pid 10576 exited with error: Serial port lock failed
Mar 26 19:27:28 localhost NetworkManager[2071]: <info> [1522092448.3542] ppp-manager: starting PPP connection
Mar 26 19:27:28 localhost NetworkManager[2071]: <info> [1522092448.3592] ppp-manager: pppd started with pid 10589
Mar 26 19:27:28 localhost pppd[10589]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:28 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing
Mar 26 19:27:28 localhost pppd[10589]: pppd 2.4.7 started by root, uid 0
Mar 26 19:27:28 localhost pppd[10589]: Device ttyACM0 is locked by pid 10520
Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
Mar 26 19:27:28 localhost pppd[10589]: Exit.
Mar 26 19:27:28 localhost NetworkManager[2071]: <warn> [1522092448.3865] ppp-manager: pppd pid 10589 exited with error: Serial port lock failed
Mar 26 19:27:39 localhost NetworkManager[2071]: <info> [1522092459.7109] ppp-manager: starting PPP connection
Mar 26 19:27:39 localhost NetworkManager[2071]: <info> [1522092459.7159] ppp-manager: pppd started with pid 10592
Mar 26 19:27:39 localhost pppd[10592]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:39 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded.
Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing
Mar 26 19:27:39 localhost pppd[10592]: pppd 2.4.7 started by root, uid 0
Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
Mar 26 19:27:39 localhost NetworkManager[2071]: <warn> [1522092459.7426] ppp-manager: pppd pid 10592 exited with error: Serial port lock failed
Mar 26 19:27:39 localhost pppd[10592]: Device ttyACM0 is locked by pid 10520
Mar 26 19:27:39 localhost pppd[10592]: Exit.
Mar 26 19:28:00 localhost NetworkManager[2071]: <warn> [1522092480.2188] ppp-manager: pppd timed out or didn't initialize our dbus moduleI am using nmcli through NetworkManager. I have seen other questions where people believe that the device is not supplying enough power to the USB. I still see the device in lsusb when it's offline though.
lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0424:5744 Standard Microsystems Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0424:2740 Standard Microsystems Corp.
Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 003: ID 1bc7:0036 Telit Wireless Solutions
Bus 001 Device 002: ID 0424:2744 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubI have tried adding noipdefault to the options file but that didn't seem to work either.
I am at a total loss and any help debugging would be great.
| cellular modem: pppd modem hangup |
I figured it out, so here's an answer so I'm not denvercoder9.
Adding a new config to the snmpd.conf seems to have both trimmed the interface march as well as prevented complaints.
interface_replace_old yesI think that's the one. It could be that simple.
Try it yourself if you run into the same problem, and let me know if I've got it wrong.
|
Sorry if this is a repeat. I searched, but with no luck.
I'm using SNMPd on an openwrt/wr host with some ppp and tun connections. These connections get IDs in the if table, and will actually get a new ID whenever the tunnels reconnect.
Nagios (check_mk), when that happens, complains that an interface went down; oh, and a different one with the same name came up right afterward. In the meantime, it's iterating over so many interfaces that the reports are of 'interface 4933 down'; and an snmpwalk shows close to 4932 datapoints before it.
How are the helpful folks here handling a monitoring situation like that?
| Nagios/SNMP - devices alerting when ppp/tun connections cycle |
PPP can run protocols other than IP; the most common is of course IPv6. But numerous others have been (and maybe still are) run over PPP. Wikipedia even has a list of protocols that run over PPP, though I'm not sure how many work on Linux.
Also — the reason you run PPP over a serial link is because you want to run a higher-level protocol like IP. If you want to avoid that overhead, just use the serial link directly. Serial links don't require PPP; you can send raw binary data over RS232 using whatever application-specific protocol you'd like.
|
I'm using a PPP to communicate with a device. So far what I have been doing is instantiating PPP on my machine (Fedora 29) and on the device (Yocto Linux). Then I open a TCP/UDP socket and communicate with the device. My serial link (which is why I use PPP) has low baud rate, 4800 to be exact. I cannot change it, it is a project requirement. I've been doing some reading about PPP and as far as I understand I can't just instantiate it and use it raw. I'm have to use TCP/IP/UDP. Am I correct? In other words once I have a PPP connection the only way to use is to open a socket (UDP or TCP) and talk to the device through it. I can't just create my application level packet and tell PPP to send it, I have to go through TCP/IP layer (transport layer).
| using PPP without TCP/IP |
The IPs are public and obtained with DHCP, based on the interfaces MACs.Which means that when bridged the ppp interface would need to get a third public IP obtained with DHCP. Which won't work with ppp.bridge ppp0Even if ppp0 wouldn't need a public IP, it's a point-to-point connection, as the name implies. So you cannot bridge it.so that the RPi CM3+ accessible from the public IP?The simplest way is to enable forwarding on the Bench PIC, NAT ppp0 on either of the external NICs, and add port forwarding rules. (Google, there's hundreds of tutorials). This would mean some ports on the RPi will be accessible under the given external IP, potentially under different port numbers. And the Rpi can access all of the internet. Which will work if there's a known number of services running on the Rpi which need to be accessed.
If the Rpi has to have a third public IP, add a VPN that's bridgeable on top of the ppp0 connection (which will cause additional overhead), then bridge the resulting tun/tap interface.
|
I have a PC on a test bench with 2 interfaces, enp2s0 and enp3s0. The IPs are public and obtained with DHCP, based on the interfaces MACs. There is a second computer on my bench, a Raspberry Pi Compute Module 3, which I want to expose on the internet. The RPi and bench sever are connect together through PPP, over a serial connection. On both side the ppp interface is called ppp0.
How can I bridge ppp0 and enp3s0, so that the RPi CM3+ accessible from the public IP? I'm lost among linux's many bridge and tunnel options...My organization doesn't allow me to do routing or use switches. Any solution that minimize the chance of me wrecking the rest of the network would be awesome.
| Bridge PPPoS with ethernet |
After a day of debugging it turned out to be an issue with the custom board. One of the pins in the connector turned out to be electrically damaged. So it is not an issue with Fedora or PPP, it is an issue with the hardware connector. Thank you everyone for looking into it.
| Had no problems with ppp. Ran and update and it stopped working.
My setup:
Lenovo T470s with Fedora 28, Linux user-fedora 4.18.13-200.fc28.x86_64 #1 SMP Wed Oct 10 17:29:59 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
custom board with Linux custom-board-0 4.14.0-xilinx-v2018.2 #1 SMP PREEMPT Mon Sep 24 12:55:51 PDT 2018 armv7l armv7l armv7l GNU/Linux Command to run ppp on Fedora 28
sudo pppd -detach local debug noauth passive xonxoff lock dump 192.168.10.100:192.168.10.1 /dev/ttyUSB0 9600`Command to run ppp on custom board
pppd -detach persist debug local noauth passive xonxoff lock dump 192.168.10.1:192.168.10.100 /dev/ttyS0 9600Output of ppp on Fedora after command execution
pppd options in effect:
debug # (from command line)
-detach # (from command line)
dump # (from command line)
noauth # (from command line)
/dev/ttyUSB0 # (from command line)
9600 # (from command line)
lock # (from command line)
xonxoff # (from command line)
local # (from command line)
passive # (from command line)
192.168.10.100:192.168.10.1 # (from command line)
using channel 16
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
LCP: timeout sending Config-RequestsOutput of ppp on custom board after command execution
pppd options in effect:
debug # (from command line)
-detach # (from command line)
persist # (from command line)
dump # (from command line)
noauth # (from command line)
/dev/ttyS0 # (from command line)
9600 # (from command line)
lock # (from command line)
xonxoff # (from command line)
local # (from command line)
passive # (from command line)
192.168.10.1:192.168.10.100 # (from command line)
using channel 11
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS0
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
LCP: timeout sending Config-Requests
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>]
LCP: timeout sending Config-RequestsIt looks like Fedora is sending LCP packets and Custom Board is receiving them, and Custom Board is sending LCP packets but Fedora is not receiving them.
Does anyone know what could be the problem and how to fix it?
| ppp stopped working on Fedora 28 [closed] |
Possibly, your 3G provider gives you a private IP address from one of these ranges10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255In this case, you're behind ISP's NAT and can't access Pi from the internet, but you can access the internet from Pi.
|
I set up an R-Pi 3G Modem combo with wvdial and it's working perfectly. I can access everything on the internet from the Pi. But when I try to access the Pi from the internet there is nothing, zero connection. As far as I can tell there is no firewall so I have no idea what blocks the data. If I connect the Pi to my LAN I can access it through my local network.
| Can't access Rasperberry Pi over the internet |
You asked, "What can I do to "add support" for PPP?".
Really this should be a case of asking your hosting provider. It may be that they won't support PPP because you've rented a VPS and they need to use a generic shared kernel.
You then asked "So if PPP is not a good way to connect.. what should I use?".
PPP is not a routeable protocol. To use PPP across the Internet one typically encapsulates it in either L2TP or PPTP.
If you want to steer away from L2TP/PPTP then you could choose something like OpenVPN or IPSec. Of these two, OpenVPN is (IMO) far easier to set up as a point-to-point link than IPSec.
|
I bought a VPS from hostinger.com. Now I'm trying to set VPN connection to another server using PPP, but I have an error:Sorry - this system lacks PPP kernel supportI tried different versions: Debian 8, 9 and Ubuntu 18.04 (Linux xxx.local 4.15.0) but I always had the same error.
What can I do to "add support" for PPP?
| This system lacks PPP kernel support |
In ubuntu 14 or ubuntu 15, you can use this command :
- first, you activate routing :
sudo echo 1 > /proc/sys/net/ipv4/ip_forward- second, you write a dynamic translation rule source IP address.
sudo iptables -A POSTROUTING -t nat -s address/mask -o internet_interface -j MASQUERADEwhere adress/mask is a address range who don't have the internet access, and then internet_interface is the interface who have the internet access.
Example of this rule :
sudo iptables -A POSTROUTING -t nat -s 192.168.7.0/24 -o ppp0 -j MASQUERADE |
Im using a 3G USB huawei modem to get access to the internet, therefore, i have an active ppp interface addressed.
I want to share this access with my wlan interface so that every device that will get connected to my wifi hotspot will get access to the internet too.
How can i do that?
Thanks
| How to share a ppp internet connection over wlan interface on ubuntu? |
You could use "/etc/ppp/ip-up" to add programs that run once the interface is up. I have work with it several times and it works. You could also use "/etc/ppp/ip-down" in case you need to run programs once the connection is over.
|
We use wvdial to initiate a cell modem connection. We wrap it with nohup, launched by a cron job that checks if all is well every minute (everything we read said that wvdial and the associated hardware is unreliable enough that you want something like the cron job to watchdog it).
When that network comes alive (always seems to show up as ppp0 from ifconfig), we want to do some work, such as run ntpdate and some rsync operations. Is there anyway to configure a service that runs each time there is a new and established ppp0 connection?
| Service that runs once when ppp0 connection shows up |
With the noip option, you are disabling IPCP (IP Control Protocol) negotiation, and thus IPv4 communication. So pppd won't ask for it.
You also don't have the +ipv6 option to enable IPv6CP and IPv6. Apparently your pppd will not try for IPv6 unless specifically asked to.
And if I recall correctly, the side that's initiating the connection should state which network protocols it wants. You've specifically excluded IPv4, and haven't asked for IPv6 nor IPX, so there's apparently nothing left over.
The remote end also seems to be requesting CHAP authentication using the MD5 hash algorithm, but your pppd is rejecting it, probably because there are no applicable CHAP secrets (passwords) configured on your side.
|
I am new to ppp protocol and its configuration and got a problem that ppp connection terminated, no ppp0 created.
This modem(telit lm960a18) works fine with this sim card and APN using network manager in VM. since there is no nmcli nor mmcli in my hardware, but ppp is available, I need to make ppp connection work on this board.
I suspect the reason it terminates is 'No network protocols running', but cannot figure how to resolve it. Any help and directions are appreciated!
here is ppp.log message.
Script /usr/sbin/chat -v -f /etc/ppp/options finished (pid 12658), status = 0x0
Serial connection established.
using channel 3
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x4bca569a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x6 <asyncmap 0x0> <auth chap MD5> <magic 0x13647a80> <pcomp> <accomp>]
No auth is possible
sent [LCP ConfRej id=0x6 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x4bca569a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x7 <asyncmap 0x0> <magic 0x13647a80> <pcomp> <accomp>]
sent [LCP ConfAck id=0x7 <asyncmap 0x0> <magic 0x13647a80> <pcomp> <accomp>]
sent [LCP TermReq id=0x2 "No network protocols running"]
rcvd [LCP DiscReq id=0x8 magic=0x13647a80]
rcvd [LCP TermAck id=0x2]
Connection terminated.options file
# Run in foreground (lets s6 supervisor work)
nodetach
# Uncomment below to emit debug messages
debug
# Set to one failure allowed (no retries)
maxfail 1
# Lock the modem port when establishing PPP
lock
# no auth
noauth
# Log file location
logfile /opt/iprf/tmp/ppp.log
# Connect script
connect /etc/ppp/net-connect-cellVerizon
# No hardware flow control
nocrtscts
# Disable compression control protocol
noccp
# Disable IPCP negotiations
noip
# Modem port name
/dev/ttyUSB2
# Modem port baud rate
115200/etc/ppp/net-connect-cellVerizon file
#!/bin/sh
/usr/sbin/chat -v -t 60 -f /etc/ppp/net-chat-cellVerizon/etc/ppp/net-chat-cellVerizon file
TIMEOUT 5
ABORT 'ERROR'
''
'AT'
OK
'AT+CGDCONT=1,"IP","so01.vzwstatic"'
OK
'ATD*99***1#'
CONNECT '' | ppp connection terminated: "No network protocols running" |
You can use anything which is supported in the /etc/shadow file. The string given in the preseed file is just put into /etc/shadow. To create a salted password to make it more difficult just use mkpasswd with the salt option (-S):
mkpasswd -m sha-512 -S $(pwgen -ns 16 1) mypassword
$6$bLyz7jpb8S8gOpkV$FkQSm9YZt6SaMQM7LPhjJw6DFF7uXW.3HDQO.H/HxB83AnFuOCBRhgCK9EkdjtG0AWduRcnc0fI/39BjmL8Ee1In the command above the salt is generated by pwgen.
|
When it comes to passwd/user-password-crypted statement in a preseed file, most examples use an MD5 hash. Example:# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password [MD5 hash]From Debian's Appendix B. Automating the installation using preseeding.
A few sources show that it's also possible to use SHA-512:Try using a hashed password like this:
$ mkpasswd -m sha-512[...]
And then in your preseed file:
d-i passwd/user-password-crypted password $6$ONf5M3F1u$bpljc9f1SPy1w4J2br[...]From Can't automate user creation with preseeding on AskUbuntu.
This is slightly better than MD5, but still doesn't resist well against brute force and rainbow tables.
What other algorithms can I use? For instance, is PBKDF2 supported, or am I limited by the algorithms used in /etc/shadow, that is MD5, Blowfish, SHA-256 and SHA-512?
| What hash algorithms can I use in preseed's passwd/user-password-crypted entry? |
Short answer
From the Debian wiki page dedicated to D-I preseed :Do not work off a debconf-get-selections (--installer) generated preseed.cfg but get the values from it and modify the example preseed file with them. The preseed example file provided by Debian should be enought to start but you can find a lot of other preseed files provided by different people for different purposes on the same wiki page.
Less short answer
In the list of debconf questions you posted, each question with a comment "for internal use" without "can be preseeded" should not be preseeded.
But a lot of other debconf questions may not be pre-answered with a preseed file, like the hardware-related questions (if you want to run the installation on a different hardware), the questions recording some automatic configuration failure or success (which can be preseeded in some special cases but could without problem be answered with the automatic process).
The output of debconf-get-selections contains a lot of auto-answered questions most people never see and do (should) not care about. This automatic choices are changing over time, with new hardware, software, better detection or new possibilities. It is important to touch the least you can of the automatic configuration, to benefit from all the improvements of the debian-installer and to be able to keep to a minimum the changes needed to your preseed file over time and for different hardware.
|
I want to replicate the Debian installation choices made for my system's current configuration in the installation of a new system.
Debian can be pre-configured through a "pre-configuration" (aka "preseed") file, which basically contains the answers to the questions the installer will ask.
The documentation states that one way to create a preconfiguration file from an existing installation of Debian is to:...use the debconf-get-selections from the debconf-utils package to dump both the debconf database and the installer's cdebconf database to a single file:
$ debconf-get-selections --installer > file
$ debconf-get-selections >> fileBut it then immediately adds:However, a file generated in this manner will have some items that should not be preseeded...The documentation does not elaborate on what those items-that-should-not-be-preseeded would be.
Could someone elaborate?By way of illustration, below I include the second field of the output I get from the two commands above, where I've kept only the lines that begin with d-i, along with the comments, sometimes truncated for brevity. (The reason for keeping only the configuration lines that begin with d-i is that in the example pre-configuration file provided by Debian, only such lines appear.)
# Check the integrity of another CD-ROM?
cdrom-checker/nextcd# Web server started, but network not running
save-logs/no_network# for internal use only
debian-installer/consoledisplaydebian-installer/shell-plugin# Country, territory or area:
# Choices: Antigua and Barbuda, Australia, Botswana, Canada, ...
localechooser/shortlist# for internal use; can be preseeded
preseed/include_command# Country of origin for the keyboard:
# Choices:
keyboard-configuration/layout# Choices: Canada, Mexico, Saint Pierre and Miquelon, United ...
localechooser/countrylist/North_America# Choices: Greece, Cyprus, other
localechooser/shortlist/el# Keyboard layout:
# Choices:
keyboard-configuration/variant# Choices: Algeria, Angola, Benin, Botswana, Burkina Faso, Bu...
localechooser/countrylist/Africa# Choices: Finland, Sweden, other
localechooser/shortlist/sv# Keep default keyboard options ()?
keyboard-configuration/unsupported_options# Choices: Cyprus, Turkey, other
localechooser/shortlist/tr# Interactive shell
di-utils-shell/do-shell# for internal use only
# Choices: stable, testing, unstable
cdrom/suite# Choose an installation step:
# Choices:
debian-installer/missing-provide# Check CD-ROM integrity?
cdrom-checker/start# Failed to retrieve the preconfiguration file
preseed/retrieve_error# Directory in which to save debug logs:
save-logs/directory# for internal use only
debconf/showold# Failed to open checksum file
cdrom-checker/md5file_failed# Choices: Andorra, Spain, France, Italy, other
localechooser/shortlist/ca# Write the changes to the storage devices and configure RAID...
partman-md/confirm_nooverwrite# PCMCIA resource range options:
hw-detect/pcmcia_resources# Failed to mount the floppy
save-logs/floppy_mount_failed# for internal use only
debconf/language# Choices: China, Singapore, Taiwan, Hong Kong, other
localechooser/shortlist/zh_TW# Dummy template for preseeding unavailable questions
debian-installer/dummy# Additional parameters for module :
hw-detect/retry_params# Incorrect CD-ROM detected
cdrom-detect/wrong-cd# for internal use; can be preseeded
cdrom-detect/eject# Choices: Argentina, Bolivia, Chile, Colombia, Costa Rica, E...
localechooser/shortlist/es# for internal use; can be preseeded
preseed/run# Write the changes to disks and configure LVM?
partman-lvm/confirm_nooverwrite# Cannot save logs
save-logs/bad_directory# Choices: Belgium, Canada, France, Luxembourg, Switzerland, ...
localechooser/shortlist/fr# Insufficient memory
lowmem/insufficient# for internal use
keyboard-configuration/optionscode# Choices: China, Taiwan, Singapore, Hong Kong, other
localechooser/shortlist/zh_CN# Load missing firmware from removable media?
hw-detect/load_firmware# Choices: Italy, Switzerland, other
localechooser/shortlist/it# Choices: Antarctica
localechooser/countrylist/Antarctica# Choose the next step in the install process:
# Choices: Choose language, Configure the speech synthesizer ...
debian-installer/main-menu# Failed to load installer component
anna/install_failed# Choices: Russian Federation, Ukraine, other
localechooser/shortlist/ru# for internal use
keyboard-configuration/modelcode# Entering low memory mode
lowmem/low# Choices: Jordan, United Arab Emirates, Bahrain, Algeria, Sy...
localechooser/shortlist/ar# Keep current keyboard options in the configuration file?
keyboard-configuration/unsupported_config_options# Choices: Antigua and Barbuda, Australia, Botswana, Canada, ...
localechooser/shortlist/en# Method for toggling between national and Latin mode:
# Choices: Caps Lock, Right Alt (AltGr), Right Control, Right...
keyboard-configuration/toggle# for internal use only
anna/retriever# Choices: Curaçao
localechooser/countrylist/other# Choices: Albania, Andorra, Armenia, Austria, Azerbaijan, Be...
localechooser/countrylist/Europe# locale
localechooser/help/locale# Load CD-ROM drivers from removable media?
cdrom-detect/load_media# for internal use; can be preseeded
debian-installer/framebuffer# for internal use
espeakup/voice# for internal use; can be preseeded
preseed/include# Error reading Release file
cdrom-detect/no-release# Ignore questions with a priority less than:
# Choices: critical, high, medium, low
debconf/priority# Key to function as AltGr:
# Choices: The default for the keyboard layout, No AltGr key,...
keyboard-configuration/altgr# CD-ROM detected
cdrom-detect/success# Choices: Bouvet Island, Falkland Islands (Malvinas), Saint ...
localechooser/countrylist/Atlantic_Ocean# Continue the install without loading kernel modules?
anna/no_kernel_modules# for internal use; can be preseeded
debian-installer/exit/poweroff# Choices: Bangladesh, India, other
localechooser/shortlist/bn# for internal use; can be preseeded
preseed/include/checksum# Integrity test failed
cdrom-checker/mismatch# Load missing drivers from removable media?
hw-detect/load_media# Keep default keyboard layout ()?
keyboard-configuration/unsupported_layout# Start PC card services?
hw-detect/start_pcmcia# for internal use; can be preseeded
debian-installer/add-kernel-opts# for internal use; can be preseeded
mouse/protocol# for internal use; can be preseeded
mouse/left# for internal use
keyboard-configuration/layoutcode# for internal use
keyboard-configuration/store_defaults_in_debconf_db# Choices: Brazil, Portugal, other
localechooser/shortlist/pt# for internal use; can be preseeded
preseed/early_command# for internal use only
debian-installer/exit/always_halt# Choices: Africa, Antarctica, Asia, Atlantic Ocean, Caribbea...
localechooser/continentlist# Insert Debian boot CD-ROM
cdrom-checker/firstcd# How should the debug logs be saved or transferred?
# Choices: floppy, web, mounted file system
save-logs/menu# for internal use; can be preseeded
rescue/enable# for internal use only
cdrom-detect/cdrom_fs# Insert formatted floppy in drive
save-logs/insert_floppy# Translations temporarily not available
localechooser/translation/none-yet# Keymap to use:
# Choices: American English, Albanian, Arabic, Asturian, Bang...
keyboard-configuration/xkb-keymap# for internal use; can be preseeded
mouse/device# for internal use only
cdrom-detect/hybrid# for internal use only
debconf/translations-dropped# Country to base default locale settings on:
# Choices: Antigua and Barbuda${!TAB}-${!TAB}en_AG, Australia...
localechooser/preferred-locale# Choices: Spain, France, other
localechooser/shortlist/eu# Choices: Argentina, Bolivia, Brazil, Chile, Colombia, Ecuad...
localechooser/countrylist/South_America# Failed to mount CD-ROM
cdrom-checker/mntfailed# Retry mounting the CD-ROM?
cdrom-detect/retry# Choices: Serbia, Montenegro, other
localechooser/shortlist/sr# Module needed for accessing the CD-ROM:
# Choices:
cdrom-detect/cdrom_module# for internal use; can be preseeded
preseed/file# for internal use; can be preseeded
hw-detect/load-ide# for internal use; can be preseeded
preseed/interactive# Installation step failed
debian-installer/main-menu/item-failure# Error while running ''
hw-detect/modprobe_error# Choices: Pakistan, India, other
localechooser/shortlist/pa# Use Control+Alt+Backspace to terminate the X server?
keyboard-configuration/ctrl_alt_bksp# Choices: China, India, other
localechooser/shortlist/bo# Language:
# Choices: C${!TAB}-${!TAB}No localization, Albanian${!TAB}-$...
localechooser/languagelist# Installer components to load:
# Choices:
anna/choose_modules_lowmem# for internal use only
debian-installer/language# for internal use
keyboard-configuration/variantcode# Choices: Anguilla, Antigua and Barbuda, Aruba, Bahamas, Bar...
localechooser/countrylist/Caribbean# Language selection no longer possible
localechooser/translation/no-select# Failed to copy file from CD-ROM. Retry?
retriever/cdrom/error# Choices: Afghanistan, Bahrain, Bangladesh, Bhutan, Brunei D...
localechooser/countrylist/Asia# Write the changes to disk and configure encrypted volumes?
partman-crypto/confirm_nooverwrite# for internal use; can be preseeded
debian-installer/country# No valid Debian CD-ROM
cdrom-checker/wrongcd# Choices: Belgium, Germany, Liechtenstein, Luxembourg, Austr...
localechooser/shortlist/de# for internal use; can be preseeded
anna/standard_modules# Failed to process the preconfiguration file
preseed/load_error# for internal use; can be preseeded
preseed/file/checksum# Device file for accessing the CD-ROM:
cdrom-detect/cdrom_device# for internal use; can be preseeded
directfb/hw-accel# for internal use; can be preseeded
debian-installer/allow_unauthenticated# Continue the installation in the selected language?
localechooser/translation/warn-severe# for internal use; can be preseeded
debian-installer/theme# Choices: American Samoa, Australia, Cook Islands, Fiji, Fre...
localechooser/countrylist/Oceania# Are you sure you want to exit now?
di-utils-reboot/really_reboot# Choices: Brazil, Portugal, other
localechooser/shortlist/pt_BR# for internal use only
debconf/frontend# for internal use; can be preseeded
debian-installer/exit/halt# Choices: Belize, Costa Rica, El Salvador, Guatemala, Hondur...
localechooser/countrylist/Central_America# Keep the current keyboard layout in the configuration file?
keyboard-configuration/unsupported_config_layout# Compose key:
# Choices: No compose key, Right Alt (AltGr), Right Control, ...
keyboard-configuration/compose# Method for temporarily toggling between national and Latin ...
# Choices: No temporary switch, Both Logo keys, Right Alt (Al...
keyboard-configuration/switch# Installer components to load:
# Choices: cfdisk-udeb: Manually partition a hard drive (cfdi...
anna/choose_modules# Integrity test successful
cdrom-checker/passed# Manually select a CD-ROM module and device?
cdrom-detect/manual_config# Terminal plugin not available
debian-installer/terminal-plugin-unavailable# Insert a Debian CD-ROM
cdrom-checker/askmount# Additional locales:
# Choices: aa_DJ.UTF-8, aa_DJ, aa_ER, aa_ER@saaho, aa_ET, af_...
localechooser/supported-locales# for internal use only
cdrom-detect/usb-hdd# for internal use; can be preseeded
preseed/late_command# Failed to run preseeded command
preseed/command_failed# Modules to load:
# Choices:
hw-detect/select_modules# Keyboard model:
# Choices:
keyboard-configuration/model# Continue the installation in the selected language?
localechooser/translation/warn-light# Choices: Aruba, Belgium, Netherlands, other
localechooser/shortlist/nl# for internal use only
cdrom/codename# Choices: British Indian Ocean Territory, Christmas Island, ...
localechooser/countrylist/Indian_Ocean# for internal use; can be preseeded
preseed/boot_command# Web server started
save-logs/httpd_running# System locale:
# Choices:
debian-installer/locale# Choices: Macedonia\, Republic of, Albania, other
localechooser/shortlist/sq# Country of origin for the keyboard:
# Choices:
keyboard-configuration/layout# Keymap to use:
# Choices: American English, Albanian, Arabic, Asturian, Bang...
keyboard-configuration/xkb-keymap# Keyboard layout:
# Choices: English (US), English (US) - Cherokee, English (US...
keyboard-configuration/variant# Keep default keyboard options ()?
keyboard-configuration/unsupported_options# Use Control+Alt+Backspace to terminate the X server?
keyboard-configuration/ctrl_alt_bksp# for internal use
keyboard-configuration/variantcode# for internal use
keyboard-configuration/optionscode# for internal use
keyboard-configuration/modelcode# Keep current keyboard options in the configuration file?
keyboard-configuration/unsupported_config_options# Keep the current keyboard layout in the configuration file?
keyboard-configuration/unsupported_config_layout# Method for toggling between national and Latin mode:
# Choices: Caps Lock, Right Alt (AltGr), Right Control, Right...
keyboard-configuration/toggle# Compose key:
# Choices: No compose key, Right Alt (AltGr), Right Control, ...
keyboard-configuration/compose# Method for temporarily toggling between national and Latin ...
# Choices: No temporary switch, Both Logo keys, Right Alt (Al...
keyboard-configuration/switch# Key to function as AltGr:
# Choices: The default for the keyboard layout, No AltGr key,...
keyboard-configuration/altgr# Keep default keyboard layout ()?
keyboard-configuration/unsupported_layout# Keyboard model:
# Choices: A4Tech KB-21, A4Tech KBS-8, A4Tech Wireless Deskto...
keyboard-configuration/model# for internal use
keyboard-configuration/layoutcode# for internal use
keyboard-configuration/store_defaults_in_debconf_db | What values from debconf-get-selections should not be preseeded? |
I figured this out after spending days scouring the internet for any shred of information about partman - it is not very well-documented at all. Here's the config I used:
# This automatically creates a standard unencrypted partitioning scheme.
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select unencrypted-install
d-i partman-auto/expert_recipe string \
unencrypted-install :: \
1024 1024 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
2048 2048 2048 linux-swap \
$primary{ } \
method{ swap } format{ } \
. \
17408 100000000000 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean trueJust drop that in your preseed and you should be good to go. Line by line:Use disk /dev/sda
Do a regular install (not encrypted or LVM)
Remove any existing LVM without prompting
Remove any existing RAID setup without prompting
Confirm that this is what you want
Confirm again
Select the "unencrypted-install" recipe, which is specified below
This is a single logical line that specifies the entire recipe, one partition at a time. It creates the partition table exactly as I specified in the question.
Confirm again
Allow partman to write new labels
Finish the process
Confirm again
Confirm againAnd there you go, works perfect.
|
I want to automatically partition all of my workstations in the same way:First partition is a bootable 1GB ext4 /boot partition
Second partition is a 2GB swap partition
Third partition is an ext4 / partition that takes up whatever is left
All partitions should be formattedI think adding this to my preseed.cfg will accomplish what I want:
d-i partman-auto/workstation_recipe string \
root :: \
1024 1023 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
2048 2047 2048 linux-swap \
$primary{ } \
method{ swap } format{ } \
. \
17408 100000000000 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.This is based on this blog. Will this do what I want, and is there anything else I need to add to my preseed.cfg to make it accept these instructions without user intervention? I have never used partman recipes before.
| Using d-i partman recipe strings? |
For it not to scan your DVD/netinst image, add these directives to your preseeding configuration:
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false |
Please see the image below, is there a preseed directive to skip this Debian9 installer step?
Currently I use the following config relevant to the package manager:
### Apt setup
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/local0/source boolean true### Package selection
tasksel tasksel/first multiselect standard### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string httpredir.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string | Preseed directive to skip another CD/DVD scanning |
Doing what py4on suggested does simply shorten the list of available languages (to the extend of having one single element: en), but does not automate the language selection. It was probably working on older versions of Ubuntu but the requirement is for the Ubuntu Server 14.04. On 16.04 the instructions below may change to isolinux and isolinux.cfg instead of syslinux depending how you create the media.
In order to avoid this intervention at the language selection menu, the option timeout of syslinux should be set to a strictly positive value. After the specified timeout, the default language will be selected and the default booting entry of syslinux will be selected. The timeout parameter of syslinux represents a time in deci-seconds, and the default value is 0, corresponding to an "infinite timeout".
Therefore, one could set timeout 10 to make syslinux wait 1 second before proceeding with the default value. The best place to put the parameter is in syslinux/syslinux.cfg. For example:
echo "timeout 10" >> syslinux/syslinux.cfgIn order to have a different language than en, I would suggest to proceed as py4on suggested by leaving only the chosen language in the syslinux/langlist file. For example:
echo "fr" > syslinux/langlistReferences:http://www.syslinux.org/wiki/index.php/SYSLINUX |
I would like to make a completely unattended installation of Ubuntu Server 14.04 from an USB drive where I extracted the ubuntu-14.04.2-server.iso
In /syslinux/txt.cfg of the USB drive, I added the following section
menu label ^Unattended Ubuntu Server installation
kernel /install/vmlinuz
append noprompt cdrom-detect/try-usb=true auto=true priority=critical url=http://website.com/preseed.cfg vga=788 initrd=/install/initrd.gz quiet --But when I tried it, even before this menu shows up, I have to select a language (and therefore force me to have a manual intervention by pressing enter).
I found a similar question where it suggests to echo en >syslinux/langlist but I still get the language selection menu (with only one item).
How can I avoid this intervention ?
| Prevent Language selection at ubuntu installation |
The first thing that I would change is the number of spaces between "string" and "recipe_sps".
According to this at 12.3.2.2: "the fourth and last field contains the value for the answer. Note that it must be separated from the third field with a single space; if there are more than one, the following space characters are considered part of the value."
If you luckily end up with a bootable system at this stage (thus with the failing recipe), check if /var/log/installer/cdebconf/questions.dat contains your recipe and whether it was chosen (probably not).
Added: Check your /var/log/installer/syslog for partman messages, mine was pretty clear: "partman-auto: Available disk space (8589) too small for expert recipe (67595); skipping"
|
I created a preseed script with help from this blog and I altered it to create some logical volumes on it too.
The result of the script is this:
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
d-i debian-installer/language string en
d-i debain-installer/country string US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i netcfg/choose_interface select auto
#d-i netcfg/choose_interface select eth0
d-i netcfg/get_nameservers string
d-i netcfg/get_ipaddress string
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string myhost
d-i mirror/country string manual
d-i mirror/http/hostname string http.nl.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i partman-auto/disk string /dev/sda /dev/sdb
d-i partman-auto/method string raid
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto/choose_recipe select recipe_sps
d-i partman-auto-lvm/new_vg_name string vg_sps
#d-i partman-auto-lvm/guided_size string 30GB
d-i partman-auto/expert_recipe string \
recipe_sps :: \
512 30 512 raid \
$lvmignore{ } \
$primary{ } method{ raid } \
. \
1000 35 250000000 raid \
$lvmignore{ } \
$primary{ } method{ raid } \
. \
5500 50 6000 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
. \
4000 50 4100 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ home } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /home } \
. \
4000 50 4100 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ varlog } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /var/log } \
. \
60000000 50 250000000 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ varvirtualbox } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /var/virtualbox } \
. # Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
# <devices> <sparedevices>d-i partman-auto-raid/recipe string \
1 2 0 ext2 /boot \
/dev/sda1#/dev/sdb1 \
. \
1 2 0 lvm - \
/dev/sda2#/dev/sdb2 \
.
d-i mdadm/boot_degraded boolean false
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman/confirm_nooverwrite boolean true
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i time/zone string Europe/Amsterdam
d-i base-installer/kernel/image string linux-server
d-i passwd/root-login boolean true
d-i passwd/root-password password r00tme
d-i passwd/root-password-again password r00tme
d-i passwd/make-user boolean false
d-i user-setup/allow-password-weak boolean false
d-i user-setup/encrypt-home boolean false
d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i debian-installer/allow_unauthenticated string false
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/language-packs multiselect
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
tasksel tasksel/first multiselect standard, openssh-serverd-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean false
d-i grub-installer/bootdev string /dev/sda /dev/sdbd-i finish-install/keep-consoles boolean false
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false
d-i pkgsel/include string vim openssh-server openvpn
popularity-contest popularity-contest/participate boolean falseNow I used the script, but when it's finished (without errors) there is only the boot, root and swap partitions:
root@debian:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/dm-0 112G 854M 106G 1% /
udev 10M 0 10M 0% /dev
tmpfs 3.2G 8.6M 3.2G 1% /run
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/md0 472M 34M 414M 8% /bootroot@debian:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vg_sps -wi-ao---- 113.85g
swap_1 vg_sps -wi-ao---- 4.85g But in my expert-recipe I meant to create a /home /var/log and /var/virtualbox volume too.
| Debian preseed doesn't create lvm's, but are in the expert recipe |
Instead of going to the Internet, you could go to a local debian repository.
This link explains how to setup a debian repository.
You would then have to find how to set your netboot image to get the packages from your local repository. I do not know how to do that, but a liar DNS server could be a solution.
|
I'm currently working on PXE booting 10 or so machines to install Debian on them over the network from a centralized DHCP + TFTP server. I'm using the TFTP server to serve the Debian netboot image to the PXE clients. I'm also serving them a preseeding file via FTP.
So far (after hours of Google, trial and error) so good. The thing is, while reading the preseeding file, the hosts seem to be trying to fetch packages over the Internet; which is quite logical since the netboot image is only 8-9 MB in size.
The problem with that is that the Internet connection in that environment is currently unreliable so I was wondering if there's a way I can direct the hosts (via the preseed file or a kernel boot parameter) to clone my existent Debian system (i.e. the one on the DHCP/TFTP server). I would appreciate any help and I'm willing to share further information about my setup if you think they'd be helpful to you either to help you set up a similar environment or to help you suggest a solution to me :)
| Debian PXE Preseeding: Can I clone my existing Debian system instead of using the Internet? |
The d-i preseed/late_command string commands in preseed.cfg do what you want. I added a custom sources.list file to the iso and then copy that over after the installation completes. Add these commands at the end of your preseed.cfg.
d-i preseed/late_command string \
cp sources.list /target/etc/apt/sources.list; \
in-target apt-get update; \
in-target apt-get install -y git;The last two commands demonstrate updating the list of packages and installing a package that isn't included on the cd (git).
Here's how I built the iso image with the new preseed.cfg and the new sources.list:
#!/usr/bin/env bash# Install dependencies
# sudo apt install isolinux syslinux-utils xorrisocd ~
mkdir iso
xorriso -osirrox on -indev debian-10.2.0-amd64-netinst.iso -extract / iso/chmod +w -R iso/install.amd/
gunzip iso/install.amd/initrd.gz
echo preseed.cfg | cpio -H newc -o -A -F iso/install.amd/initrd
echo sources.list | cpio -H newc -o -A -F iso/install.amd/initrd
gzip iso/install.amd/initrd
chmod -w -R iso/install.amd/cd iso/
chmod +w md5sum.txt
md5sum `find -follow -type f` > md5sum.txt
cd ..xorriso -as mkisofs -o preseed.iso -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table isoThis script assumes that you're working with Debian 10 stable ("buster") amd64, and that preseed.cfg and sources.list files are in the home directory of whatever system you're using to build the iso.
|
I'm building a custom ISO image of Debian 10 stable ("buster") using preseeding, and my custom preseed.cfg file works perfectly except for one thing: I'd like it to configure /etc/apt/sources.list with my chosen repositories so that I don't have to do it manually every time I install a new system.
The goal is an /etc/apt/sources.list that looks like this (https is a necessity here):
deb https://deb.debian.org/debian buster main contrib non-free
deb-src https://deb.debian.org/debian buster main contrib non-freedeb https://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb-src https://deb.debian.org/debian-security/ buster/updates main contrib non-freedeb https://deb.debian.org/debian buster-updates main contrib non-free
deb-src https://deb.debian.org/debian buster-updates main contrib non-freeMy preseed.cfg file looks like this:
#### Contents of the preconfiguration file (for buster)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select us
# d-i keyboard-configuration/toggle select No toggling### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/hostname string vienna1-preseedd-i netcfg/wireless_wep string### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string### Account setup
d-i passwd/root-login boolean false# To create a normal user account.
d-i passwd/user-fullname string theusername
d-i passwd/username string theusername
d-i passwd/user-password-crypted password $6$qVk198UWGPxpW$tzMYxQyiOrI4ClDJdDGALsyYq1j1IbXWbpem3JevFT9Krqdmt4wKdvtiY8ry3PRh277V6GHzSKP3zSI7jt04Y/### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string US/Easternd-i clock-setup/ntp boolean true### Partitioning
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomicd-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean trued-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true# https://serverfault.com/a/622818
d-i apt-setup/use_mirror boolean false
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false### Base system installation
# Configure APT to not install recommended packages by default. Use of this
# option can result in an incomplete system and should only be used by very
# experienced users.
#d-i base-installer/install-recommends boolean false### Apt setup
# You can choose to install non-free and contrib software.
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true### Package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/upgrade select full-upgrade
popularity-contest popularity-contest/participate boolean false### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string defaultd-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true | How do I set mirrors in /etc/apt/sources.list with a Debian preseed file? |
There are scripts here: https://github.com/dotzero/vagrant-debian-wheezy-64 to take a netinst iso and remaster it with preseed options. This could be a good starting point.
There is a latecmd option in the preseed that will let you run a command just before the installation finishes. If the latecmd can't do everything in the chroot environment, you can use the latecmd to insert a script that will be called at the next boot.
|
I tried to create a custom distribution based on debian, after reading debian document, I found preseed file that can generate debian with preconfigured parameters. But this is not enough for me, because I need to add some packages with their dependencies in the generated iso file, and I need to script execution after installation of my custom debian, this script can compile and install my software with a shell script.
How to do it?
| Make custom iso debian file |
Working with wired connections
By default, NetworkManager generates a connection profile for each wired ethernet connection it finds. At the point when generating the connection, it does not know whether there will be more ethernet adapters available. Hence, it calls the first wired connection "Wired connection 1". You can avoid generating this connection, by configuring no-auto-default (see man NetworkManager.conf), or by simply deleting it. Then NetworkManager will remember not to generate a connection for this interface again.
You can also edit the connection (and persist it to disk) or delete it. NetworkManager will not re-generate a new connection. Then you can change the name to whatever you want. You can use something like nm-connection-editor for this task.
So, you can create NetworkManager.conf before installing network manager and set it up according to your hardware and with no-auto-default option if needed. (also check that the config file is not overwritten after the install 'should not be the case...')
An other alternative could be locking the write access to the problematic file with chmod u-w or chattr +i but this is not recommended because its not intended to work that way and may introduce other issues.
Source: arch-wiki
|
I'm currently in the progress of preseeding a Debian installation with custom setup scripts running after the actual installation to create a simple installer that will create everything that I need.
Now I found how to install additional packages and added the NetworkManager package, to simplify networking stuff. However the device has multiple ethernet interfaces and installing NetworkManager during the Debian installation creates the file /etc/NetworkManager/system-connections/Wired connection 1. However that file is configured incorrectly for the actual system. So if I remove it while NetworkManager is off and reboot, everything is working just fine. But having the file makes NetworkManager label all interfaces as "Wired connection 1" and only one interface can be active, etc. All in all, that file needs to go.
Now I first tried just removing the file during the script I invoke wiht preseed/late_command (the script runs and removes the file, I checked that). But upon booting into the system after the installation the file is back. Next I tried stopping the NetworkManager service before removing the file with in-target systemctl stop NetworkManager, but that just gives me the lovely log line in-target: Running in chroot, ignoring request. And naturally that also doesn't work.
How I can install NetworkManager during preseeding with a blank "system-connections" configuration?
In summary the relevant (and working) lines from my preseed.cfg are:
d-i pkgsel/include string ... network-manager ...
d-i preseed/late_command string sh /.../postinstall.shand in my postinstall.sh I tried
in-target rm /etc/NetworkManager/system-connections/*(which actually removes the file in that moment) and
in-target systemctl stop NetworkManager
in-target rm /etc/NetworkManager/system-connections/*Update:
As suggested I tried removing the connection with nmcli directly.
This is my script:
in-target nmcli con delete $(in-target nmcli -g uuid con)And this is the result:
May 6 09:16:43 log-output: + in-target
May 6 09:16:43 log-output: nmcli -g uuid con
May 6 09:16:43 log-output: dpkg-divert: warning: diverting file '/sbin/start-stop-daemon' from an Essential package with rename is dangerous, use --no-rename
May 6 09:16:43 in-target: Error: Could not create NMClient object: Could not connect: No such file or directory.
May 6 09:16:44 log-output: + in-target nmcli con delete
May 6 09:16:44 log-output: dpkg-divert: warning: diverting file '/sbin/start-stop-daemon' from an Essential package with rename is dangerous, use --no-rename
May 6 09:16:44 in-target: Error: Could not create NMClient object: Could not connect: No such file or directory. | Issues with installing NetworkManager during Debian installation with preseeding |
Finally found an answer via some Ubuntu docs. It disables the dialogue asking whether the installer should attempt to (sort of) automatically detect your keyboard code by making you press a few random keys.
|
I can't find anything on ask_detect in any of the man pages for setupcon and almost all my search results are examples of preseed files with it set to false; nothing useful at all.
What does it actually do?
| What does `console-setup/ask_detect` in a preseed config do? |
I did found a workaround, I had to duplicate the efi partition.
I don't know why but it does work so that suits me.
Maybe there is a ticket to open at debian or somewhere else...
|
The EFI partition is formatted in ext4 during the setup of debian whereas it should be vfat.
I am trying to preseed the install of debian jessie and I can't get it working since the UEFI partition is formatted in ext4 (got information with blkid). I can't get it formatted in vfat.
My preseed for partitionning is the following:
d-i partman-auto/expert_recipe string \
boot-root :: \
1 1 1 free \
$gptonly{ } \
$primary{ } \
$bios_boot{ } \
method{ biosgrub } \
. \
512 100 512 vfat \
$gptonly{ } \
$primary{ } \
method{ efi } \
format{ } \
$lvmignore{ } \
mountpoint{ /boot/efi } \
. \
...
.And I get the following error:
"Failed to mount vfat filesystem on /boot/efi"
(error message translated from FR, sry)Of course, its an ext4 fs...!Could anybody help?
| Preseeding debian install - EFI |
Silly me, the answer was right there in the Debian forums if I knew where to look.
It was as you guessed, Guardian, to do with the initrd. The thing is, the DVD image initrd contains more modules than the netboot one. The pertinent ones here being SATA drivers. So I followed the advice in the 9th post in that thread and it worked like a charm.
I'm quoting the solution here in its entirety in case the link goes dead:I was trying to get this exact setup and I've been tearing my hair out, turns out the solution is quite simple:
The initrd for the netboot image does not contain any ide or sata drivers and they are meant to be retrieved during a regular install, I'm not sure exactly whether they are just not present on the DVD or the installer does not detect or expect them if you are using a mirror of the DVD ( or any install cd ). However there is a solution and that is to make your own initrd.gz with the drivers present.
I've adapted here from
http://wiki.openvz.org/Modifying_initrd_image
http://ubuntuforums.org/archive/index.php/t-423963.html
First I got the initrd.gz for the netboot and off the netboot install cd, but I think the DVD initrd.gz should be fine then:
mkdir netboot-initrd-dir
mkdir cd-initrd-dir
gunzip netboot-initrd
gunzip cd-initrd
cd netboot-initrd-dir
cpio -i < ../netboot-initrd
cd ../cd-initrd-dir
cpio -i < ../cd-initrd
Now you will have two directories with the contents of both inird.gz files, you can see what driver files are in each one by:
find ./netboot-initrd-dir -iname *.ko
find ./cd-initrd-dir -iname *.ko
you should notice that there is a lot more from the one on the cd, in particular the ide and sata drivers. You can probably be more precise with this is you need to have a smaller image, but I managed to get away with:
cp -nr cd-initrd-dir/lib/modules/2.6.32-5-486/kernel/* netboot-initrd->dir/lib/modules/2.6.32-5-486/kernel/
now you just have to put it back together with:
cd netboot-initrd-dir
find . | cpio -H newc -o > ../new-netboot-initrd
cd ../
gzip ./new-netboot-initrd
Now you should be able to take that file and stick it in your tftp directory under initrd.gz or similar and it will now detect your disks!
Hope that helps you out.
maynim |
As a follow up to this question, I am trying to fully automate the Debian (squeeze) installation procedure. I have so far managed to mount an ISO image of the main Debian DVD and serve it over FTP to the client. The thing is, the client freezes while trying to detect hard drives. After a certain timeout interval, it presents me with a (blank) list of the partitions it detected and gives me the choice to either edit the partitions or continue. Both choices of course fail since no partitions are ever detected.
To try and debug, I booted the host from the Debian DVD itself and opted for an Expert Install with low debconf priority. One of the steps done during that install seems to be the magical one: it's called "Download Installation components from CD". This seems to retrieve many more modules than my preseeded attempt does, eventually leading to a successful disk detection. In particular, it seems that this step scans the "pool" directory of the Debian mirror that's on the DVD, which the preseeding does not.
I have already tried walking through the whole installation manually and retrieving the d-i selections with
debconf-get-selections --installer > installer_sels.txtbut nothing I found there was particularly helpful.
The messages in VT 4 (/var/log/syslog) are not much help either because in both cases (the actual DVD and the FTP ISO mount) the messages and complaints about missing modules are the same.
What am I missing here? Is there something I can add to the preseeding file to let it load additional modules from the DVD? Any advice from someone who's tried this before?
Relevant lines from my preseeding file:
d-i mirror/protocol string ftp
d-i mirror/ftp/hostname <FTP server IP>
d-i mirror/ftp/directory /<FTP dir>/debianEDIT: Additional DetailsI followed this HowTo
I'm serving the Debian squeeze DVD over FTP. I did the following to make an ISO image of it:
dd if=/dev/cdrom of=/path/to/debian_amd64.iso
I'm booting from the amd64 netboot/netboot.tar.gz image.
My boot parameters are... linux26
append ... auto=true priority=critical preseed/url=ftp://path to preseed
I added the linux26 deliberately to overcome the old kernel issue based on an answer I read somewhere else (can't remember where at the moment).
| Preseeding Debian Install From Local Mirror: No Disks Detected |
So after some research (to the 4th,5th page of google searches!) I read (and I'm also pretty sure it's true) that partman/preseed will calculate total size as sum of the size of all the partitions, it doesn't matter if there are LV partitions which are part of a VG.
If I add the maximum size numbers, indeed, I am getting ~147000 MB. So, what I did to solve this issue? Well, for starters I decreased the minimum size of the partitions in the preseed file to 1/4 or 1/2 of the maximum size, then set all the priorities higher or equal to the maximum size (you can find here and here some additional information regarding this)
This allowed partman/preseed to create all the partitions succesfully, even though they weren't the right size.
In order to achieve the right size I added a late_command script which resized all the logical volumes to their correct size.
Also, to keep all the free space that would remain if partitioning were to be done manually, I created dummy partitions which I later deleted in the same late_command script.
I know it's unorthodox but it's the only way to work with preseed/partman.
Here is also the partitioning recipe:
d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string rootvg
d-i partman-auto-lvm/guided_size string 34%
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string infravg
d-i partman-auto-lvm/guided_size string 60%
d-i partman-auto/choose_recipe select diod
d-i partman-auto/expert_recipe diod :: \
511 512 512 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
device{ /dev/sda1 } \
mountpoint{ /boot } . \
39999 40000 40000 ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda2 } \
vg_name{ rootvg } . \
69999 70000 70000 ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda3 } \
vg_name{ infravg } . \
100 1000 -1 ext4 \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /part1 } . \
128 1000 128 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ system_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /system } . \
100 1500 1000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ opt_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /opt } . \
100 2500 2000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ home_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } . \
100 4500 4000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ usr_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } . \
100 6000 5000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ root_lv } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } . \
100 5500 5000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ tmp_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } . \
100 6500 6000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ var_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } . \
100 7500 8000 linux-swap \
$lvmok{ } in_vg{ rootvg } \
lv_name{ swap } \
method{ swap } format{ } . \
100 1000 -1 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ free1_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /part2 } . \
100 2000 1024 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ chef_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /opt/chef } . \
100 4000 5000 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ images_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /images } . \
100 1000 -1 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ free2_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /part3 } \
.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true | I'm trying to get a Preseed file working on a 119GB hard drive and it seems there is not enough space. Basically what I want to do:
/dev/sda1 ext4 mountpoint /boot size 512MB
/dev/sda2 lvm into vg1 size 40GB
/dev/sda3 lvm into vg2 size 70GB
Some logical volumes in each of the volume groups.
The problem that I am encountering is the following:
How does preseed exactly work on the creation of physical partitions, VGs and LVs?
It tells me that i need 147930 MB for the expert-recipe and I only have available 119453 MB. Note that if I partition manually there is more than enough disk space, there will even be free space left!
When it creates the logical volumes it doesn't know that the space for those logical volumes will be allocated from the volume groups already created? It allocates the free space for LVs directly from /dev/sda? If so, how can I tell it to allocate it from each VG?
This is the expert-recipe:
d-i partman-auto/expert_recipe recipe1 :: \
511 512 512 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
device{ /dev/sda1 } \
mountpoint{ /boot } . \
39999 40000 40000 ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda2 } \
vg_name{ rootvg } . \
69999 70000 70000 ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda3 } \
vg_name{ infravg } . \
100 1 100000 ext4 \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /part1 } . \
5999 1 6000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ var_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } . \
3999 1 4000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ usr_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } . \
4999 1 5000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ root_lv } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } . \
1999 1 2000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ home_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } . \
4999 1 5000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ tmp_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } . \
8000 1 8000 linux-swap \
$lvmok{ } in_vg{ rootvg } \
lv_name{ swap } \
method{ swap } format{ } . \
999 1 1000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ opt_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /opt } . \
128 1 128 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ system_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /system } . \
100 1 100000 ext4 \
$lvmok{ } in_vg{ rootvg } \
lv_name{ free1_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /part2 } . \
1000 1 1024 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ chef_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /opt/chef } . \
4999 1 5000 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ images_lv } 5000 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /images } . \
100 1 1000000 ext4 \
$lvmok{ } in_vg{ infravg } \
lv_name{ free2_lv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /part3 } \
. | Preseed - not enough disk space? [closed] |
Depends on your environment and precise needs:If you boot the installer via Syslinux, you can use SYSAPPEND 0x80 to put it on the kernel command line.
Or you can preseed anna/choose_modules to dmidecode-udeb to make it available in the installer environment.
Or you can parse the serial number out of /sys/firmware/dmi/entries/1-0/raw (but that's binary).
Or you can preseed pkgsel/include to install it into your target system and use it from there. |
I know that you could extract serial number from machine running
dmidecode -t system, but how could I do that when running preseed installation of Debian? dmidecode command is not yet available, is it somehow possible to install/run it at the installation of the distro?
| How to get device serial number when running Debian preseed installation? |
Alpine Linux does not support preseed since it's a debian-only feature, which integrates with debian-installer.
Anyway, Alpine does support what is called an "unattended" installation.
You should provide an "answerfile" to setup-alpine script.
More info can be found here: https://wiki.alpinelinux.org/wiki/Alpine_setup_scripts
|
I would like to install Alpine using preseed.cfg. However, I cannot find one online.
Does alpine support preseed in the first place? If yes, is it possible to edit another preseed and adopt it for Alpine? For example I have a debian preseed, but I see that some options are debian specific. Example:
d-i grub-installer/only_debian boolean true | Alpine Installation with preseed cfg |
The solution is actually not to use the last update-grub, as it restores the configuration to the one that is currently in use during installation.
So my preseed step is the following:
d-i preseed/late_command string \
in-target sed -i 's#^\(GRUB_CMDLINE_LINUX_DEFAULT="quiet\)"$#\1 root=/dev/sda1"#' /etc/default/grub; \
in-target grub-mkconfig -o /boot/grub/grub.cfg; \
in-target sed -i 's/root\=\/dev\/sdb1/root\=\/dev\/sda1/g' /boot/grub/grub.cfg; |
When I install debian using the preseeded file, I have a live USB stick mounted as sda1 and ssd drive as sdb1. So I install MBR to sdb1. But when USB stick is removed SSD drive becomes sda1. And /boot/grub/grub.cfg does not work any more. I added a late command in order to fix that according to the documentation. It is simple and works if I run it manually on machine but fails in preseed (after restart the grub config file still has paths to sdb1).
d-i preseed/late_command string
in-target sed -i 's/root\=\/dev\/sdb1/root\=\/dev\/sda1/g' /boot/grub/grub.cfg;
in-target update-grub;So what is wrong here from the perspective of preseed?
| Reconfigure grub in preseed late_command |
The debconf question partman-partitioning/default_label should set the partition table type.
You also need to set the boolean question partman-partitioning/confirm_write_new_label to true or partman will not overrite an existing partition table.
So you should put in your pressed file :
d-i partman-partitioning/default_label select msdos
d-i partman-partitioning/confirm_write_new_label boolean true |
I am using a preseed file for my Debian installs. I am using 1TB drives, and I would like to use MS-DOS partition tables. It is defaulting to GPT.
Is there a way to choose which type of table to use in the preseed file?
| Select drive partition table in preseed file automated Debian install |
Debian netinst ISO image is created primarily to be burned on CD (DVD). Some years ago, it was slightly modified, so it can be saved on USB falsh disk. The modification adds a fake MBR sector which points to the first bootable partition starting at sector zero! I did not tried to place such ISO image onto regular disk device. The USB subsystem can recognise various types of USB device, USB mass storage and USB CD-ROM drive included.
The ISO image cannot be copied to USB flash in ordinary way, you definitely must use the command:
dd if=debian.iso of=/dev/sd_usbdevicebecause you manipulate with data, that belong to block device.
Well I recommend you to keep the standard way. Better use the standard burned CD-R or USB flash disk.
If you insist on your way, please try to put the ISO image on the /dev/sdb with dd command. Than it depends on your chipset, if the ISO will be recognized.
|
I'm trying to install Debian 10 using this official ISO file:
http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso
I modified this ISO file to automated with preseed.cfg, pack it using xorriso then write this ISO file into a disk called /dev/sdb using the following command:
wget -O mini.iso http://url_to_download_the_modified_debian_iso_with_preseed.iso
mv *.iso mini.iso
dd if=mini.iso of=/dev/sdbNote that /dev/sdb is a second disk partition not a flash drive
Then when I boot this ISO using the /dev/sdb as the root drive, it can boot but
presented the following dialog about 'No common CD-ROM drive was detected':So, I can go ahead manually specifying the installation medium at the input dialog box to be /dev/sdb, then when I click continue the installation continues, here is the screenshot how I specify /dev/sdb in the input box and the installation continues without problem:Since I want this to be automated, is there a way to mount this /dev/sdb automatically when the installation start before it scan the Disk? I couldn't find any preseed commands to skip this dialog box automatically.
I tried few of the following and add it in the preseed.cfg but doesn't work at all (I notice that the 3rd method, the script only run after I click continue after specifying the CD-ROM path to /dev/sdb in the dialog box)
1) d-i partman/early_command string mount /dev/sdb /cdrom2) d-i cdrom-detect/cdrom_device string /dev/sdb
3)d-i preseed/early_command string \
umount /cdrom; \
mkdir -p /cdrom; \
mount -t vfat /dev/sdb /cdromNote that, if I use this ISO file to install in Virtualbox with a predefined preseed.cfg, it runs fine automatically until I got the working Debian OS (no CD-ROM dialog box) but in a linode server, it's a problem because it doesn't have CD-ROM enabled in their BIOS. So, the recommended way to install this ISO in linode is to boot from hard disk where I put the ISO directly to /dev/sdb
| How to mount /dev/sdb to /cdrom on Debian installation startup |
AFAIK, it's not possible.
You can preseed a pre-encrypted password for the root and the first user accounts. You can even do it with the grub password (and a few others too). e.g.
d-i passwd/root-password-crypted password [MD5 hash]
d-i passwd/user-password-crypted password [MD5 hash]
d-i grub-installer/password-crypted password [MD5 hash]but that won't work for ldap-auth-config/rootbindpw because you need the unencrypted password in your LDAP config to connect to the LDAP server.
The only thing I can suggest is to use a dummy password in the pre-seed, and script an ssh connection TO the freshly-built new machine, to set the real rootbindpw. This has to be a 'push' operation rather than a 'pull' otherwise you're just shifting the problem from preseed to somewhere else.
|
I am pxe installing Ubuntu over a network, unattended. I want Ldap installed as well, but I need to provide the ldap db root password in the seed:
ldap-auth-config ldap-auth-config/rootbindpw passwordHow can I keep this secure? I don't want to provide the plain text password on this line.
| How to provide password in a secure way to LDAP seed? |
method{ swap } forman{ } \Typo there, forman should be format.
Just in case, search swap in a preseed example.
|
I try to create Debian Jessie installer which will be fully automated. I use for this purpose customised pressed file. For testing I use VirtualBox. Everything is all right, except one error at the partitioning stage. When the installer creates partition table, an error occurs:
The attempt to mount a filesystem with type swap ... at none failedI am looking for workaround to avoid this error.
My environment:
cat /etc/issue
Debian GNU/Linux 8 \n \luname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux`My customised preseed.cfg has the following content:
# Locale configuration.
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8# Keyboard configuration.
d-i console-tools/archs select at
d-i console-keymaps-at/keymap select us
d-i keyboard-configuration/xkb-keymap select us# Network configuration.
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Do not configure the network at this timed-i netcfg/use_dhcp boolean true
d-i netcfg/disable_dhcp boolean false
d-i netcfg/dhcp_timeout string 0d-i netcfg/get_hostname string localhost
d-i netcfg/get_domain string# Mirror configuration.
apt-mirror-setup apt-setup/use_mirror boolean false
apt-mirror-setup apt-setup/mirror/error select Ignore
apt-mirror-setup apt-setup/no_mirror boolean true# Time configuration.
d-i clock-setup/utc boolean true
d-i time/zone string Zulu
d-i clock-setup/ntp boolean false# User configuration.
d-i passwd/root-password password r00t
d-i passwd/root-password-again password r00t
d-i passwd/make-user boolean true
d-i passwd/user-fullname string localuser
d-i passwd/username string localuser
d-i passwd/user-password password n0nr00t
d-i passwd/user-password-again password n0nr00tpopularity-contest popularity-contest/participate boolean false# Partition configuration.
d-i partman-auto/method string regular
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select homed-i partman-auto/expert_recipe string \
localhost :: \
2048 4096 40960 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
128 256 10240 ext4 \
method{ format } format{ } \
label{ home } \
use_filesystem{ } filesystem{ ext4 } \
label{ home } \
mountpoint{ /home } \
. \
128 256 100% linux-swap \
method{ swap } forman{ } \
.
d-i partman-partitioning/confirm_write_new_label \
boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true# GRUB configuration.
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default# Finish.
d-i finish-install/reboot_in_progress noteIt's not important but to be explicit it should be noticed that I create image using live-build in the following way:
#!/bin/bashecho -e "Remove old artefacts ($(date +%H-%M-%S))."
rm -rf installerecho -e "Prepare for generate new image ($(date +%H-%M-%S))."
mkdir installer && cd installerecho -e "Configure Live Builder ($(date +%H-%M-%S))."
lb config \
--apt-indices false \
--ignore-system-defaults \
--architectures amd64 \
--linux-flavours "amd64" \
--binary-images iso-hybrid \
--mode debian \
--source false \
--distribution jessie \
--win32-loader false \
--debian-installer true \
--bootloader syslinux \
--memtest none \
--archive-areas "main contrib non-free" \
--debootstrap-options "--variant=minbase"echo -e "Inject custom content ($(date +%H-%M-%S))."
mkdir -p config/includes.installer
cp -v ../preseed.cfg config/includes.installerecho -e "Build image ($(date +%H-%M-%S))."
lb build
cd ..if [ -f installer/live-image-amd64.hybrid.iso ]; then
echo -e "Create image successfully complite ($(date +%H-%M-%S))."
echo -e "Have a nice day!"
else
echo -e "Perhaps something bad is happing ($(date +%H-%M-%S))..."
fi | Failed to create/mount swap during automated installation of Debian Jessie using preseed file |
I finally could install debian buster fully unattended by using the following Kernel arguments:
:d10-dc-node
set base-url https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-
installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
initrd tftp://my.ipxe.server/preseed/debian_buster_node.seed /tmp/debian_buster_node.seed
imgargs linux auto vga=normal root=/dev/ram rw file=/tmp/debian_buster_node.seed interface=eno1 fb=false debian-installer=en_US.UTF-8 locale=en_US.UTF-8 kbd-chooser/method=us auto-install/enable=true debconf/frontend=noninteractive priority=critical console-setup/ask_detect=false keyboard-configuration/xkb-keymap=us keyboard-configuration/modelcode=pc105 keyboard-configuration/layoutcode=us keyboard-configuration/variant=USA ---
bootNetwork configuration and hostname will be set with DHCP.
Thanks
|
I am trying to auto install debian buster with ipxe, it seems that the boot parameters don't work in the ipxe menu. I always get the language section. So the preseed isn't loaded. Here is the relevant entry in the ipxe menu:
:d10-dc-node
set base-url https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
imgargs linux vga=normal root=/dev/ram rw preseed/url=tftp://my.ipxe.server/preseed/debian_buster_node.seed netcfg/choose_interface=eno1 debian-installer/framebuffer=false debian-installer/locale=en_US kbd-chooser/method=us auto-install/enable=true debconf/frontend=noninteractive debconf/priority=critical console-setup/ask_detect=false keyboard-configuration/modelcode=pc105 keyboard-configuration/layoutcode=us keyboard-configuration/variant=USA hostname=ubuntu ---and here is the preseed part:
### Keyboard
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layout select USA
d-i keyboard-configuration/variant select USA
d-i keyboard-configuration/modelcode string pc105
d-i keyboard-configuration/xkb-keymap select en
d-i keyboard-configuration/layout string English### Locales
d-i debian-installer/country string DE
d-i debian-installer/language string en
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, de_DE.UTF-8When I try to set the base-url to http://ftp.de.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/debian-installer/amd64 it works fine until loading the modules, then I get the following error: "No kernel modules were found", which I guess because of the different Kernel versions.
| boot parameters seems not to work with ipxe and daily image |
It's working! First as mentioned by @cas, I made a mistake when declaring the size of the home directory where I accidentally used the size of the overall disk. But the main problem here is the syntax error that prevented home directory from created. Surprisingly, the debconf-set-selections that has syntax checker using an option -c did not complain about this error in preseed file. What I did was, put this missing dot (without \ symbol)
.after this line:
$lvmok{ } lv_name{ home } \
in_vg { box1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
options/nosuid{ nosuid } \So it will look like this:
$lvmok{ } lv_name{ home } \
in_vg { box1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
options/nosuid{ nosuid } \
. |
I'm trying to create a LUKS LVM disk partition autmatically using preseed on Debian 10 (Buster). I have only a single disk /dev/sda with the size of 80GB and it has system memory of 4GB
Here is my full preseed configuration:
#### Preseed preconfiguration file (for Debian buster)
### Partman early command
### Kernal parameter
d-i debian-installer/add-kernel-opts string net.ifnames=0 biosdevname=0 console=ttyS0,19200n8
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
d-i debian-installer/country string MY### Keyboard selection
d-i keyboard-configuration/xkb-keymap select us### Network configuration
d-i netcfg/choose_interface select eth0
d-i netcfg/use_dhcp string false
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
# IPv4 Static network configuration
d-i netcfg/get_ipaddress string 172.14.5.185
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 172.14.5.1
d-i netcfg/get_nameservers string 139.12.11.5
d-i netcfg/confirm_static boolean true# Set a hostname
d-i netcfg/get_hostname string sun
d-i netcfg/get_domain string domain.com
# Force a hostname
d-i netcfg/hostname string sun.domain.com
# Disable that annoying WEP key dialog
d-i netcfg/wireless_wep string### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string### Account setup
# Skip creation of a normal user account
d-i passwd/make-user boolean false
# Set root password
# or encrypted using a crypt(3) hash.
d-i passwd/root-password-crypted password $6$R3C6TyiPkyqUwaw7$4rgc4Uluov6wm5ZXmEdssw3pZs5E5dsnOuVPa/VAHAJTsQCsxSeKjIj7hp3xJzZ9t5wQpx6UuYcXZxYpjbkn/### Clock and time zone setup
# Set hardware clock to UTC
d-i clock-setup/utc boolean true
# Set timezone
d-i time/zone string Asia/Kuala_Lumpur
# Use NTP clock during installation
d-i clock-setup/ntp boolean true### Partitioning
# LVM LUKS method
d-i partman-auto/method string crypto
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string box1
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select boot-crypto
d-i partman-auto/expert_recipe string \
boot-crypto :: \
1024 1024 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
15360 15360 15360 ext4 \
$lvmok{ } lv_name{ root } \
in_vg { box1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
2048 2048 2048 ext4 \
$lvmok{ } lv_name{ tmp } \
in_vg { box1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } \
options/nosuid{ nosuid } \
options/noexec{ noexec } \
. \
4096 4096 4096 linux-swap \
$lvmok{ } lv_name{ swap } \
in_vg { box1 } \
method{ swap } format{ } \
. \
80896 80896 1000000 ext4 \
$lvmok{ } lv_name{ home } \
in_vg { box1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
options/nosuid{ nosuid } \
d-i partman-basicfilesystems/no_mount_point boolean false
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true### Apt setup
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
### Package selection
tasksel tasksel/first multiselect standard
# Individual additional packages to install
d-i pkgsel/include string openssh-server
popularity-contest popularity-contest/participate boolean falseThe other preseed config ran successfully. The disk is created with LUKS LVM but the problem is that there is a missing partition like /home (which is not created from the beginning) but I did defined it in the preseed file above. In addition, the swap disk space should be 4GB but it filled up the rest of the space. Here is the screenshot how this preseed config created the disk structure:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 79G 0 disk
|-sda1 8:1 0 976M 0 part /boot
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 78G 0 part
`-sda5_crypt 254:0 0 78G 0 crypt
|-box1-root 254:1 0 14.3G 0 lvm /
|-box1-tmp 254:2 0 1.9G 0 lvm /tmp
`-box1-swap 254:3 0 61.8G 0 lvm [SWAP]What could be the reason for this? Any mistakes in my preseed file for partitioning?
My partition scheme is this:
TOTAL SPACE is 80 GBpartition: /boot 1GB | FILE SYSTEM: ext4 | bootable flag: on | no need to encrypt# This is LVM container encryption called box1:partition: /root (/) 15 GB | FILE SYSTEM: ext4partition: /tmp 2GB | FILE SYSTEM: ext4 | mount with: nosuid, noexecpartition: swap 4GBpartition: /home 60GB (or the rest space left) | FILE SYSTEM: ext4| mount with: nosuid | Debian preseed does not create encrypted disk with LUKS LVM properly |
Since linux 2.6.12, that depends on the value of the RLIMIT_NICE limit (ulimit -e). Which can take values from 0 to 40. That limit is more the limit on the priority of the process (the greater that number, the higher the priority a user can set for a process).
You'll notice the default value is 20 on ubuntu 10.04 and 0 in Debian jessie for instance.
A value of n for that limit means that a process without the CAP_NICE capability can only increase a process priority to up to n, which means decrease niceness down to a niceness of 20 - n. So for a value of 0, that means no non-privileged user can lower the niceness below 20, so no non-privileged user can lower the niceness.
With a value of 20, non-privileged users can decrease the niceness back to 0.
It's up to the administrator to choose whether they allow users to lower their process priority, and to what level by setting the hard limit for that.
As to why an administrator may not want users to lower their process priority, see Flup's answer.
|
From man renice:Users other than the super-user may only alter the priority of processes
they own, and can only monotonically increase their ``nice value'' (for
security reasons) within the range 0 to PRIO_MAX (20) [...]So, I can renice my own processes upwards (give them lower priority) but never downwards:
$ renice 10 22316
22316 (process ID) old priority 0, new priority 10
$ renice 9 22316
renice: failed to set priority for 22316 (process ID): Permission deniedWhy is this? I can understand why normal users cannot set nice values lower than 0, but why since I can decrease the priority to 10 can't I increase it again to 9? What "security reason" is there for this? I have the right to launch a process with a nice value of 9, so why can't I renice it to 9?EDIT: I should learn to scroll down. Turns out this is listed as a bug in man renice:
BUGS
Non super-users can not increase scheduling priorities of their own
processes, even if they were the ones that decreased the priorities
in the first place.That's even more confusing. If they consider this behavior to be a bug, why not change it? The renice command appeared in 4.0BSD which I think is from 1980. This should be very easy to fix so on the one hand they seem to have chosen to leave it and on the other they list it as a bug.
| Why can't I use renice to increase a process' nice value? |
I would start it normally and use "renice" afterwards...
However I was able to make a quick hack together with "su" which works:
sudo nice -n -20 su -c command_to_run user_to_run_asIf you don't have to give sudo a password - perhaps because you've already just given it - you may add an & to put the whole thing in the background.
Since you already become root with the sudo-command, su won't ask you for a password. I was able to start a X-program from a terminal-emulator under X. If you want to run the X-program as another user than the user owning the X-session, you'll probably need to explicitly tell X to allow it (open for X-clients from that user).
|
I would like to start a process with a nice value of -20. This requires me to use a command like
sudo nice -n -20 matlabHowever, this starts matlab as root too. Is there a way to have matlab as non-root?
My current approach is
sudo nice -n -20 sudo -u myusername matlabwhich to me looks like a hack. Is there a direct approach to do this?
| How do I start a process with a nice value of -20 and not give it root privilege? |
Under Linux, by default, a process's IO priority is derived from its CPU priority according to the formula
io_priority = (cpu_nice + 20) / 5IO priority ranges from 0 to 7 with 0 being the highest priority. CPU niceness ranges from -20 to 19 with -20 being the highest priority.
You can use the ionice command to change a process's IO priority. If you want that process to run only when the system isn't otherwise busy, make it run under the “idle” class rather than the default “best-effort” class:
ionice -c 3 -p $PID
ionice -c 3 mycommand --someoptionEven with the lowest priority, a disk-intensive process tends to slow the system down, if nothing else because it pollutes the cache.
See the ionice man page for more information.
|
I'm running software that overloads disk IO sometimes. I don't need fast response from that software, I need fast response from other applications, so I could set low process priority for that. I want to ask how process priority affects disk IO priority for a process.
I tried a small experiment: I set low priority (in System Monitor under GNOME) for a process and checked IO priority with ionice.
Result:
IO priority = 0 for normal process priority
IO priority = 4 for low process priorityBut will this always work like this? Is IO priority always reduced when I reduce process priority?
| How disk IO priority is related with process priority? |
The top command lists the priority of running processes under the PR heading. If you have it installed, you can also search for a process and sort by priority in htop.
|
How can i view the priority of a specific process ?
| What is a command to find priority of process in Linux? |
Have a look at cgroups, it should provide exactly what you need - CPU reservations (and more). I'd suggest reading controlling priority of applications using cgroups.
That said, put the important yet often idle processes into group with allocated 95% of CPU and your other applications into another one with allocated 5% - you'll get (almost) all of the power for your jobs when needed, while the constantly power hungry process will only get 5% at most at those times. When the computational surges disappear all CPU performance will be thrown at the remaining processes. As a benefit, if you create a special cgroup (with minimal performance requirements) for processes like sshd, you'll be able to log in no matter what is trying to get all CPU it can - some CPU time will be reserved for sshd.
|
I have a regular process that's not so important but will consume very much CPU power. I have another process which is really important, but it spends most of the time idle, but when it gets a job it really needs high computing power.
I tried running with nice -20 ./low_priority_process and nice --20 ./high_priority_process but still the lower priority process consumes significant amount of CPU when the high priority process is in need.
How can I run a process that will really yield or even auto-suspend when another process is using CPU power?
| Run Linux process at very very low priority? |
ionice [-p] <pids/>For example:
$ ionice -p `pidof X`
none: prio 0This means X is using the none scheduling class (best effort) with priority 0 (highest priority out of 7). Read more with man ionice.
|
How can I view the IO priority of a process? like to see for example if something has been ionice-ed.
| How do I view the IO priority of a process? |
What does a niceness of (-) indicate?Notice those also have a PRI score of -100; this indicates the process is scheduled as a realtime process. Realtime processes do not use nice scores and always have a higher priority than normal ones, but still differ with respect to one another.
You can view details per process with the chrt command (e.g. chrt -p 3). One of your -100 ones will likely report a "current scheduling priority" of 99 -- unlike nice, here high values are higher priority, which is probably where top created the -100 number from. Non-realtime processes will always show a "current scheduling priority" of 0 in chrt regardless of nice value, and under linux a "current scheduling policy" of
SCHED_OTHER.Only the Ubuntu and CentOs machines have non digit niceness values.Some versions of top seem to report realtime processes with rt under PRI and then 0 under NI.
|
According to the man page, and wikipedia; nice ranges from -20 to 20.
Yet when I run the following command, I find some processes have a non numerical value such as (-). See the sixth column from the left with title 'NI'.
What does a niceness of (-) indicate?
ps axl
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 0 1 0 20 0 19356 1548 poll_s Ss ? 0:00 /sbin/init
1 0 2 0 20 0 0 0 kthrea S ? 0:00 [kthreadd]
1 0 3 2 -100 - 0 0 migrat S ? 0:03 [migration/0]
1 0 4 2 20 0 0 0 ksofti S ? 0:51 [ksoftirqd/0]
1 0 5 2 -100 - 0 0 cpu_st S ? 0:00 [migration/0]
5 0 6 2 -100 - 0 0 watchd S ? 0:09 [watchdog/0]
1 0 7 2 -100 - 0 0 migrat S ? 0:08 [migration/1]
1 0 8 2 -100 - 0 0 cpu_st S ? 0:00 [migration/1]
1 0 9 2 20 0 0 0 ksofti S ? 1:03 [ksoftirqd/1]
5 0 10 2 -100 - 0 0 watchd S ? 0:09 [watchdog/1]
1 0 11 2 -100 - 0 0 migrat S ? 0:05 [migration/2]I've checked 3 servers running: Ubuntu 12.04 and CentOs 6.5 and Mac OsX 10.9. Only the Ubuntu and CentOs machines have non digit niceness values.
| What does a niceness value of (-) mean? |
To set niceness (CPU bound) use nice. To set IO niceness (IO bound) use ionice. Refer to the respective man pages for more information. You can use them together as follow:
ionice -c 2 -n 0 nice -n -20 mplayerNote: the lowest level of niceness (lower means more favorable) you can define is determined by limits.conf. On my computer the file is located at /etc/security/limits.conf.
|
I want to run mplayer with higher priority than any other processes, including the IO-processes. How can I do that?
| Run process with higher priority |
There are several uses for cgroups. From the system administration probably the most important one is limiting resources -- the classical example here being the cpu access. If you create a group for e.g. sshd and give it some non-negligible CPU time share (compared to other groups or the default under which fall all unsorted processes), you are guaranteed to being able to login even in times when the machine will be running a CPU-intensive tasks.
More interestingly, if you give this "remote access" processes much higher CPU share then the rest, you will be able to log in almost instantly (because the ssh daemon will be prioritised over the rest of running processes) while you won't hurt the overall computation strength of the machine, since the resources are allocated only on a per-need basis. You usually want to do this together with I/O (including network) prioritisation. However, as John correctly points out in the comment below, one doesn't want to do these things carelessly (since it might fire back in an unexpected way). Important thing to bear in mind is that the groups are inherited by default -- i.e. one doesn't want to start a memory/CPU hog from such an ssh session. Yet for this there are mechanisms that can assign processes to cgroups as they start.
Another use is isolating the processes from each other -- in combination with other features (namespace isolation) in recent Linux kernels they are used to create OS-level virtualization like the LXC (Linux Containers).
Other than that you can do various accounting and control stuff (freezing some processes groups, assigning them to specific CPU cores etc.).
The two links here, should be a reasonable starting place if you are looking for more information. You may also want to check Documentation/cgroups directory in the Linux kernel source tree.
|
I would like to understand cgroups better and would like to understand the use-cases for applying cgroups.
Are cgroups a good way for prioritizing different applications (i.e, giving higher priority to specific types of applications like web servers)?
| controlling priority of applications using cgroups |
"Real time" means processes that must be finished by their deadlines, or Bad Things (TM) happen. A real-time kernel is one in which the latencies by the kernel are strictly bounded (subject to possiby misbehaving hardware which just doesn't answer on time), and in which most any activity can be interrupted to let higher-priority tasks run. In the case of Linux, the vanilla kernel isn't set up for real-time (it has a cost in performance, and the realtime patches floating around depend on some hacks that the core developers consider gross). Besides, running a real-time kernel on a machine that just can't keep up (most personal machines) makes no sense.
That said, the vanilla kernel handles real time priorities, which gives them higher priority than normal tasks, and those tasks will generally run until they voluntarily yield the CPU. This gives better response to those tasks, but means that other tasks get hold off.
|
If I do the following command on my standard Linux Mint installation:
comp ~ $ ps -eo rtprio,nice,cmd
RTPRIO NI CMD
...
99 - [migration/0]
99 - [watchdog/0]
99 - [migration/1]
- 0 [ksoftirqd/1]
99 - [watchdog/1]I get some of the processes with realtime priority of 99.
What is the meaning of rtprio in a non real time Linux?
Does this mean that if I just run a program with rtprio 99 it runs real time?
Where do real time OSes fall in this story?
| Real time priorities in non real time OS |
The 2 sentences are just explaining 2 instances of how CFS could work - the former is when 2 tasks have the same nice value and the latter when the 2 tasks have different nice values. In general, the time slice calculated for each task boils down to this formula:
timeslice = (weight/total_weight)*target_latencyweight is the weight of the current task which is dependent on the nice value assigned to the task.
total_weight is the sum of the weights of all tasks in the run queue.
target_latency is the time interval that CFS will attempt to once schedule all tasks in the run queue by.
Going back to the original formula, when 2 tasks have the same nice value, they will also have the same weight value. By treating weight as a constant, our new formula is:
timeslice = (target_latency/total_weight)As you see, the time slice of each task in the run queue is no longer dependent on its weight value and thus each task will receive the same time slice. This is the first case the book mentions.
The second case mentions the nice values differ, and thus the weight values will differ. Each task will receive its time slice accordingly.
|
I'm trying to understand the Completely Fair Scheduler (CFS). According to Robert Love in Linux Kernel Development, 3rd edition(italics his, bold mine):Rather than assign each process a timeslice, CFS calculates how long a
process should run as a function of the total number of runnable
processes. Instead of using the nice value to calculate a timeslice,
CFS uses the nice value to weight the proportion of processor a
process is to receive: Higher valued (lower priority) processes
receive a fractional weight relative to the default nice value,
whereas lower valued (higher priority) processes receive a larger
weight.
Each process then runs for a “timeslice” proportional to its weight
divided by the total weight of all runnable threads. To calculate the
actual timeslice, CFS sets a target for its approximation of the
“infinitely small” scheduling duration in perfect multitasking. This
target is called the targeted latency....Let’s assume the targeted latency is 20 milliseconds and
we have two runnable tasks at the same priority. Regardless of
those task’s priority, each will run for 10 milliseconds before
preempting in favor of the other. If we have four tasks at the same
priority, each will run for 5 milliseconds. If there are 20 tasks,
each will run for 1 millisecond....
Now, let’s again consider the case of two runnable processes, except
with dissimilar nice values—say, one with the default nice value
(zero) and one with a nice value of 5. These nice values have
dissimilar weights and thus our two processes receive different
proportions of the processor’s time. In this case, the weights work
out to about a 1/3 penalty for the nice-5 process. If our target
latency is again 20 milliseconds, our two processes will receive 15
milliseconds and 5 milliseconds each of processor time,
respectively.The first bolded sentence says that tasks have the same timeslice regardless of priority, while the second says that the timeslice depends on nice value. Which is correct, or what am I missing?
| Does the timeslice depend on process priority or not under Completely Fair Scheduling? |
Changing the priority of a process only determines how often this process will run when other processes are competing for CPU time. It has no impact when the process is the only one using CPU time. A minimum-priority process on an otherwise idle system gets 100% CPU time, same as a maximum-priority process.
So you can run your game with a higher priority, but that won't make it run faster unless something else on the system is using a significant amount of CPU time.
I recommend keeping the priority lower than the X server, because if the X server wants CPU time, it's likely to be because the game is asking it to display something complex, and display is usually a CPU-demanding task (but it depends how much of the work is done in the GPU —CPU priorities have no influence on the GPU).
CPUs are designed to execute code. Changing process priorities won't affect how much work the CPU does, but even if it did, that wouldn't damage the CPU, it would only make it run hotter and so make the fans in the computer blow harder.
|
On Windows I have frequently changed the priority of a games process to 'high' or 'realtime' to get a performance boost. This has never resulted in any problems with my hardware. I was thinking that maybe I could do this on Linux using the chrt command to change the realtime priority of the games process, as reniceing, even to -20 (the highest priority) doesn't seem to provide any noticeable boost. However, I am wary of doing this without knowing whether it might be bad for my CPU. Can anyone inform me on the risks?
| Is changing the priority of a game's process to realtime bad for the CPU? |
In fact, RLIMIT_NICE allows you to bypass the basic rule that says that "a process can raise its nice value only if owned by root".
Demonstration:
# ulimit -e 30
# su nobody
$ nice -n -10 topYou will see that your top process runs with niceness -10.
Now if you try nice -n -11 top, it will run with niceness 0, because -11 is not allowed by RLIMIT_NICE=30.
The formula is given in the manpage: the maximal niceness allowed is 20-rlimit. So:0 means "you can raise niceness to 20", a.k.a. useless;
20 means "you can raise niceness to 0", which lets you go back to 0 if you lowered your priority;
40 means "you can start processes up to nice -n -20. |
I am using prlimit in Ubuntu to do some resource restrictions in my sandbox which has been very helpful. However, I am not quite sure what to do with RLIMIT_NICE. The docs say:RLIMIT_NICE (since Linux 2.6.12, but see BUGS below)
Specifies a ceiling to which the process's nice value can be
raised using setpriority(2) or nice(2).However, according to getpriority(2), a process can raise it's nice value only if owned by a superuser in the first place. But if this is the case, the RLIMIT_NICE value is not going to add too any functionality because a privileged user can arbitrarily lower or higher RLIMIT values anyway.
So I don't understand how to use or interpret RLIMIT_NICE. For non-privileged users the entire thing seems useless because they cannot raise priority in the first place, and it makes no sense to set it below the current priority. However for superusers it doesn't really add anything either because the nice, and RLIMIT_NICE soft- and hard limits can arbitrarily be raised.
So what is the idea behind RLIMIT_NICE ?
| Is there any use for RLIMIT_NICE? |
The field exists so you can define the order in which filesystems are checked. Different partitions on the same drive should not be checked at the same time since the IO going to each filesystem will compete with one another, and slow the whole process down. Filesystems on different physical disks could be set to check in the same pass to speed up the whole process since the IO to separate disks would not be competing.
|
Inside the /etc/fstab file, in the sixth column, there is a number that corresponds to whether a filesystem should be scanned for errors. Possible values are:
0 - skip
1 - high priority
2 - low priorityWhy was fsck 'priority' introduced in /etc/fstab? | Why was fsck priority introduced in /etc/fstab? |
To my knowledge, the Linux kernel does not change the niceness of a process, and I fail to see why it would since it doesn't have to to lower the priority of a process. The niceness is an information given to the kernel, telling it how nice that process is willing to be. The kernel scheduler is free to take this information into account the way it wants in order to change the priority of a process, it doesn't need to change its value.
On the other hand, in user land, there are daemons like AND whose task is to renice processes according to rules set up by the admin. Do you have such a daemon installed on your server?
However, the AND daemon does not renice processes owned by root, and since you set a priority of -1 with setpriority(), I assume this is the case here. Therefore, the only reason I see for that change in niceness is user interaction.
That said, since you are using htop, it is possible that the process has been reniced inadvertently by pressing the ] key or the F8 key.
|
I know you can change a process niceness with setpriority or nice or renice.
However, does Linux automatically adjust/change a process niceness without user input?
I have a process for which I use setpriority in C, like so:
setpriority(PRIO_PROCESS, 0, -1)When the process is running, I can see its niceness value is now -1 by running htop.
While investigating a crash on a remote machine, the output of htop was provided to me. I noticed that the niceness value for this process had changed on one instance to 0 and on another instance to 6. I'd like to know if this was changed by the kernel or if the only way to change this value is by having a user or script deliberately make the change.
| Does Linux Change a Process Niceness Automatically? |
On Linux, drives are scheduled independently from each other. You can even set the IO scheduling algorithm to be different for different drives on the same system, by writing to /sys/block/<device>/queue/iosched.
The bandwidth between memory and the disks can indeed become a bottleneck. This is why hardware RAID makes sense: the data is sent to the RAID controller once, as opposed to each disk separately. You can also increase this bandwidth by attaching those 100 SSDs to more than one computer, distributing the load between them.
I'm not sure how the IO scheduler takes this into account, but I don't think it does.
|
I understand how ionice can help you when you have multiple processes requesting access to the same disk resources, but how does it work when you have multiple disks?
For example, you have one rsync operation moving data from Drive A -> Drive B, and another rsync moving data from Drive C -> Drive D.
In theory, since they are not competing for resources, ionice'ing one of these rsync processes shouldn't change its throughput. Is this how it works, or will it still impact performance?
Additionally, is there some "upper limit" on total I/O one might experience on a linux system that is independent of drive speed? Like if you hooked up 100 SSD drives, at some point would the OS run into a bottleneck aside from drive speed?
| How does ionice work with multiple drives? |
man 2 swapon describes priorities thus:Each swap area has a priority, either high or low. The default priority is low. Within the low-priority areas, newer areas are even lower priority than older areas.
All priorities set with swapflags are high-priority, higher than default. They may have any nonnegative value chosen by the caller. Higher numbers mean higher priority.
Swap pages are allocated from areas in priority order, highest priority first. For areas with different priorities, a higher-priority area is exhausted before using a lower-priority area. If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.The sentence you highlighted can’t be taken out of its context; it concerns high priorities, which the default priorities aren’t.
Swap priority only matters if you have multiple swap devices and a reason to prefer some of them to others. If you have a single swap device, it won’t make any difference. If you have multiple swap devices on separate disks, it can be worth changing the priorities so that they are used equally; otherwise, the first device added will be used, then the second device, and so on.
|
While seeing the manual for swapon command the priorty option is described as
-p, --priority priority
Specify the priority of the swap device. priority is a value
between -1 and 32767. Higher numbers indicate higher
priority. See swapon(2) for a full description of swap
priorities. Add pri=value to the option field of /etc/fstab
for use with swapon -a. When no priority is defined, it
defaults to -1.Can someone explain what does priority of swap means. What does higher value and lower value of ths setting affect the system and what should be the optimal value for this in home computer?
Edit:
The man page for swapon(2) shows
They may have any non-negative value chosen by the callerBut in my system(debian 10 testing) the default priority value is -1
| What is swap priority and why does it matter |
Disk and memory scheduling are entirely different. In the absence of an IO priority scheduler, IO will be handled on a first come first served basis. If the system is IO bound, then all processes run in a more or less round robin basis until all are waiting for I/O. The nice priority of a process will have little impact on its scheduling frequency.
Recent versions of Linux have added an ionice facility. The idle priority is intended to prevent IO degradation which may occur when the heads are moved to a different area of the disk delaying writes for other processes.
Renicing an I/O bound process is unlikely to significantly slow its I/O rate unless the load average exceeds the number of CPUs. If unused CPU cycles are available, the process will likely be scheduled frequently enough to keep its I/O rate close to what it would be at a regular priority.
Recent Linux kernels will modify the IO priority of reniced process which have not had an IO priority set. The 40 CPU priority levels are mapped to 8 IO priority levels, so a significant nice change may be required to change the IO priority.
Having a significant number of CPU bound processes running at or above the I/O bound processes priority may slow its I/O rate. The process will still get time slices resulting in I/O occurring.
|
The CFQ IO scheduler supports priorities though I am not sure that Deadline does (I believe not). The premise is that when I renice a task it gets a larger share of CPU under the Completely Fair Scheduler. Since this task is likely to run more often it would call for IO more often as well when needed, correct?
I am wondering if even though the IO scheduler does not support priorities that the task would get more/less IO when reniced? Or is the disk/memory management completely separate?
| Does IO prioritise by the very nature of renicing a task? |
A list of non-zero CPU % processes:
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1'To count them
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1' | wc -lTo see this continuously updated, but them in a file called processes.sh:
#!/bin/bash
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1'and make it executable with chmod +x processes.sh. Now run it with watch for live updating:
watch ./processes.sh |
How to properly identify real-time processes currently occupied CPU queue and count them using ps? I know there is a bunch of fileds like prio,rtprio,pri,nice but do not know correct to use. It seems I need use something like ps -eo rtprio,prio,cpu,cmd --sort=+rtprio to get full list, but it do not seems for me right since a lot of processes got with - sign at RTPRIO column. For example, I have 48 cores system running Oracle Linux and try to identify following questions:What processes occupied run queue? What's a count of them?
How to identify processes that run in Real Time mode or with increased priority? | How to sort ps output to find processes realtime priority and identify processess currently occupied running queue |
Most software build processes use make. Make sure you make make use the -j argument with a number usually about twice the number of CPUs you have, so make -j 8 would be appropriate for your case.
|
I am doing a build on a Linux machine with Ubuntu 10.04 on it. How can I really speed up my build? I have 4 CPUs and lots of RAM. I already reniced the process group to -20. Is there something else I can do?
| How to speed up my build |
As I mentioned, @glenn-jackman gave you the answer. But just to elaborate a bit more, if you wish to give higher priority to the command but do not intend to run it as root, you could use a function (and sudo):
nice_cmd() {
PRIORITY=$1 ; shift
CMD=$1 ; shift
${CMD} $@ & cmdpid=$!
sudo renice -n ${PRIORITY} -p ${cmdpid}
}Then execute it as (this could ask for your user password, depending on how is sudo configured)
$ nice_cmd -5 vim somefile
$ fgAnd from a top on another terminal, you can double check the nice value.
|
Does anyone know if it's possible to execute and renice a process in one command, i.e. without having to look up the command in the list of processes using the ps command and then renice that particular pid.
| Execute and renice a process in one command |
As explained in sched_setscheduler(2), SCHED_FIFO is RT-priority, meaning that it will preempt any and all SCHED_OTHER (ie. "normal") tasks if it decides it wants to do something.
So, you should be absolutely sure it is well written and will yield control periodically by itself, because if it decides not to (eg. it wants CPU time) the rest of your system will come to complete halt until such time your RT process decides to sleep (which may be "never").
|
I was trying to change linux process priority using chrt. I changed priority of one process to SCHED_FIFO from SCHED_OTHER. I could see some improvement in the perfomance. I run linux angstrom distribution for my embedded system.
So if I use SCHED_FIFO for one process, how other process will get affected? What are the precautions to be taken? I couldn't notice an apparent change in processor utilization. Thanks in advance.
| SCHED_FIFO and SCHED_OTHER |
You can use the ondemand cpu-freq governor, as long as you set the ignore_nice_load parameter to 1.
From Documentation/cpu-freq/governors.txt, ondemand section:ignore_nice_load: this parameter takes a value of '0' or '1'. When
set to '0' (its default), all processes are counted towards the
'cpu utilisation' value. When set to '1', the processes that are
run with a 'nice' value will not count (and thus be ignored) in the
overall usage calculation. This is useful if you are running a CPU
intensive calculation on your laptop that you do not care how long it
takes to complete as you can 'nice' it and prevent it from taking part
in the deciding process of whether to increase your CPU frequency. |
In some devices the cpu speed is dynamic, being faster when there is more load.
I was wondering if it is possible to set nice level or priority of a process so that it does not influence an increase in cpu speed when it is running flat out.
i.e.
Process is running flat out, but only using spare cpu cycles as low priority. But also not causing an increase in cpu speed.
When cpu is off process stops.
When cpu is slow process may have some cpu, maybe most of it.
When cpu is fast, because another process is running at 90%, process gets the remaining 10% of fast cpu.
Then other process stops, so low priority process gets 100% of cpu, but the frequency controller does not see this low priority process and drops the frequency.
| Process priority and cpu speed |
In ps’s output, pri_baz is calculated as pp->priority + 100, and pp->priority is the prio value from the kernel. This is described asPriority of a process goes from 0..MAX_PRIO-1, valid RT
priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
values are inverted: lower p->prio value means higher priority.
The MAX_USER_RT_PRIO value allows the actual maximum
RT priority to be separate from the value exported to
user-space. This allows kernel threads to set their
priority to a value higher than any user task. Note:
MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.So the range in the kernel does cover 140 values, from 0 to MAX_PRIO–1 (139).
However, the minimum FIFO and RT priority is 1, and this explains the missing value: the input values (at least, that can be set from userspace, using sched_setscheduler) go from 1 to 99, and the kernel converts those to prio values using the formula MAX_RT_PRIO – 1 – priority, giving values from 0 to 98.
|
Can someone explain how "real" process priority (i.e. pri_baz field of ps) is calculated?
My guess is:
pri_baz = 99 - static_priority # if static_priority > 0 (real-time process)
pri_baz = 100 + min(20 + nice + dynamic_adjustment, 39) # if static_priority = 0 (time-shared process)This is supported by the following test:
# chrt -r 1 sleep 1 \
> & chrt -r 99 sleep 1 \
> & nice --20 sleep 1 \
> & nice -19 sleep 1 \
> & ps -C sleep -O pri_baz
[1] 25408
[2] 25409
[3] 25410
[4] 25411
PID BAZ S TTY TIME COMMAND
25408 98 S pts/3 00:00:00 sleep 1
25409 0 S pts/3 00:00:00 sleep 1
25410 100 S pts/3 00:00:00 sleep 1
25411 139 S pts/3 00:00:00 sleep 1However I'm puzzled because:pri_baz = 99 appears to be unused.
I knew Linux handled (by default) 140 priority queues, and this scheme gives only 139 values of priority. | How is process priority calculated? |
To quote Robert Love:The scheduler does not magically know whether a process is
interactive. It requires some heuristic that is capable of accurately
reflecting whether a task is I/O-bound or processor-bound. The most
indicative metric is how long the task sleeps. If a task spends
most of its time asleep it is I/O-bound. If a task spends more
time runnable than sleeping, it is not interactive. This extends
to the extreme; a task that spends nearly all the time sleeping is
completely I/O-bound, whereas a task that spends nearly all its time runnable is completely processor-bound.
To implement this heuristic, Linux keeps a running tab on how much
time a process is spent sleeping versus how much time the process
spends in a runnable state. This value is stored in the sleep_avg member of the task_struct. It ranges from zero to MAX_SLEEP_AVG,
which defaults to 10 milliseconds. When a task becomes runnable after
sleeping, sleep_avg is incremented by how long it slept, until the
value reaches MAX_SLEEP_AVG. For every timer tick the task runs,
sleep_avg is decremented until it reaches zero.So, I believe the kernel decides the scheduling policy based on the above heuristics. As far as I know, for real time processes, the scheduling policy could either be SCHED_FIFO or SCHED_RR. Both the policies are similar except that SCHED_RR has a time slice while SCHED_FIFO doesn't have any time slice.
However, we can even change the real time process scheduling as well. You could refer to this question on how to change the real time process scheduling.
References
http://www.informit.com/articles/article.aspx?p=101760&seqNum=2
|
I understand that, for scheduling purposes, Linux processes have a "nice" value and a real-time priority value and that these can be explicitly altered with the nice and chrt commands. If the user does not explicitly set the real-time priority of a process, how is it set?
| How is the real-time priority of a process set by default? |
In our Linux system, without our application running, the "ktimersoftd" thread is the highest priority, with a real-time priority of 1. However, our application, along with the third-party-libraries we were utilizing, all created higher priority real-time threads, preempting "ktimersoftd". It turned out that one of the third-party-libraries libraries we were utilizing depended on soft interrupts, which requires the "ktimersoftd" thread to be higher priority than the threads in the third-party-library. Raising the "ktimersoftd" thread's priority to real-time priority 98 solved the issues we were seeing.
| I have 2 threads, each set to a different real-time priority using SCHED_FIFO. Thread throttling has been disabled, so theoretically the highest priority thread should be able to use 100% of CPU resources, preventing lower priority threads from ever running. If I create a tight infinite loop in the lower priority thread that doesn't yield or sleep, I expect that no lower priority threads will ever get to run. However it appears as though the higher priority thread's standard output also stops, indicating that it is also prevented from running, which confuses me.
Why can this lower priority thread interfere with a higher priority thread that should always have priority? Does it have something to do with the tight infinite loop, or am I fundamentally misunderstanding how Linux thread priorities should work?
I've tried to make the question as general as possible, but since the answer might be related to my very specific setup, I'm using kernel version 4.1.33 with the RT Preempt patch, running on an ARMV7 CPU.EDIT:
I created a dead simple test program to recreate the issue without any complication, and as expected, the problem disappeared. This indicates that some shared resource was likely to blame for the higher priority thread not being able to run (as was suggested in the comments below). However, I can't think of any such resources the higher priority thread would need access to.
Part of my problem now is that I'm not sure what types of resources would require an exclusive lock. Things like access to the system clock, or access to the filesystem, or access to standard output, are common things that I'm unsure of in regard to whether a lock is used. Could any of those (or perhaps something similar that I overlooked) prevent the higher priority thread from running?
| Lower priority thread appears to block higher priority thread? [closed] |
The answer seems to have been to put the following in my init.d script, which I put just before the start-stop-daemon calls in do_start:
ulimit -r ## (where ## is a sufficiently high number; 99 works)The way I was able to determine this was by making system calls to ulimit -a inside of a bash command inside of my code:
bash -c "ulimit -a"The bash part is necessary, because ulimit -a is a shell builtin. ulimit -a on /bin/sh returns different information unrelated to real-time priority. For some reason, I found that my real-time priority was limited to 0 (no real-time priority) when my service is started at boot. When I run it with service or by calling the init.d script, it inherits my permissions which allow for real-time priority. But when the system calls it through the Upstart/SystemV backwards compatibility system, it doesn't get that elevated privilege. I suppose this might relate to posts I have seen that say Upstart doesn't read /etc/security/limits.conf which is where you would set system-wide real-time priority permissions for non-privileged users.
If anyone can verify or explain why this solution works, I would love to hear it.
|
I have a piece of C++ code that runs just fine when I run it from a Linux terminal, but which throws an EPERM error when run from a SystemV (init.d) script on bootup. The error comes from a pthread_create with the following bit of attributes assigned to the thread attempting to be created:
pthread_t reading_thread;pthread_attr_t read_attr;
struct sched_param read_param;
pthread_attr_init(&read_attr);
pthread_attr_setschedpolicy(&read_attr, SCHED_FIFO);
pthread_attr_setinheritsched(&read_attr, PTHREAD_EXPLICIT_SCHED);
read_param.sched_priority = 30;
pthread_attr_setschedparam(&read_attr, &read_param);k = pthread_create(&reading_thread, &read_attr, Reading_Thread_Function,
(void*) &variable_to_pass_to_Reading_Thread_Function); // Will return EPERMThis code works just fine when run from my terminal. It also runs just fine in the init.d script when I call "/etc/init.d/myinitdscript start". It also runs fine as "sudo service myinitdscript start". The init.d script contains the following:
#! /bin/sh
### BEGIN INIT INFO
# Provides: myinitdscript
# Required-Start: $local_fs $remote_fs $syslog $network
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts my daemon
# Description: Verbose explanation of starting my daemon
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
LOG=/home/someusershome/initd.log
NAME=myinitdscript
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
[ -x "$DAEMON" ] || (echo "$DAEMON not found. Exiting $SCRIPTNAME." >> $LOG 2>&1 && exit 0)
USERTORUNAS=a_user_on_my_system
SOURCE_SCRIPT=/home/$USERTORUNAS/source_script
DAEMON_ARGS="some_args_for_script". /lib/init/vars.sh. /lib/lsb/init-functions# Source this script for environmental variables
[ -f $SOURCE_SCRIPT ] && . $SOURCE_SCRIPT# This is called when called with 'start', I am skipping that for succintness
do_start()
{
start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --test --background --chuid $USERTORUNAS --startas /bin/bash -- -c "exec $DAEMON -- $DAEMON_ARGS >> $LOG 2>&1 " || return 1
start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --background --chuid $USERTORUNAS --startas /bin/bash -- -c "exec $DAEMON -- $DAEMON_ARGS >> $LOG 2>&1" || return 2
}If I activate this init.d script using:
update-rc.d myinitdscript defaults 99it will error on boot with an EPERM error thrown at the pthread_create call (k = 1, aka EPERM). I can run this using sudo service myinitdscript start, and it will run just fine. I can also call /etc/init.d/myinitdscript start, and it will run just fine. It is only when I let the system run this script on boot that it fails.
I find that if I add to my start-stop-daemon calls the option "-P fifo:99" I don't get the EPERM error and the code runs okay except at too high a priority so I won't call this a fix. The only part of the code that needs to run real-time is that pthread created from in the code. So I suppose this has to do with my permissions to create a real-time thread with priority 30 from within a normally scheduled thread.
Why does my script need special scheduling policies/priorities when run from boot versus when I manually start the init.d script or through service?
EDIT: Running on Ubuntu 12.04.
EDIT2: I tried adding a call to "ulimit -r" inside my code which the start-stop-daemon call starts, and I get unlimited, so as far as I can see, there shouldn't be any permissions issue going with SCHED_FIFO:30 there
EDIT3: It turns out I am running Upstart, and Upstart has an init script called rc-sysinit.conf which starts all the SystemV style scripts. So perhaps Upstart is screwing up my permissions.
| realtime pthread created from non-realtime thread with init.d |
The init scripts on /etc/init.d/ specify some information on it's LSB header, which in essence are just some lines at the beginning of the script. The field "Required-Start" of some script allows you to specify services that must be initialized before this script. insserv automatically add init scripts regarding LSB header.
Therefore, to solve the problem: Name your script "X" using "Provides" field on LSB header.
Add the runlevels where the script has to be started and stopped using "Default-Start" and "Default-Stop" fields respectively on LSB header.
Set "X" to the field "Required-Start" on the LSB header of the scripts with priority 01: hostname.sh, fake-hwclock and mountkernfs.sh.
Add the service using sudo insserv name_of_your_script_file (not the name you give to "Provides" field)This moves all the necessary script priorities of the involved scripts to match the dependencies. In my case: S01X.sh
S02mountkernfs.sh
S02hostname.sh
S02fake-hwclock
S03udevSource: http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot
.
|
I'm running a raspbian (based on debian). I want to change the priority of the init services so the very first script which is run by init is one made for me. How can I do it?
On runlevel S I have 3 scripts with priortity 01: hostname.sh, fake-hwclock and mountkernfs.sh. If I just put my script on runlevel S with priority 01, it's not the first one to be executed. I have tried to change the priortiy of all these scripts to 02 using (for example in the case of mountkernfs.sh)
sudo update-rc.d -f mountkernfs.sh remove
sudo update-rc.d mountkernfs.sh start 02 SThe first command effectively removes the script from /etc/rcS.d. The second command puts again mountkernfs.sh with priority 01.
Any idea? Thank you!
| Change init scripts priority |
It is called the nice value, and is shown by default in some of the configurations of top. If it is not showing by default, you can do the followingExecute top
Press f
Navigate to the line beginning with NI and press Space
Press q to return to the main view.This is documented in sections 3a and 3b of the manpages of top.
Edit:
@Kusalananda has pointed out that priority is not the same as the nice value. The OP should examine the definitions of both and choose the appropriate one to use for his purpose.
To access the priority, change the NI in step 3 to PR.
My top is showing both priority and nice value by default.
|
I have the below output from top command. Where is the process priority of the processes?
Mem: 678048K used, 336240K free, 0K shrd, 4K buff, 523012K cached
CPU: 0.5% usr 26.1% sys 0.0% nic 72.9% idle 0.0% io 0.0% irq 0.4% sirq
Load average: 1.89 1.75 1.62 3/154 3595
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
3794 1 root R 1992 0.2 0 19.5 /usr/sbin/syslogd
297 2 root SW 0 0.0 0 4.0 [ocf_0]
299 2 root SW 0 0.0 1 0.5 [ocf_1]
1152 1 root S 4032 0.4 1 0.3 /usr/sbin/procrecovery_mgr
1100 2 root SW 0 0.0 1 0.2 [ubi_bgt0d]
1330 2 root DW 0 0.0 1 0.2 [pfe_ctrl_timer] | How to change order to process priority on top command? |
When you want bash to stop logging your commands, just unset the HISTFILE variable:
HISTFILE=All further commands should then no longer be logged to .bash_history.
On the other hand, if you are actually supplying passwords as arguments to commands, you're already doing something wrong. .bash_history is not world-readable and therefore not the biggest threat in this situation:
ps and /proc are the big problem. All users on the system can see the commands you're currently running with all of their arguments. Passing passwords as command line arguments is therefore inherently insecure. Use environment variables or config files (that you have chmodded 600) to securely supply passwords.
|
Is it possible to open an incognito session in bash?
For example, when we need to enter passwords in commands and don't want bash to add them to history.
| How do I open an incognito bash session? |
You can use lsof and watch to do this, like so:
$ watch -n1 lsof -i TCP:80,443Example output
dropbox 3280 saml 23u IPv4 56015285 0t0 TCP greeneggs.qmetricstech.local:56003->snt-re3-6c.sjc.dropbox.com:http (ESTABLISHED)
thunderbi 3306 saml 60u IPv4 56093767 0t0 TCP greeneggs.qmetricstech.local:34788->ord08s09-in-f20.1e100.net:https (ESTABLISHED)
mono 3322 saml 15u IPv4 56012349 0t0 TCP greeneggs.qmetricstech.local:54018->204-62-14-135.static.6sync.net:https (ESTABLISHED)
chrome 11068 saml 175u IPv4 56021419 0t0 TCP greeneggs.qmetricstech.local:42182->stackoverflow.com:http (ESTABLISHED) |
I want to see a list of all outgoing HTTP requests from my desktop. I think it should be possible to monitor HTTPS hostnames as well for local clients using Server Name Indication (SNI).
OS X has a nice GUI utility called Little Snitch, which is a per-app HTTP monitor and firewall rule front-end.
I would settle for a nice terminal utility. tcpdump is overkill as I just want to see where the traffic is going in real-time and not the transmitted data. Ideally, I would like to see what process made the request as well, but just seeing what dials home would be a nice start.
| Monitor outgoing web requests as they’re happening |
You cannot hide your public IP address (assigned to the WAN interface of your router). You can, however, hide your private IP address (assigned to the NIC of your computer):Go to Thunderbird's about:config page (in version 3.1 it's Edit > Preferences > Advanced > General > Config Editor).
Find the mail.smtpserver.default.hello_argument preference (if it doesn't exist create it by right-clicking > New > String).
Enter "localhost" (or some other string) as its value.UPDATE (to answer your update): Mail messages sent via web interfaces (like Gmail's, Hotmail's etc) can have an X-Originating-IP header that shows your public IP. Some services add this header (e.g. Hotmail) and some don't (e.g. Gmail).
|
I'm using:
thunderbird-10.0.3-1.el6_2.x86_64 on Scientific Linux 6.1
and if I send an e-mail (with Gmail) from my Thunderbird then I can see that the e-mail I sent contains a very-very bad thing:
Received: from [192.168.1.142] (31-149-121-34.pool.myisp.com. [31.149.121.34])So ALL the e-mail that I'm sending containst my NATed IP address + my public IP address.
Can I delete/remove these lines, so that they will be aren't in ALL the e-mails that I send??
UPDATE:
if I send an e-mail with the gmail web interface, then:
Received: by 10.112.129.10 with HTTP; Sat, 14 Apr 2012 09:20:13 -0700 (PDT)Aren't there any Thunderbird Add-ons that modifies my IP Address in the e-mail?
| How to remove the "Received: from" from an e-mails source? |
ssh-add doesn't have an option to bypass its check of the key permissions. You could recompile the program and disable the check.
A bindfs should work. You don't need to mount it at ~/.ssh, mount it at a special-purpose location and write a script that does ssh-add ~/.ssh-private-keys-bindfs.
Note that ssh is right in that your setup is pretty insecure. You must make sure never to plug that drive into a computer where you are not the sole user.
|
I have a set of SSH keys to login to accounts and servers. However, ever since I moved my main work profile to a USB drive (for sync and ease of use among other reasons) I have been unable to directly use the SSH keys in the profile for authentication, having to create local copies instead.
Normal SSH workflow usually goes
ssh-add $HOME/.ssh/id_server_key
ssh username@domainWhich works without problems. However, to prevent each machine from having a copy of my keys I moved them to an xexternal drive, USB formatted as vfat. Then workflow should become like this:
ssh-add /run/media/myself/USB/.ssh/id_server_key
ssh [email protected] doesn't work. SSH complains about doing something to protect me:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'id_server_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: id_server_key
Permission denied (publickey).Which, while I can understand, it's not really protecting me in this case.
The USB drive automounts in my distro, with a fmask of (I think) 022. I could unmount and remount the USB drive with a fmask of 077 but that would (1) require superuser privilege each time and (2) affect every single file in the device, not only the SSH keys.
I've tried creating a symlink to the key, even with previous use of umask as I've seen in some tips&tricks:
cd .ssh
umask 077
ln -s /run/media/myself/USB/.ssh/id_server_key But the permissions can not be used this way for a symbolic link, so I get nothing.
So, what options do I have here available if the goal is to not have a physical copy of the key on the machine? One of the machines is a family laptop that goes to various places, so I have an interest in avoiding some of the keys being discovered.
So far I've considered the following:Is there for example an option to force SSH (ssh-add primarily) to accept the keys from the external device? (I presume there should be - most programs follow a "I-know-what-I'm-doing" flag, but so far I can't find it in the manpage.
Setting a bindfs over the .ssh/ directory, but the problem is that the directory is non-empty (as it contains known_hosts and other data).
fuse-zip-ing the keys over /dev/shm seems to be a possible path as well.EDIT: As per @Gilles 's comment, yes, bindfs solves the issue. After a checking of the manpage, initial testing succeeded using the following invocation:
bindfs -n -r -p 0700 -o nonempty /run/media/myself/USB/.ssh/ ~/.ssh Which binds disallowing access from other users (apparently even from root!), read-only, with reflected 0700 permissions. That reflection was the part that I lacked when working with bindfs originally. The nonempty flag was needed because of preexisting files such as known_hosts. This preserves the original workflow exactly except for an extra warning messae about not being able to add information to known_hosts (which in the end I might not mind).
Of course, I'm bindfs-ing to another directory now (in /dev/shm) as originally suggested to make things slightly easier.
I'm not as conspiranoid so as to encfs my USB drive (yet) so privacy-wise this is good enough for me.
| SSH using keys in external storage - permissions? |
I guess the traditional way would be to make pseudo-users (like the games-user) for the program/set of programs, assign this user to the groups for devices it should access (eg. camera), and run the program(s) SUID as this user. If you removed permissions for "others" (not owner or group), only the owner and members of the group - including the pseudo-user - could access it.
Further more, you could use the group of the program(s) to restrict which users where allowed to execute the program(s). Make a group (eg. conference) for the users allowed to make video-conferences, and restrict the execution of the associated programs (the ones granted special access to camera and mic) to this group only.
+++
Another way is running the program SGID as the special-group belonging to the device, and remove permission for "others". This of course only work if the program need to access just one restricted device.
|
If I tell applications like VLC or Audacity to record from my webcam or microphone, they just wake the hardware if sleeping and do their work without my interference.
Although this is a good thing, I've always wondered, due to privacy concerns: is there a way to restrict applications access to a hardware device?
While writing this, I came up with the idea of using something like SELinux or AppArmor to restrict access to /dev/something. Is this possible? Could there be a better or easier way?
Also, is there any more hardware besides the webcam and microphone that I should be concerned about?
| Restrict applications to access certain hardware (webcam, microphone...) |
You can't.
The root user has full access to the machine. This includes the possibility of running keyloggers, reading any file, causing the programs you run to do things without showing them in the user interface... Whether this is likely to happen depends on your environment so we can't tell you that. Even 2FA isn't safe because of the possibility of session hijacking.
In general, if you suspect a machine isn't safe, you shouldn't use it to access your services.
|
How can I safely access "my" web services and accounts in a computer in which I do have sudo rights but the administrator(s) have, naturally, remote root access as well?
Details
I use a dekstop which is connected to a (large) closed/restricted LAN. Even log-in to the system is only successful if connected to the LAN.
The administrator has, of course, remote root access (which I will suggest to change and opt for a password-less ssh-key based authentication). As well, my userid is assigned to the sudoers group, ie, in the /etc/sudoers file, there is:
userid ALL=(ALL) NOPASSWD: ALLI am hesitant to use my passwords for accessing my webmail client and my firefox account. And more.
QuestionsWhat can I do to ensure that my passwords, to access external web services, are protected from anyone else than me?
For example, since I do have sudo rights, how can I ensure that no key loggers are running?
I access password-less-ly based on SSH key(s) various services. How can I protect my passphrase from being logged?
Would 2FA be safe to access external services in such a use-case?
Is there a collection of "Safe practices using a Linux-based computer which others can access remotely as root?" | How can I protect my user passwords and passphrase from root |
The wtmp file is a sequence of struct utmp records. To remove the last 10 records, you first discover the size of a utmp record, then you truncate the wtmp file to its current size minus the ten times the size of a utmp record.
A simple C program will give you the size of a utmp record.
#include <utmp.h>
#include <stdio.h>struct utmp foo;main()
{
printf("%lu\n", sizeof foo);
return 0;
}and a Perl script will truncate the wtmp file
$utmp_size = utmp_record_size_goes_here;
$wtmp_file = "wtmp filename goes here";
open WTMP, "+<", $wtmp_file or die "$wtmp_file: ", $!;
seek WTMP, -10 * $utmp_size, 2;
truncate WTMP, tell(WTMP);
close WTMP; |
How to clear the last -10 information only for a Linux system? I tried to execute the command > /var/log/wtmp to clear the last info, but it clears the whole login info , but I need to clear only last -10 login info.
| How to clear the last -10 info? |
The remote host sees nothing but the (encrypted) reads and writes to the file.
|
I created an encrypted volume with LUKS and uploaded it to a remote directory on an untrusted host.
I can mount it locally though. I first mount the remote directory locally with sshfs and then open my volume with cryptsetup as if it were a local file.
$ sshfs user@host: remote/
# cryptsetup luksOpen remote/disk.img disk
$ mount /dev/mapper/disk mount_point/My question is: do I thereby make whatever is in mount_point/ visible to users on the remote host? Also, are commands I execute in a directory mounted through sshfs transparent to administrators on the remote host?
| Are remote LUKS volumes mounted locally with sshfs made visible to remote users? |
In Linux, userChrome.css needs to be created in ~/.thunderbird/blahblah.default/chrome, where blahblah.default is replaced with the name of your actual profile folder in ~/.thunderbird.
Just tried it on my install, and it works as expected.
|
Thunderbird pats itself on the back for not loading external content and protecting your privacy, but at the same time has a bright yellow notification bar tempting you constantly to do exactly that:There is a description of how to make that notification bar go away in Windows here. They want you to create a file called userChrome.css and add the following to it:
#mail-notification-top{
display: none;
} I'm using Thunderbird 78 and Debian 10 and did a find search in my user folder and found .themes/CBlue/cinnamon/userChrome.css and added that css to it, saved and rebooted, but the notification in thunderbird is still there. Any ideas how to make it go away?
| remove the remote content warning in thunderbird |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.