#StackBounty: #drivers #nvidia #graphics #17.10 #configuration 'Nvidia X Server Setting' tab missing (Ubuntu 17.10)

Bounty: 50

I have installed Nvidia (Geforce 940MX) Graphics driver version 384.111 from Softwares & Updates > Additional Drivers.

When I open “Nvidia X Server settings” it shows empty.
I have tried

sudo apt-get purge nvidia*

and reinstall drive manually still facing the same issue.
I have tried to switch drivers and reboot the computer.

enter image description here

also, I switched to “Ubuntu xOrg” and reinstall the driver but no luck showing the same result like below image.

enter image description here

About page show as system uses Intel Graphic Card

enter image description here


Get this bounty!!!

#StackBounty: #drivers #nvidia #graphics #17.10 #configuration 'Nvidia X Server Setting' tab missing (Ubuntu 17.10)

Bounty: 50

I have installed Nvidia (Geforce 940MX) Graphics driver version 384.111 from Softwares & Updates > Additional Drivers.

When I open “Nvidia X Server settings” it shows empty.
I have tried

sudo apt-get purge nvidia*

and reinstall drive manually still facing the same issue.
I have tried to switch drivers and reboot the computer.

enter image description here

also, I switched to “Ubuntu xOrg” and reinstall the driver but no luck showing the same result like below image.

enter image description here

About page show as system uses Intel Graphic Card

enter image description here


Get this bounty!!!

#StackBounty: #networking #routing #firewall #openvpn #dhcp DHCP package not transversing tun0 interface

Bounty: 50

I have the following setup on a remote office:

--- vlan interface --- Remote Router --tun0--> Main office Firewall --> Active Directory DHCP

I’m using dhcp3-relay to forward dhcp requests(broadcasts) to my main AD server(unicast). Problem is: dhcp request arrives at the Remote Router vlan interface(broadcast), is correctly forwarded through routing to our AD server, an answer is given but when receiving the packet, it isn’t internally forwarded from tun0 to the vlanXXX interface of the Remote Router where the request originaly came from. Here it is the tcpdump output from the Remote Router.

tun0 interface:

tcpdump -i tun0 -nevvv udp port 67 or 68

13:23:45.049995 Out ethertype IPv4 (0x0800), length 592: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 576) IP.VPN.REMOTE.OFFICE.67 > IP.OF.AD.SERVER.67: BOOTP/DHCP, Request from MAC:ADDR:OF:THE:REMOTE:CLIENT, length 548, hops 1, xid 0x2c896edc, secs 11527, Flags [none] (0x0000)
          Gateway-IP IP.OF.NET.GATEWAY
          Client-Ethernet-Address MAC:ADDR:OF:THE:REMOTE:CLIENT [|bootp]

13:23:45.145014  In ethertype IPv4 (0x0800), length 350: (tos 0x0, ttl 125, id 24829, offset 0, flags [none], proto UDP (17), length 334) IP.OF.AD.SERVER.67 > IP.OF.NET.GATEWAY.67: BOOTP/DHCP, Reply, length 306, xid 0x2c896edc, Flags [none] (0x0000)
          Your-IP NEW.LEASE.FROM.AD
          Server-IP IP.OF.AD.SERVER
          Gateway-IP IP.OF.NET.GATEWAY
          Client-Ethernet-Address MAC:ADDR:OF:THE:REMOTE:CLIENT [|bootp]

Here you can see that the packet is correctly forwarded by the dhcrelay software to our main office, and AD gives a new lease to the host. We already have this solution working on other links that are not openvpn based(mpls) to distribute IPs to remote offices.

vlanXXX interface:

tcpdump -i vlanXXX -nevvv udp port 67 or 68

13:21:45.022067 MAC:ADDR:OF:THE:REMOTE:CLIENT > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 590: (tos 0x0, ttl 64, id 147, offset 0, flags [none], proto UDP (17), length 576) 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from MAC:ADDR:OF:THE:REMOTE:CLIENT, length 548, xid 0x496364c3, secs 11407, Flags [none] (0x0000)
          Client-Ethernet-Address MAC:ADDR:OF:THE:REMOTE:CLIENT [|bootp]

We can only see the broadcast request comming from the host, but not the answer that arrived at tun0 and should be routed to vlanXXX.

Also, Remote Router is pretty permissive with this protocol:

iptables -A INPUT  -p udp --sport 67:68 --dport 67 -j ACCEPT
iptables -A OUTPUT -p udp --sport 67 --dport 67:68 -j ACCEPT
iptables -A FORWARD -p udp --sport 67:68 --dport 67 -j ACCEPT
iptables -A FORWARD -p udp --sport 67 --dport 67:68 -j ACCEPT

Am I missing something?


Get this bounty!!!

#StackBounty: #drivers #nvidia #graphics #17.10 #configuration 'Nvidia X Server Setting' tab missing (Ubuntu 17.10)

Bounty: 50

I have installed Nvidia (Geforce 940MX) Graphics driver version 384.111 from Softwares & Updates > Additional Drivers.

When I open “Nvidia X Server settings” it shows empty.
I have tried

sudo apt-get purge nvidia*

and reinstall drive manually still facing the same issue.
I have tried to switch drivers and reboot the computer.

enter image description here

also, I switched to “Ubuntu xOrg” and reinstall the driver but no luck showing the same result like below image.

enter image description here

About page show as system uses Intel Graphic Card

enter image description here


Get this bounty!!!

#StackBounty: #machine-learning #reinforcement-learning #multiarmed-bandit Does there exist a single metric that can compare various Mu…

Bounty: 150

I am currently trying to compare how different formulations of a Multi-arm Bandit problem performs across various factors like the variance of the reward distributions of each arm, to the $epsilon$ parameter used in $epsilon$-greedy search. Originally, I used the regret as a way of characterizing performance over an epoch of time length $T$. However, I realized that the regret cannot be used to compare a MAB problem with normally distributed rewards with one that has Bernoulli rewards. This is because the regret, defined as the cumulative difference between the optimal mean and the chosen arm’s mean, is sensitive to scale. Does there exist a scale-less metric where I can compare a MAB using Normal rewards with one that uses Bernoulli rewards?


Get this bounty!!!

#StackBounty: #linux #bash #shell #sed #scp copy files in parallel by reading what files to copy from few other files

Bounty: 50

I am working on a little complicated shell script for the first time and below is what it should do:

  • During startup, it figures out what is my clientid by looking at host-mapping.txt file. If I cannot find clientid for my hostname then I need to exit from shell script with non zero status code and log error message.
  • Now once I have valid clientid, I will extract primary files from primary-mappings.txt file and secondary files from secondary-mappings.txt file for that valid clientid. If for whatever reason, I cannot find either primary or secondary files for that clientid from that file, then I will exit from shell script and log an error message.
  • Now once I have valid primary and secondary files for that clientid then I will start copying those files in parallel using gnu-parallel from local_server. All primary files will go to primary folder and all secondary files will go to secondary folder. If files are not there in hold1 folder on remote servers then it should be there on hold2 folder.
  • Now once all the files are copied, I will verify at the end to make sure all the primary and secondary files are present for that clientid in those two folders but if for whatever reason, I cannot find those files then I want to exit from the shell script with message that tells me what files are missing.

Below is my script and it does the job but I would like to see if there is any better or efficient way to do above things since this is my first time writing little complicated script so wanted to check this out. As of now, I don’t have mechanism to exit out of shell script if I cannot find primary or secondary files for that clientid and also I don’t have mechanism to exit out of shell script if during the verification phase some files are missing.

#!/bin/bash
path=/home/goldy/scripts
mapfiles=(primary-mappings.txt secondary-mappings.txt)
hostfile=host-mapping.txt
machines=(machine1769.abc.host.com proctek5461.def.host.com letyrs87541.pqr.host.com)
# folders on local box where to copy files
primary=/data01/primary
secondary=/data02/secondary
# folders on remote servers from where to copy files
export hold1=/data/snapshot/$1
export hold2=/data/snapshot/$2

date1=$(date +"%s")
# this will tell me what's my clientid given my current hostname
getProperty () {
   prop_value=$(hostname -f)
   prop_key=`cat $path/$hostfile | grep "$prop_value" | cut -d'=' -f1`
   echo $(echo $prop_key | tr -dc '0-9')
}
# if I can't find clientid for my hostname, then I will log a message 
# and exit out of shell script with non zero status code
clientid=$(getProperty)
[ -z "$clientid" ] && { echo "cannot find clientid for $(hostname -f)"; exit 1; }

# now once I have valid clientid, then I will get primary and secondary mapping
# from the "host-mapping.txt" file
declare -a arr
mappingsByClientID () {
  id=$1 # 1 to 5
  file=$path/${mapfiles[$2]} # 0 to 1
  arr=($(sed -r "s/.*b${id}=[([^]]+).*/1/; s/,/ /g" $file))
  echo "${arr[@]}"
}

# assign output of function to an array
pri=($(mappingsByClientID $clientid 0))
snd=($(mappingsByClientID $clientid 1))

echo "primary files: ${pri[@]}"
echo "secondary files: ${snd[@]}"

# figure out which machine you want to use to start copying files from
case $(hostname -f) in
    *abc.host.com)
        local_server=("${machines[0]}")
        ;;
    *def.host.com)
        local_server=("${machines[1]}")
        ;;
    *pqr.host.com)
        local_server=("${machines[2]}")
        ;;
    *) echo "unknown host: $(hostname -f), exiting." && exit 1 ;;
    # ?
esac
export local="$local_server"

# deleting files before we start copying
find "$primary" -maxdepth 1 -type f -exec rm -fv {} ;
find "$secondary" -maxdepth 1 -type f -exec rm -fv {} ;

do_copy() {
  el=$1
  primsec=$2
  (scp -C -o StrictHostKeyChecking=no goldy@"$local":"$hold1"/hello_monthly_"$el"_999_1.data "$primsec"/. > /dev/null 2>&1) || (scp -C -o StrictHostKeyChecking=no goldy@"$local":"$hold2"/hello_monthly_"$el"_999_1.data "$primsec"/. > /dev/null 2>&1)
}
export -f do_copy
# copy files in parallel
parallel -j "$3" do_copy {} $primary ::: ${pri[@]} &
parallel -j "$3" do_copy {} $secondary ::: ${snd[@]} &
wait
echo "all files copied"

# this is for verification to see all files got copied or not
# in primary and secondary folder
set -- "$primary" "$secondary"
typeset -n array
for array in pri snd; do
    for num in "${array[@]}"; do
        name="hello_monthly_${num}_999_1.data"
        if [ ! -f "$1/$name" ]; then
            { echo "$name" not found in "$1" >&2 && exit 1; }
        fi
    done
    shift
done

date2=$(date +"%s")
diff=$(($date2-$date1))
echo "Total Time Taken - $(($diff / 3600)) hours and $(((diff/60) % 60)) minutes and $(($diff % 60)) seconds elapsed."

Below is my host-mapping.txt file and it will have lot more entries. Here value is a valid hostname and key will be string “k” followd by some number and that number should be there in mapping files.

k1=machineA.abc.com
k2=machineB.abc.com
k3=machineC.def.com
k4=machineD.pqr.com
k5=machineO.abc.com

And below is my sample mapping files:

primary_mappings.txt

{1=[343, 0, 686, 1372, 882, 196], 2=[687, 1, 1373, 883, 197, 736, 1030, 1569], 3=[1374, 2, 884, 737, 198, 1570], 4=[1375, 1032, 1424, 3, 885, 1228], 5=[1033, 1425, 4, 200, 886]}

secondary_mappings.txt

{1=[1152, 816, 1488, 336, 1008], 2=[1153, 0, 817, 337, 1489, 1009, 1297], 3=[1, 1154, 1490, 338], 4=[1155, 2, 339, 1491, 819, 1299, 1635], 5=[820, 1492, 340, 3, 1156]}

For example: clientid 1 has 343, 0, 686, 1372, 882, 196 primary files and 1152, 816, 1488, 336, 1008 secondary files. Similarly for other clientids as well.


Get this bounty!!!

#StackBounty: #postgresql #datetime #timestamp Is timestamptz preferred when timezone logic is performed by the client?

Bounty: 50

I’m in the process of migrating a web application from SqlServer to PostgreSQL and I’m trying to figure out which type to replace datetime2 with.

The general advice seems to be always use timestamptz, and never use timestamp. The reasons given tend to be along the lines that timestamp and timestamptz are stored the same regardless (so no performance penalty) and timestamptz auto-converts to the timezone of the connection. Ignoring timezones altogether in Rails and PostgreSQL | Stack Overflow

Unfortunately my legacy .NET codebase is very inconsistent with datetimes and we usually render in UTC regardless of the users timezone. More recent code has been using NodaTime and it’s Instant class, but we rarely have to deal with times and displaying just date has been “close enough”. My understanding of using NodaTime properly, however, is to convert an Instant to LocalDateTime as late as possible – and not in the database.

In addition to this, I’m not entirely sure how Postgres knows the correct timezone of the “current user”. I know you can set the timezone specifically as a session parameter SET TIME ZONE 'UTC';, are you expected to do this for every connection as appropriate for the “current user”? If so, is this reset whenever the connection is retrieved from the connection pool? I also see that Npgsql has the ability to set a timezone for a connection string, presumably this isn’t appropriate if it’s per user?

All this leads me to think the best option is to use timestamp for all datetimes, and use application logic to convert to local datetime. I guess another option is to use timestamptz for all datetimes, force the connection to use UTC in the connection string, and use application logic to convert to local datetime. However I worry that Postgres will perform extra work in doing a no-op conversion between UTC and UTC.

TLDR: Is timestamptz still preferred if the application always inserts/reads UTC and converts to local datetime itself?


Get this bounty!!!

#StackBounty: #networking #network-interface #tap How Can I Connect a TAP to Ethernet?

Bounty: 200

I am trying to set up a Linux bridge to connect a physical radio (N210) to ns3 via a TAP. The radio is plugged into Ethernet (epn0s25) and I have tried the following console commands:

sudo brctl addbr bridge0
sudo tunctl -t tap0
sudo ifconfig tap0 hw ether 00:00:00:00:00:01
sudo ifconfig tap0 0.0.0.0 up
sudo brctl addif bridge0 tap0
sudo brctl addif bridge0 epn0s25
sudo ifconfig mybridge 10.1.1.1 netmask 255.255.255.0 up

However pinging epn0s25 or bridge0 results in no activity on the other side. showstp on bridge0 shows tap0 is disabled so I think that may be the problem but I am unsure how to fix it.


Get this bounty!!!

#StackBounty: #drivers #nvidia #graphics #17.10 #configuration 'Nvidia X Server Setting' tab missing (Ubuntu 17.10)

Bounty: 50

I have installed Nvidia (Geforce 940MX) Graphics driver version 384.111 from Softwares & Updates > Additional Drivers.

When I open “Nvidia X Server settings” it shows empty.
I have tried

sudo apt-get purge nvidia*

and reinstall drive manually still facing the same issue.
I have tried to switch drivers and reboot the computer.

enter image description here

also, I switched to “Ubuntu xOrg” and reinstall the driver but no luck showing the same result like below image.

enter image description here

About page show as system uses Intel Graphic Card

enter image description here


Get this bounty!!!